CC2500 is wireless transmitter receiver developed by Texas instruments which is used in 2400-2483.5 MHz ISM/SRD band systems. In this project, the input present at PORTD of transmitter atmega8 is transmitted wirelessly to the PORTD of receiver atmega8. This project shows how to configure registers of CC2500, how to give commands to CC2500 and how to activate transmission or receiver mode of CC2500 via SPI interfacing with avr microcontroller. The CC2500 RF module is a low-cost 2.4 GHz transceiver used in very low power wireless applications. The RF transceiver is integrated with a highly configurable baseband modem. It support OOK, 2-FSK, GFSK, and MSK modulations. It works in voltage range of 1.8 - 3.6V. Two AA batteries are enough to power it. It has 30m range with onboard antenna. It is always used with microcontroller which support SPI communication.
SPI interface: CC2500 is configured via a simple 4-wire SPI compatible interface (SI, SO, SCLK and CSn) where CC2500 is the slave and microcontroller (here atmega8) is used as master.
Register access and commands are given serially to CC2500 by atmega8 with spi interface. In SPI, master generate clock and chip select signal. SPI communication involves two shift registers. One in master and other in slave. Data is shifted from master to slave and slave to master in circular manner in synchronous with clock generated by master and at the end of shift operation, data in master register and slave register is exchanged.
In CC2500, all transfers on the SPI interface are done most significant bit first. All transactions on the SPI interface start with a header byte containing a R/W bit, a burst access bit (B), and a 6-bit address (A5 – A0). The CSn pin must be kept low during transfers on the SPI bus. If CSn goes high during the transfer of a header byte or during read/write from/to a register, the transfer will be cancelled.
SPI interfacing between atmega8 and CC2500
There are total 47 configuration registers in CC2500 which has to be programmed with SPI interface after each time the chip is reset. CC2500 can enter into transmitter or receiver mode or decide data transmission rate and type of modulation by programming these registers.
The optimum configuration data based on selected system parameters can bemost easily found in CC2500 datasheet (]]>http://www.ti.com/lit/ds/symlink/cc2500.pdf]]>) or by using SmartRF Studio software. The configuration registers starts from address 0x00 and end at 0x2F. To write data into configuration register Atmega8 sends two bytes to CC2500 through SPI interface.
The two bytes are as follow:
1st byte (address byte)
2nd byte (data byte)
These two bytes are sent one after the other. The last five bits (A5-A0) of byte one gives CC2500 the address of register and next byte give data to be written into the registers. As SPI interface is exchange of data between master and slave, when atmega8(master) sends these two bytes it get two bytes in exchange which gives status of the CC2500. This way CC2500 program its configuration registers. Now CC2500 is ready to transmit or receive data wirelessly.
Transmit or receive data:
Similar to the configuration register there are tx and rx FIFO registers. To transmit data wirelessly, data has to be written into tx FIFO in similar way as we write data in config register. Address byte and data byte is send to CC and CC will write data in its tx FIFO. Then ‘STX’ command is given to send the data in tx FIFO wirelessly. The address for tx FIFO is 0x3F. So A5-A0=111111. But we are using burst mode because we are sending 3 bytes of data, so 6th bit of address byte will be 1. Hence address byte will be now 01111111= 0x7F.
Similarly, whenever CC2500 receives some data, it gets stored in Rx FIFO and CC generates interrupt on GD0 pin. Atmega8 continuously check GD0 pin by polling method. Whenever interrupt is generated on GD0 pin atmega8 reads data from Rx FIFO. To read data from CC2500 register again two bytes are sent by atmega8. One is address byte and second one is data byte. But now atmega8 will send data byte as 0x00 and in exchange CC2500 will send the value in register to atmega8. For read operation, MSB of address byte will be ‘1’ and we are using burst mode to receive continuous three bytes of data and the address of TX and RX FIFO are same. Thus address byte is 0xFF.
To give commands to cc2500 like STX, SRX, SFTX, SFRX, SIDLE, only one byte is sent from atmega8 to CC2500 via SPI. STX will send data in TX FIFO. SRX will receive data in RX FIFO. SFTX will flush TX FIFO. SRTX will flush RX FIFO. SIDLE will turn CC2500 into idle mode. Atmega8 give these commands to CC2500 by sending one byte address of these commands. For reading and writing registers two bytes are send but for giving commands only one byte is send.
Pin configuration 0f CC2500: