### DN508 -- Frequency Scanning using CC430Fx

```Design Note DN508
Frequency Scanning using CC430Fx, CC110x, and CC111xFx
By Siri Johnsrud
Keywords
•
•
•
•
1
•
•
•
•
CC430Fx
CC1100
CC1100E
CC1101
CC1110Fx
CC1111Fx
Frequency Scanning
VCO
Introduction
The purpose of this design note is to show
the necessary steps to successfully scan
through a frequency band covering
SWRA315
n numbers of channels, and find the
strongest signal in the band.
Page 1 of 9
Design Note DN508
KEYWORDS ..............................................................................................................................1
1
INTRODUCTION .............................................................................................................1
2
ABBREVIATIONS ...........................................................................................................2
3
EXAMPLE........................................................................................................................3
3.1
ASSUMPTIONS ............................................................................................................3
3.2
PSEUDO CODE ...........................................................................................................3
4
REFERENCES ................................................................................................................8
5
GENERAL INFORMATION.............................................................................................9
5.1
DOCUMENT HISTORY ..................................................................................................9
2
Abbreviations
CS
kHz
MHz
RF
RX
µs
VCO
Carrier Sense
Kilo Hertz
Mega Hertz
Micro Seconds
Voltage Controlled Oscillator
SWRA315
Page 2 of 9
Design Note DN508
3
3.1
Example
Assumptions
Assume one wants to scan the complete frequency band ranging from 779 - 928 MHz in steps of
200 kHz (This band is not covered by the CC1100E [3], which only supports the frequency bands
ranging from 470 - 510 MHz and from 950 - 960 MHz). The easiest way to accomplish this is to
select a base frequency for the frequency synthesizer (FREQ2, FREQ1, and FREQ0) and then use
the CHANNR register to change frequency between channels. The channel spacing is given by
Equation 1.
∆f CHANNEL =
f XOSC
⋅ (256 + CHANSPC _ M ) ⋅ 2 CHANSPC _ E
18
2
Equation 1. Channel Spacing
To achieve a channel spacing of ~200 kHz, MDMCFG1.CHANSPC_E must be set to 2 and
MDMCFG0.CHANSPC_M to 248. The channel spacing will then be 199.951172 kHz. There will be
746
channels
that
need
to
be
scanned
in
the
entire
band
((928 MHz – 779 MHz)/200 kHz + 1 = 746) and since the CHANNR register is only 8 bits wide, one
will have to use three different base frequencies to cover it. SmartRF® Studio [6] is used to find
the correct base frequencies and corresponding register settings. Please see Table 1 for details.
Sub Band #
Frequency Range
CHANNR
Base Frequency
FREQ2
FREQ1
FREQ0
Base (Start) Frequency [MHz]
Stop Frequency [MHz]
0
779.009766
829.997314
0 - 255
0x1D
0xF6
0x40
1
830.196869
881.184418
0 - 255
0x1F
0xEE
0x3F
2
881.384369
927.972992
0 - 233
0x21
0xE6
0x3F
Table 1. Base Frequencies and Channel Numbers
When using SmartRF Studio [6] to generate register settings one will see that the TEST0 register
is frequency dependent. In the band covered here, TEST0 should be 0x0B for frequencies from
861 MHz and below, and 0x09 for frequencies above 861 MHz. This means that sub band #0
should always use TEST0
=
0x0B, sub band #2 should always use
TEST0 = 0x09, while sub band #1 should use 0x0B for channel 0 - 154 and 0x09 for channel
155 - 255.
3.2
Pseudo Code
In short, what one should do is to go through all cannels in the band. For each channel, the radio
should enter RX mode and if CS is asserted, the RSSI value should be read and stored together
with the corresponding frequency. When all channels have been scanned, the frequency with the
highest RSSI value is selected. In the following pseudo code (see Figure 1 and Figure 2), it is
assumed that the frequency synthesizer is calibrated every time when going from IDLE to RX
state (MCSM0.FS_AUTOCAL = 01b).
SWRA315
Page 3 of 9
Design Note DN508
#define NUMBER_OF_SUB_BANDS
3
// Variables used to calculate RSSI
UINT8 rssi_offset[NUMBER_OF_SUB_BANDS] = {77, 77, 77};
//
//
//
//
Freq. Band
0
1
2
Range
779.009766 - 829.997314
830.196869 - 881.184418
881.384369 - 927.972992
Channel
0 - 255
0 - 255
0 - 233
All 0x0B
<- 154 = 0x0B, 155 -> = 0x09
All 0x09
UINT16 channelNumber[256];
UINT8 carrierSenseCounter = 0; // Counter used to keep track on how many time CS has been asserted in one sub band
//(i.e. how many RSSI values are stored for each band)
// Stop Channel in each of the sub bands
UINT8 lastChannel[NUMBER_OF_SUB_BANDS]
= { 255,
255,
233};
// Channel number for each of the sub bands where one should change from TEST0 = 0x0B to TEST0 = 0x09
UINT16 limitTest0Reg[NUMBER_OF_SUB_BANDS]
= { 256,
155,
0 };
// Initialized to a value lower than the RSSI threshold
= { -150, -150, -150};
// Initialized to a value greater than the highest channel number
UINT16 selectedChannel[NUMBER_OF_SUB_BANDS]
= { 300,
300, 300};
UINT8 freqSettings[NUMBER_OF_SUB_BANDS][3]
UINT8 activeBand;
//
//
UINT16 activeChannel; //
//
UINT8 calCounter = 0; //
// {FREQ2,
= {{0x1D,
{0x1F,
{0x21,
FREQ1,
0xF6,
0xEE,
0xE6,
FREQ0}
0x40},
0x3F},
0x3F}};
After the scanFreqBands() function has run, this variable will contain the sub band where
the strongest signal was found
After the scanFreqBands() function has run, this variable will contain the channel number
where the strongest signal was found
This variable is only used when running the code shown in Figure 3
Figure 1. Defines and Global Variables
SWRA315
Page 4 of 9
Design Note DN508
void scanFreqBands(void) {
UINT8 subBand;
UINT8 i;
UINT16 channel;
// 1) Loop through all sub bands
for (subBand = 0; subBand < NUMBER_OF_SUB_BANDS; subBand++) {
// 1.1) Set the base freq. for the current sub band. The values for FREQ2, FREQ1, and FREQ0 can be found in
//
freqSettings[subBand][n], where n = 0, 1, or 2
// 1.2) Set TEST0 register = 0x0B
// 1.3) Loop through all channels
for (channel = 0; channel <= lastChannel[subBand]; channel++ ) {
UINT8 pktStatus;
// 1.3.1) Set CHANNR register = channel
// 1.3.2) Change TEST0 register settings to 0x09 if freq is above 861 MHz
if (channel == limitTest0Reg[subBand]) {
// 1.3.2.1) Set TEST0 register = 0x09
}
// 1.3.3) Enter RX mode by issuing an SRX strobe command
// 1.3.4) Wait for radio to enter RX state (can be done by polling the MARCSTATE register)
// 1.3.5) Wait for RSSI to be valid (See DN505 [7] on how long to wait)
// 1.3.6) Read the PKTSTATUS register while the radio is in RX state (store it in pktStatus)
// 1.3.7) Enter IDLE state by issuing an SIDLE strobe command
// 1.3.8) Check if CS is asserted (use the value obtained in 1.3.6)
if (pktStatus & 0x40) { // CS is asserted
// 1.3.8.3) Store the RSSI value and the corresponding channel number
channelNumber[carrierSenseCounter] = channel;
carrierSenseCounter++;
}
} // End Channel Loop
// 1.4) Before moving on to the next sub band, scan through the rssiTable to find the highest RSSI value. Store
//
the RSSI value in highRSSI[subBand] and the corresponding channel number in selectedChannel[subBand]
for (i = 0; i < carrierSenseCounter; i++) {
selectedChannel[subBand] = channelNumber[i];
}
}
// 1.5) Reset carrierSenseCounter
carrierSenseCounter = 0;
} // End Band Loop
// 2) When all sub bands have been scanned, find which sub band has the highest RSSI (Scan the highRSSI[subBand]
//
table). Store the subBand (0, 1, or 2) and the corresponding channel in the global variables activeBand and
//
activeChannel respectively
{
for (subBand = 0; subBand < NUMBER_OF_SUB_BANDS; subBand++) {
activeChannel = selectedChannel[subBand];
activeBand = subBand;
}
}
}
}
Figure 2. Pseudo Code for scanFreqBand() when MCSM0.FS_AUTOCAL = 01b
Going from IDLE to RX with calibration (MCSM0.FS_AUTOCAL = 01b) takes ~800 µs while going
from IDLE to RX without calibration (MCSM0.FS_AUTOCAL = 00b) takes ~75 µs. The scanning
time can therefore be reduced significantly by reducing the numbers of frequencies to calibrate. If
calibrating for frequency x MHz, it is possible to enter RX on a frequency 1 MHz below x and
1 MHz above x without doing a new calibration (11 frequencies are covered by only one
calibration when the channel spacing is ~200 kHz). Using this approach will complicate the code
a bit, so the next code example (see Figure 3) simply shows how one can calibrate every 5th
channel instead (calibrate for channel x, x + 1 MHz, x + 2 MHz etc.).
SWRA315
Page 5 of 9
Design Note DN508
void scanFreqBands(void) {
UINT8 subBand;
UINT8 i;
UINT16 channel;
// 1) Loop through all sub bands
for (subBand = 0; subBand < NUMBER_OF_SUB_BANDS; subBand++) {
// 1.1) Set the base freq. for the current sub band. The values for FREQ2, FREQ1, and FREQ0 can be found in
//
freqSettings[subBand][n], where n = 0, 1, or 2
// 1.2) Set TEST0 register = 0x0B
// 1.3) Reset Calibration Counter (calibration performed when counter is 0)
calCounter = 0;
// 1.4) Loop through all channels
for (channel = 0; channel <= lastChannel[subBand]; channel++ ) {
UINT8 pktStatus;
// 1.4.1) Set CHANNR register = channel
// 1.4.2) Change TEST0 register settings to 0x09 if freq is above 861 MHz. When TEST0 is changed to 0x09, it
//
is important that FSCAL2 is set to 0x2A and that a new calibration is performed
if (channel == limitTest0Reg[subBand]) {
// 1.4.2.1) Set TEST0 register = 0x09
// 1.4.2.2) Set FSCAL2 register = 0x2A
// 1.4.2.3) Calibration is needed when TEST0 is changed
calCounter = 0;
}
// 1.4.3) Calibrate for every 5th ch. + at start of every sub band and every time the TEST0 reg. is changed
if (calCounter++ == 0) {
// 1.4.3.1) Perform a manual calibration by issuing an SCAL strobe command
}
// 1.4.4)) Reset Calibration Counter (if calCounter = 5, we are 1 MHz away from the frequency where a
//
calibration was performed)
if (calCounter == 5) {
// 1.4.4.1) Calibration is performed if calCounter = 0
calCounter = 0;
}
// 1.4.5) Enter RX mode by issuing an SRX strobe command
// 1.4.6) Wait for radio to enter RX state (can be done by polling the MARCSTATE register)
// 1.4.7) Wait for RSSI to be valid (See DN505 [7] on how long to wait)
// 1.4.8) Read the PKTSTATUS register while the radio is in RX state (store it in pktStatus)
// 1.4.9) Enter IDLE state by issuing an SIDLE strobe command
// 1.4.10) Check if CS is asserted (use the value obtained in 1.4.8)
if (pktStatus & 0x40) { // CS is asserted
// 1.4.10.3) Store the RSSI value and the corresponding channel number
channelNumber[carrierSenseCounter] = channel;
carrierSenseCounter++;
}
} // End Channel Loop
// 1.5) Before moving on to the next sub band, scan through the rssiTable to find the highest RSSI value. Store
//
the RSSI value in highRSSI[subBand] and the corresponding channel number in selectedChannel[subBand]
for (i = 0; i < carrierSenseCounter; i++) {
selectedChannel[subBand] = channelNumber[i];
}
}
// 1.6) Reset carrierSenseCounter
carrierSenseCounter = 0;
} // End Band Loop
// 2) When all sub bands have been scanned, find which sub band has the highest RSSI (Scan the highRSSI[subBand]
//
table). Store the subBand (0, 1, or 2) and the corresponding channel in the global variables activeBand and
//
activeChannel respectively
{
for (subBand = 0; subBand < NUMBER_OF_SUB_BANDS; subBand++) {
activeChannel = selectedChannel[subBand];
activeBand = subBand;
}
}
}
}
Figure 3. Pseudo Code for scanFreqBand() when MCSM0.FS_AUTOCAL = 00b
SWRA315
Page 6 of 9
Design Note DN508
When TEST0
=
0x0B
the VCO selection calibration stage is enabled
(TEST0.VCO_SEL_CAL_EN = 1). In this case, the value of FSCAL2.VCO_CORE_H_EN does not
matter and after a calibration FSCAL2.VCO_CORE_H_EN can be 1 or 0, depending on which VCO
was selected. When TEST0 = 0x09 the VCO selection calibration stage is disabled
(TEST0.VCO_SEL_CAL_EN = 0) and the VCO is forced high or low depending on the
FSCAL2.VCO_CORE_H_EN setting. Since FSCAL2.VCO_CORE_H_EN might have been 0 after the
last calibration when TEST0 was 0x09, it is important to change FSCAL2.VCO_CORE_H_EN to 1
when TEST0 is changed to 0x09 since SmartRF Studio [6] recommends high VCO for all
frequencies above 861 MHz.
SWRA315
Page 7 of 9
Design Note DN508
4
References
[1]
CC430 User's Guide (slau259.pdf)
[2]
CC1100 Single-Chip Low Cost Low Power RF-Transceiver, Data sheet (cc1100.pdf)
[3]
CC1100E Low-Power Sub-GHz RF Transceiver (470-510 MHz & 950-960 MHz)
(CC1100E.pdf)
[4]
CC1101 Single-Chip Low Cost Low Power RF-Transceiver, Data sheet (cc1101.pdf)
[5]
CC1110Fx/CC1111Fx Low-Power Sub-1 GHz RF System-on-Chip (SoC) with MCU, Memory,
Transceiver, and USB Controller (cc1110f32.pdf)
[6]
SmartRF® Studio (swrc046.zip)
[7]
DN505 RSSI Interpretation and Timing (swra114.pdf)
SWRA315
Page 8 of 9
Design Note DN508
5
5.1
General Information
Document History
Revision
SWRA315
Date
2010.01.22
Description/Changes
Initial release.
SWRA315
Page 9 of 9
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements,
and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should
obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are
sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard
warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where
mandated by government requirements, testing of all parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and
applications using TI components. To minimize the risks associated with customer products and applications, customers should provide
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right,
or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information
published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a
warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual
property of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied
by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive
business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional
restrictions.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all
express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not
responsible or liable for any such statements.
TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably
be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing
such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and
acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products
and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be
provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in
such safety-critical applications.
TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are
specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military
specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at
the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use.
TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are
designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated
products in automotive applications, TI will not be responsible for any failure to meet such requirements.
Following are URLs where you can obtain information on other Texas Instruments products and application solutions:
Products
Applications
Amplifiers
amplifier.ti.com
Audio
www.ti.com/audio
Data Converters
dataconverter.ti.com
Automotive
www.ti.com/automotive
DLP® Products
www.dlp.com
Communications and
Telecom
www.ti.com/communications
DSP
dsp.ti.com
Computers and
Peripherals
www.ti.com/computers
Clocks and Timers
www.ti.com/clocks
Consumer Electronics
www.ti.com/consumer-apps
Interface
interface.ti.com
Energy
www.ti.com/energy
Logic
logic.ti.com
Industrial
www.ti.com/industrial
Power Mgmt
power.ti.com
Medical
www.ti.com/medical
Microcontrollers
microcontroller.ti.com
Security
www.ti.com/security
RFID
www.ti-rfid.com
Space, Avionics &
Defense
www.ti.com/space-avionics-defense
RF/IF and ZigBee® Solutions www.ti.com/lprf
Video and Imaging
www.ti.com/video
Wireless
www.ti.com/wireless-apps
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265