Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Wireless Communication with 2.4 GHz RF Transceiver CC2500

By Tejas Dhagawkar July 10, 2013

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.

Programming CC2500:

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.

SPI interfacing

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
Initialize/configure 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:
 
 

 

 

 

 

Project Source Code

 

Project Source Code

###


#include<avr/io.h>
#include<util/delay.h>
#define CSn PC0
#define MOSI PB3
#define SCLK PB5
#define SS PB2 
//assign values to the registers
#define CC_IOCFG2_value 0x2F
#define CC_IOCFG1_value 0x2E
#define CC_IOCFG0D_value              0x06
#define CC_FIFOTHR_value              0x07
#define CC_SYNC1_value 0xD3
#define CC_SYNC0_value 0x91
#define CC_PKTLEN_value 0x03
#define CC_PKTCTRL1_value              0x84
#define CC_PKTCTRL0_value              0x04
#define CC_ADDR_value 0x00
#define CC_CHANNR_value 0x00
#define CC_FSCTRL1_value              0x09
#define CC_FSCTRL0_value              0x00
#define CC_FREQ2_value 0x5D
#define CC_FREQ1_value 0xD8
#define CC_FREQ0_value 0x9D
#define CC_MDMCFG4_value              0x2D
#define CC_MDMCFG3_value             0x3B
#define CC_MDMCFG2_value             0x73
#define CC_MDMCFG1_value             0x23
#define CC_MDMCFG0_value             0x3B
#define CC_DEVIATN_value              0x01
#define CC_MCSM2_value 0x07
#define CC_MCSM1_value                0x30
#define CC_MCSM0_value                 0x18
#define CC_FOCCFG_value 0x1D
#define CC_BSCFG_value 0x1C
#define CC_AGCCTRL2_value               0xC7
#define CC_AGCCTRL1_value              0x00
#define CC_AGCCTRL0_value              0xB2
#define CC_WOREVT1_value              0x87
#define CC_WOREVT0_value              0x6B
#define CC_WORCTRL_value              0xF8
#define CC_FREND1_value              0xB6
#define CC_FREND0_value 0x10
#define CC_FSCAL3_value 0xEA
#define CC_FSCAL2_value 0x0A
#define CC_FSCAL1_value 0x00
#define CC_FSCAL0_value 0x11
#define CC_RCCTRL1_value              0x41
#define CC_RCCTRL0_value              0x00
#define CC_FSTEST_value 0x59
#define CC_PTEST_value 0x7F
#define CC_AGCTEST_value              0x3F
#define CC_TEST2_value 0x88
#define CC_TEST1_value 0x31
#define CC_TEST0_value 0x0B
#define SRES                  0x30
#define SFSTXON   0x31
#define SXOFF     0x32
#define SCAL                  0x33
#define SRX                    0x34
#define STX                   0x35
#define SIDLE                0x36
#define SAFC                 0x37
#define SWOR     0x38
#define SPWD     0x39
#define SFRX                 0x3A
#define SFTX                  0x3B
#define SWORRST   0x3C
#define SNOP     0x3D
void SPI_init(); //initialize spi interface of atmega8
unsigned char SPI_TX(unsigned char); //transmit one byte from avr to CC
//creating array for assigned register values
 const unsigned char CC_rfSettings[0x2F]=
{
CC_IOCFG2_value,
CC_IOCFG1_value,
CC_IOCFG0D_value,
CC_FIFOTHR_value,
CC_SYNC1_value,
CC_SYNC0_value,
CC_PKTLEN_value,
CC_PKTCTRL1_value,
CC_PKTCTRL0_value,
CC_ADDR_value,
CC_CHANNR_value,
CC_FSCTRL1_value,
CC_FSCTRL0_value,
CC_FREQ2_value,
CC_FREQ1_value,
CC_FREQ0_value,
CC_MDMCFG4_value,
CC_MDMCFG3_value,
CC_MDMCFG2_value,
CC_MDMCFG1_value,
CC_MDMCFG0_value,
CC_DEVIATN_value,
CC_MCSM2_value,
CC_MCSM1_value, 
CC_MCSM0_value,
CC_FOCCFG_value,
CC_BSCFG_value,
CC_AGCCTRL2_value,
CC_AGCCTRL1_value,
CC_AGCCTRL0_value,
CC_WOREVT1_value,
CC_WOREVT0_value,
CC_WORCTRL_value,
CC_FREND1_value,
CC_FREND0_value,
CC_FSCAL3_value,
CC_FSCAL2_value,
CC_FSCAL1_value,
CC_FSCAL0_value,
CC_RCCTRL1_value,
CC_RCCTRL0_value,
CC_FSTEST_value,
CC_PTEST_value,
CC_AGCTEST_value,
CC_TEST2_value,
CC_TEST1_value,
CC_TEST0_value
};
unsigned char p,q,r,t;
void send()  // send data in CC wirelessly
{
command(SFTX);      //flush tx FIFO
command(SIDLE);    //turn CC2500 into idle mode
 
command(SCAL);   
PORTC=(0<<CSn);
while(bit_is_set(PINB,PB4));
SPI_TX(0x7F);    // tx FIFO address in burst mode
SPI_TX(0x55); // data byte1
SPI_TX(0xAA); // data byte2
SPI_TX(PIND);//data byte3
PORTC|=(1<<CSn);
command(STX);  //command to send data in tx FIFO wirelessly
_delay_us(10);
}
//receive data wirelessly with CC
void receive()
{
command(SRX); // command to receive data wirelessly
command(SRX);
while(bit_is_clear(PINC,PC1)); // check GD0pin of CC2500
PORTC=(0<<CSn);
while(bit_is_set(PINB,PB4));
SPI_TX(0xFF); // rx FIFO address burst mode
p=SPI_TX(0x00); // data byte1
q=SPI_TX(0x00);// data byte2
r=SPI_TX(0x00);// data byte3
PORTC|=(1<<CSn);
command(SFRX); // flush receiver FIFO
command(SIDLE); // turn CC2500 into idle mode
command(SCAL);
PORTD=r;
}
void command(unsigned char a) // give commands to CC
{
PORTC=(0<<CSn);
while(bit_is_set(PINB,PB4));
SPI_TX(a); 
PORTC|=(1<<CSn);
}
int main()
{
unsigned int j;
unsigned char i,b;
_delay_ms(5);
SPI_init();  
PORTC|=(1<<CSn);
for(i=0x00;i<0x2F;i++)   // configure registers of CC2500
{
PORTC=(0<<CSn);
while(bit_is_set(PINB,PB4));
SPI_TX(i); //address byte
SPI_TX(CC_rfSettings[i]);// data byte
PORTC|=(1<<CSn);
}
while(1)
{
//use send()in transmitter and receive() in receiver 
send();
//receive();
} 
} 
void SPI_init() //SPI initialization in atmega8
{
DDRD=0xff;
PORTD=0x00;
DDRC|=(1<<CSn)|(0<<PC1)|(1<<PC5);
DDRB=(1<<MOSI)|(1<<SCLK)|(1<<SS); // set MISO as output pin, rest as input
SPCR=(1<<SPE)|(1<<MSTR)|(1<<SPR0); // Enable SPI
}
 unsigned char SPI_TX(unsigned char a)  // atmega 8 send one byte to CC and receive one byte from CC
{
SPDR=a;
while(!(SPSR &(1<<SPIF))); //wait until SPIF get high
return SPDR;
}

