The CC1020 RF transceiver is very easy to interface with a microcontroller. The chip is configured using a four-wire bus, comprising of PCLK, PDI, PDO and PSEL signals. Data interfacing is done via the DCLK and DIO pins. Data decision and synchronization is done by the CC1020, easing the workload of the microcontroller considerably. Using the synchronous Manchester or NRZ modes, the CC1020 supplies a synchronous clock, which can be used for triggering interrupts in the microcontroller, or for interfacing with a synchronous serial interface. This application note covers interfacing the CC1020 to microcontrollers. Information is given about both the configuration and data interfaces of the CC1020.
Microcontrollers in General
A vast variety of microcontrollers (MCUs) exist today, from small 4-bit controllers up to powerful 32-bit controllers with processing power rivalling modern PCs. Digital signal processors (DSPs) are also used as controllers in some applications.
The CC1020 can be easily interfaced with any microcontroller on the market. The only requirement is to have enough I/O pins. To configure the CC1020, four I/O pins are required (one input and three output pins). The pins connected to PDI, PDO and PCLK can be shared with other circuitry, provided these circuits are not active when the configuration interface is active. The PSEL signal must be driven by pin dedicated only to interfacing the CC1020. For the data interface, two I/O pins are required, one bi-directional for DIO and one input for DCLK. The pin used to interface with DCLK should be able to generate an interrupt on signal Edges.
Fig. 1: Overview of CC1020 RF Transceiver interfacing with any Microcontroller
In power-down mode, the CC1020 pins assume the following states:
Fig. 2: Table showing Pin modes of CC1020 RF Transceiver
Configuration Interface
The CC1020 is configured using the PCLK, PDI, PDO and PSEL signals. This is discussed in detail in the CC1020 data sheet. The configuration registers are also readable, so that the user can verify settings and read out status bits.
Using general-purpose I/O pins to handle an interface in this way is often called “bit banging”. This approach is very flexible, as the user is free to use any I/O pins on the microcontroller, but can be slow when working with a slow microcontroller.
The alternative is to use a synchronous serial interface to interface with the CC1020. An SPI master interface or some types of USART (Universal Synchronous/Asynchronous Receiver/Transmitter) are suitable. A free general I/O pin must be used to interface with the PSEL pin of the CC1020. Please note that some microcontroller manufacturers use different terminologies when naming the signals. MOSI stands for master out, slave in, while MISO stands for master in, slave out. The other standard SPI signals are SCK (Serial Clock) and SS (Slave select.
Fig. 3: Overview of CC1020 RF Transceiver interfacing through SPI interface
A USART or other synchronous serial interface can be suitable for use as well, study the datasheet for the microcontroller to see if it can be configured to be compatible with the CC1020.
The biggest advantage of using a hardware interface is that it can be much faster; in many cases the configuration can be performed with a clock rate of several MHz. This is especially important in frequency hopping applications, where configuration must occur in the blanking interval, which should be as short as possible.
Configuration Procedure
Chipcon recommends resetting the CC1020 (by clearing the RESET_N bit in the MAIN register) when the chip is first powered up. All registers that need to be configured should then be programmed (those which differ from their default values). Registers can be programmed freely in any order. The CC1020 should then be calibrated in both RX and TX mode. After this is complete, the CC1020 is ready for use. See the datasheet for detailed procedure flowcharts.
SmartRF® Studio and the example code written by Chipcon assumes that frequency register A is used for the RX frequency, and frequency register B is used for the TX frequency. This makes it easy to switch between RX and TX mode by programming the MAIN, ANALOG (and INTERFACE if squelch enabled) registers.
Data Interface and Microchip PIC16 Example
Data Interface
When using the Synchronous Manchester or the Synchronous NRZ mode, the DCLK pin on the CC1020 should be connected to an MCU input pin that can generate an interrupt in the MCU. DIO should be connected to a bi-directional MCU I/O pin.
In TX mode, the interrupt should be triggered on the falling edge of DCLK. When the interrupt occurs, write the next bit to be transmitted to the I/O pin. In RX mode, the interrupt should be triggered on the rising edge of DCLK. When the interrupt occurs, read the data from the I/O pin.
Note that data transferred to/from the MCU is always NRZ coded, regardless of whether Synchronous NRZ or Synchronous Manchester mode is selected. The mode setting only affects the signal modulated onto the RF carrier. The Manchester encoding/decoding is performed by the CC1020.
A clock signal is output on DCLK as long as DCLK squelch is disabled on the CC1020. If transmissions are intermittent, the DCLK squelch function should be used to determine whether valid data is received. The squelch must be disabled in TX-mode in order NOT to mute the DCLK.
A preamble of alternate ones and zeros must be used regardless of which mode the CC1020 is in. See the datasheet for details regarding minimum length of the preamble.
Microchip PIC16 Example
This example is written for the PIC16F876 microcontroller, using the RF Modem hardware. See [1] for more information about the hardware.
cc1020pic.c provides a library of routines for configuring the CC1020. cc1020.h contains definitions for all of the CC1020’s registers. There are two versions of the low-level configuration routines, one using general-purpose I/O and one using the SPI interface built into the PIC. If the symbol ‘SPI’ is defined, the SPI versions are used, if not, the general purpose I/O routines are used.
A short description of the routines in the library follows:
Fig. 4: Table showing Pin Configuration of CC1020 RF Transceiver
When the system is initially turned on, the CC1020 should first be reset. The registers can then be programmed to the settings used in the system. The CC1020 should be calibrated in both RX and TX modes before system operation takes place. For details, see the CC1020 data sheet. All source code can be downloaded from the Chipcon website.
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.