XE1200 External RSSI AN1200.01 Application Note XE1200 External RSSI Rev 1 August 2005 www.semtech.com 1 XE1200 External RSSI Table of Contents 1 2 3 4 5 Introduction ................................................................................................................................................ 3 RSSI algorithm ........................................................................................................................................... 4 External RSSI usage.................................................................................................................................. 5 Hardware connections ............................................................................................................................... 7 Software implementation ........................................................................................................................... 7 5.1 XE1203Driver.c................................................................................................................................... 8 5.2 Initialisation.c ...................................................................................................................................... 9 5.3 Uart.c .................................................................................................................................................. 9 5.4 Measure Rssi.c ................................................................................................................................. 10 5.5 Considerations for the MeasureRssi implementation....................................................................... 10 6 Performances and trade-off ..................................................................................................................... 13 © Semtech 2005 www.semtech.com 2 XE1200 External RSSI 1 INTRODUCTION VSS VSSA IAMP QAMP VDD VDDA VSSP VDDF VDDD VDDP VSSF VSSD The purpose of this application note is to develop a high dynamic and good accuracy external RSSI for the XE1203F. This RSSI is made using I (IAMP) and Q (QAMP) analog signals. These signals are at the output of the low pass filter in the XE1203F Rx path: IAMP QAMP SI RSSI FAMP LPF BBAMP SO LIM CONTROL DATA RFA MATCHING NETWORK EN LNA FEI SWITCH RFB FAMP LPF BBAMP LIM PATTERN MATCHING LO_BUF IREF DEMOD BITSYNC MMOD DIVIDER LOGIC CONTROL DATAIN DATA 11 Bits BARKER ENCODER modulator /n Synthesizer DIVCTL CLKXTAL XE1203 TrueRF™ XE1203 RFOUT PA PATTERN DCLK PHASE SHIFTER 11 Bits BARKER DECODER MATCHING NETWORK SCK CH PUMP PFD VCO OSCILLATOR /n CLOCK OUT IREF POR TKA VCO TANK TKB XTA LFB LOOP FILTER XTB CLKOUT TSUPP TMOD(3:0) POR XTAL The RSSI algorithm will evaluate the power on I or Q signal. It represents the received signal’s power. It can be implemented on any of the XE1200 transceivers that have I and Q outputs. In a first section, we will explain the algorithm, its hardware and software implementation and finally present its performances and trade-off. This algorithm is developed in C in order to be easily portable. © Semtech 2005 www.semtech.com 3 XE1200 External RSSI 2 RSSI ALGORITHM The RF received signal’s power can be evaluated at the I and Q level. Knowing the gain in the Rx path and the power on I or Q, it is possible to determinate the received signal’s power. The RSSI algorithm will evaluate the power on the I signal. This algorithm can be divided in two parts: First, the estimation of the DC voltage on I and then the estimation of the RSSI. The algorithm will be the following: Step 2: RSSI Measurement A/D converter I or Q 1/A A/D ABS z −1 EstRssi I_DC z −1 Step 1: DC voltage estimation Hardware Software Figure 1. EstRssi relates to the level of the signal at the antenna, so depending on the application; one can calculate the real power of the signal by applying the formula or works in relative. To calculate the power of the received signal in dBm, first it is necessary to calculate the power of EstRssi with a 50Ω load, to substract the gain of the Rx path, to transform dB to dBm and then to take into account that the algorithm introduces a constant of 3.9. The formula is the following: Formula1: PRe alDbm = 10 * log( PEstRssi ) − G + 30 + 3.9 = 10 * log( EstRssi 2 ) − G + 30 + 3.9 50 © Semtech 2005 www.semtech.com 4 XE1200 External RSSI 3 EXTERNAL RSSI USAGE This application can be easily set up. It only requires an RF signal generator or a XM1203F to transmit a RF signal, a XM1203F to receive this signal, a MSP430, a serial cable and a PC to receive the data. RF cable RF signal Generator Serial cable XM1203 F MSP430 : RSSI software embedded Or Serial cable XM1203 F XM1203 F MSP430 : RSSI software embedded The configuration of the UART is the following: © Semtech 2005 www.semtech.com 5 XE1200 External RSSI On the PC, the received data will be in the following format: The return value is related to the 12 bit ADC. To get the received signal power in dBm, we should apply the formula 1 from section 2. So for a return value of 0x0303, it corresponds to x = 303*2.5/FFF = 0.47 V and if we apply the formula PRe alDbm = 10 * log( EstRssi 2 ) − G + 30 + 3.9 , we find that the level is -73.6 dBm for G = 84 dB. 50 © Semtech 2005 www.semtech.com 6 XE1200 External RSSI 4 HARDWARE CONNECTIONS This algorithm is developed in C and has been implemented on a MSP430. It can be easily ported to another microcontroller that has an ADC. Connections between the XM1203 and the MSP430: XM1203 SCK SI SO EN TX RX DATAIN P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 DCLK DATA PATTERN P2.0 P2.1 P2.2 Pad I or Q MSP430 P6.3: ADC Input Required for the RSSI application Optional 5 SOFTWARE IMPLEMENTATION For the software implementation, the main function calls sub functions for the initialization of the MSP430, the initialization of the XM1203F, to set the XM1203F into receive mode, to calculate the RSSI and to send the result to the UART. The sub functions related to the XM1203F are located in the file XE1203Driver.c. The ones related to the initialization of the MSP430 are in the file Initialisation.c. Uart.c contains the sub functions to handle the UART and MeasureRssi.c to measure the RSSI. © Semtech 2005 www.semtech.com 7 XE1200 External RSSI 5.1 XE1203DRIVER.C The file XE1203Driver.c includes functions to drive the XE1203. They have the same prototypes as the ones developed for the API TN8000.18 “XE8000 driving XE1200 transceivers”. The same conventions and global variables are used. For the different data types, the same conventions are used but adapted to the MSP430 compiler: Standard type name unsigned char signed char unsigned short short long unsigned long double Defined type name _U8 _S8 _U16 _S16 _S32 _U32 _F32 Comment 8 bit quantity 8 bit signed quantity 16 bit quantity 16 bit signed quantity 32 bit signed quantity 32 bit quantity 32 bit float quantity To configure the XE1203F (baud rate, frequency deviation, mode A or B), the variable RegistersCfg[] is used ( see chap 5.4 “Initializing transceiver parameters” from TN8000.18 [2]). Most of the functions in the XE1203Driver.c file of this application can be found in the XE1203Driver.c file of TN8000.18 [2]. They are here implemented on a MSP430 using the same syntax. Utility functions have been specially developed. For further information see chap. 6 “API Functions” of TN8000.18 [2]. Configuration functions: InitRFChip : This routine initializes the RFChip registers, Using Pre Initialized variable SetRFMode : Sets the XE1203F operating mode (Sleep, Receiver, Transmitter) WriteRegister : Writes the register value at the given address on the XE1203F ReadRegister : Reads the register value at the given address on the XE1203F Communication functions: SendRfFrame : Sends a RF frame ReceiveRfFrame : Receives a RF frame SendByte : Send a data of 8 bits to the transceiver LSB first ReceiveByte : Receives a data of 8 bits from the transceiver LSB first Utility functions: Wait : This routine uses the timer A to create a delay using the ACLK clock InvertByte : Inverts a byte. MSB -> LSB, LSB -> MSB Functions developed specifically for the MSP430: WaitSCK : This routine use a time out loop to have SCK lower than 1 MHz TxInterruptOn : Initializes the timers and the interruptions related to the TX routines TxInterruptOff : Disables the timers and the interruptions related to the TX routines RxInterruptOn : Initializes the timers and the interrupt related to the RX routines RxInterruptOff : Disables the timers and the interrupt related to the RX routines © Semtech 2005 www.semtech.com 8 XE1200 External RSSI 5.2 INITIALISATION.C The file Initilisation.c contains all the functions used to initialize the MSP430. The MSP430 will be clocked by an 8 MHz external quartz. InitMicro : Initializes the MicroController peripherals, it calls the following sub functions: InitPort1 : Initializes the Port 1 as an I/O and set the pins as outputs InitPort2 : Initializes the Port 2 as an I/O and set the pins as inputs InitPort3 : Initializes the Port 3 and set P3.4 for the UART InitPort6 : Initializes the Port 6 and set P6.3 = A3 = Input used by the ADC InitClockModule : Initializes the clock module. MCLK = LFXT1 = 8MHz and ACLK = LFXT1 = 8MHz, SMCLK=DCOCLK (Res=0, DCO=0 -> freq=74.1 KHz) InitTimerA : Initializes the Timer A InitTimerB : Initializes the Timer B InitADC : Initializes the ADC. The internal reference voltage 2.5 V is used for Vr+ and Vr- = AVss. Continuous sampling and conversion mode is programmed. ADC12CLK = ACLK = 8 MHz, tsample = 4* ADC12CLK, tconvert = 13* ADC12CLK InitUART: Initialize the UART0 to 8 bits data, 1 stop bit, even parity, Baud Rate = 19200 bps 5.3 UART.C This contains functions to transmit data to the UART. Hex2Char: Converts an hexadecimal number SendChar: Sends a character to the UART SendString: Send a string on UART Tx using SendChar function SendCRLF: Sends carriage return and line feed characters TransmitRssiUart: It transmits the result of the RSSI to the UART © Semtech 2005 www.semtech.com 9 XE1200 External RSSI 5.4 MEASURE RSSI.C The file MeasureRssi.c contains the functions to measure the RSSI. MeasureRssi: It first estimates the DC on I and calculates EstRssi MeasureRssi function: is a function that is in the fileMeasureRssi.c 5.5 CONSIDERATIONS FOR THE MEASURERSSI IMPLEMENTATION With the 12 bit MSP430 ADC, it takes 17 clock cycles to sample and convert a signal. So the maximum sampling frequency is 470 KHz. Between two samplings, it is necessary to process them. To estimate the DC or to calculate the RSSI, it requires more than 17 clock cycles. So the real sampling frequency is fixed by the time execution of the code which is 250 KHz in the two processes. The goal is to get the maximum sampling frequency in order to deal with higher frequency deviation. When a sample is ready, a flag is activated, the sample is processed and we wait for the next sample. In order to fill the Shannon theory and avoid overlapping, the sampling frequency will be at least two times the frequency of I or Q. The maximum sampling frequency obtained is 250 KHz, so the maximum frequency deviation that can be used is 125 KHz. When changing the frequency deviation, the variable FREQ_DEV located in MeasureRssi.h should be updated and set to the new frequency deviation. The variable FREQ_SAMPLE is fixed to 250000. This code is optimized for high frequency deviation; the goal has been to set as less instructions and cases as possible. The measurement of the RSSI will be done in two steps as followed: DC Estimation RSSI calculation © Semtech 2005 www.semtech.com 10 XE1200 External RSSI DC Estimation no Number of samples < NB_SAMPLE_I_DC yes no Sample ready yes Read sample Algorithm see fig 1. Number of samples ++ I_DC is evaluated © Semtech 2005 www.semtech.com 11 XE1200 External RSSI EstRssi Calculation no Number of samples < NB_SAMPLE_I_RSSI yes no Sample ready yes Read sample Algorithm see fig 1. Number of samples ++ RSSI is evaluated © Semtech 2005 www.semtech.com 12 XE1200 External RSSI 6 PERFORMANCES AND TRADE-OFF 6.1 PERFORMANCES In order to get a greater dynamic, we use mode A and mode B of the XE1203F. In mode A, the gain of the XE1203F is the greatest, it is about 84 dB. In mode B, the linearity of the receiver is increased and the gain is about 67 dB. The RSSI dynamic obtained is 60 dB, going from -111 dBm to -51 dBm. The standard deviation obtained is: - 0.3 dB from -51 dBm to -70 dBm in mode B - 0.2 dB from -70 dBm to -95 dBm in mode A - 0.3 dB to 0.6 dB from -95 dBm to -111 dBm in mode A Following is the linearity of the RSSI in mode A and mode B: Linarity of the RSSI in mode A -55 Mode A, Gain Rx= 84 dB Dev = 55 KHz, BR=4.8 Kps -65 -75 RSSI Out -85 average mesure theorical measure min measure max measure -95 -105 -115 -125 -125 -115 -105 -95 -85 -75 -65 -55 Level at the antenna ( dBm ) © Semtech 2005 www.semtech.com 13 XE1200 External RSSI Linearity of the RSSI in mode B -40 Mode B, Gain Rx = 67 dB Dev = 55 KHz, BR=4.8 Kps -50 -60 RSSI Out -70 average measure theorical measure min measure max measure -80 -90 -100 -110 -110 -100 -90 -80 -70 -60 -50 -40 Level at the antenna 6.2 TRADE-OFF To get this dynamic, this accuracy and this linearity, it takes first 680 µs to estimate the DC and 500 µs to calculate EstRssi. This time can be optimized by changing some parameters in the DC estimation or in the EstRssi calculation. I_DC Estimation: The DC estimation is done on NB _ SAMPLE _ I _ DC = 25 * FREQ _ SAMPLE samples that is to say FREQ _ DEV 25 periods of the frequency deviation. For a frequency deviation of 55 KHz ( FREQ _ DEV = 55000) , it takes 680 µs to make the DC estimation but we can decrease this time by setting NB _ SAMPLE _ I _ DC = 10 * FREQ _ SAMPLE . The DC FREQ _ DEV estimation will be done on 10 periods of the frequency deviation. These two examples have been implemented. In the second case, the DC is not estimated with the best accuracy. So, the lowest level of the RSSI is shifted and the dynamic decreased. The accuracy of the RSSI has remained the same. © Semtech 2005 www.semtech.com 14 XE1200 External RSSI Linarity of the RSSI versus the time to estimate I_DC -55 Mode A, Gain Rx= 84 dB Dev = 55 KHz, BR=4.8 Kps -65 -75 RSSI Out -85 average measure, Time I_DC=680 us theorical measure average measure, Time I_DC=358 us -95 -105 -115 -125 -125 -115 -105 -95 -85 -75 -65 -55 Level at the antenna ( dBm ) As a general rule, the time to estimate I_DC is: TimeI _ DC = 103 * NB _ SAMPLE _ I _ DC + 140 200 EstRssi calculation: Integration of | I - I_DC | The EstRssi calculation is done on NB _ SAMPLE _ RSSI = 25 * FREQ _ SAMPLE samples. FREQ _ DEV It takes 500 µs to make this calculation. As for the DC estimation, this time can be reduced by setting: NB _ SAMPLE _ RSSI = 10 * FREQ _ SAMPLE FREQ _ DEV These two examples have also been implemented and we can see that the dynamic is the same but the accuracy has been degraded (standard deviation goes from 0.3 to 0.8 dB) © Semtech 2005 www.semtech.com 15 XE1200 External RSSI Linarity of the RSSI versus the time to integrate | I - I_DC | -55 Mode A, Gain Rx= 84 dB Dev = 55 KHz, BR=4.8 Kps A=8 -65 average measure, Time Est_Rssi=500 us theorical measure -75 min measure, Time Est_Rssi=500 us max measure, Time Est_Rssi=500 us RSSI Out -85 average measure, Time Est_Rssi=300 us min measure, Time Est_Rssi=300 us max measure, Time Est_Rssi=300 us -95 -105 -115 -125 -125 -115 -105 -95 -85 -75 -65 -55 Level at the antenna ( dBm ) As a general rule the time to calculate the EstRssi is: TimeEst Rssi = 103 * NB _ SAMPLE _ I _ RSSI + 140 275 So depending on the application, we can decide either to improve the dynamic, the resolution or the time by changing the parameter NB_SAMPLE_I_DC or NB _SAMPLE_RSSI located in the file MeasureRssi.h. So finally, we will only have to change the parameter FREQ_DEV which corresponds to the frequency deviation of the application and if necessary NB_SAMPLE_I_DC or NB _SAMPLE_RSSI in the file MeasureRssi.h. REFERENCES [1] XE1203F datasheet [2] TN8000.18:XE8000 driving XE1200 transceivers standard API definitions http://www.semtech.com © Semtech 2005 www.semtech.com 16 XE1200 External RSSI © Semtech 2005 All rights reserved. Reproduction in whole or in part is prohibited without the prior written consent of the copyright owner. The information presented in this document does not form part of any quotation or contract, is believed to be accurate and reliable and may be changed without notice. No liability will be accepted by the publisher for any consequence of its use. Publication thereof does not convey nor imply any license under patent or other industrial or intellectual property rights. Semtech. assumes no responsibility or liability whatsoever for any failure or unexpected operation resulting from misuse, neglect improper installation, repair or improper handling or unusual physical or electrical stress including, but not limited to, exposure to parameters beyond the specified maximum ratings or operation outside the specified range. SEMTECH PRODUCTS ARE NOT DESIGNED, INTENDED, AUTHORIZED OR WARRANTED TO BE SUITABLE FOR USE IN LIFE-SUPPORT APPLICATIONS, DEVICES OR SYSTEMS OR OTHER CRITICAL APPLICATIONS. INCLUSION OF SEMTECH PRODUCTS IN SUCH APPLICATIONS IS UNDERSTOOD TO BE UNDERTAKEN SOLELY AT THE CUSTOMER’S OWN RISK. Should a customer purchase or use Semtech products for any such unauthorized application, the customer shall indemnify and hold Semtech and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs damages and attorney fees which could arise. Contact Information Taiwan Korea Shanghai Japan Tel: 886-2-2748-3380 Fax: 886-2-2748-3390 Tel: 82-2-527-4377 Fax: 82-2-527-4376 Tel: 86-21-6391-0830 Fax: 86-21-6391-0831 Tel: 81-3-6408-0950 Fax: 81-3-6408-0951 Switzerland United Kingdom France Germany Tel: 41-32-729-4000 Fax: 41-32-729-4001 Tel: 44-1794-527-600 Fax: 44-1794-527-601 Tel: 33-(0)169-28-22-00 Fax: 33-(0)169-28-12-98 Tel: 49-(0)8161-140-123 Fax: 49-(0)8161-140-124 Semtech International AG is a wholly-owned subsidiary of Semtech Corporation, which has its headquarters in the U.S.A © Semtech 2005 www.semtech.com 17