###

 


Circuit Diagrams

Transmitter-Circuit
Receiver-Circuit-copy


Filed Under: Electronic Projects
Tagged With: cc2500, transceiver, wireless communication
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • General purpose CMOS Op Amp and PMOS & NMOS from LTSpice library
  • CMOS Xtal connection to ST Controller STM32L031K6U6
  • How to evaluate input impedance in HFSS
  • IC circuit identification
  • Battery charger with LED

RSS Electro-Tech-Online.com Discussions

  • Easy PC Demo version Schem and Layout program questions
  • going out on a limb and praying the schematic is correct
  • Can't get a small CRT display to focus
  • Capacitive Touch On The Profile
  • nicd charger for li-ion

Featured -USB Series

  • Controller Chip Selection for Developing USB Enabled Device (Part 6/6)
  • Signal and Encoding of USB System (Part 5/6)
  • USB Requests and Stages of Control Transfer (Part 4/6)
  • USB Descriptors and their Types (Part 3/6)
  • USB Protocol: Types of USB Packets and USB Transfers (Part 2/6)
  • Introduction to USB: Advantages, Disadvantages and Architecture (Part 1/6)

Recent Articles

  • Littelfuse driver achieves less than 1 µA standby current for energy-efficient designs
  • Microchip optimizes power consumption in transceiver-less FPGA design for automotive applications
  • What is an IoT platform and when is one useful?
  • Silanna launches laser driver IC with sub-2 ns FWHM pulse for LiDAR application
  • LEM introduces current sensors with bandwidth up to 2.5 MHz for precision applications

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe