CC2500 chip is an ultra-low power consumption, low-cost wireless transceiver module launched by TI (formerly Chipcon acquired by TI). Its carrier frequency range is adjustable from 2.400GHz to 2.483GHz, and can be used to achieve multi-channel communication. It supports multiple modulation modes, including FSK, GFSK, OOK and MSK, and the data transmission rate can reach up to 500kb/s. CC2500 also provides additional hardware support for functions such as packet processing, data buffering, pulse transmission, idle channel assessment, connection quality indication and electromagnetic wake-up. It has four main states: receive (RX), transmit (TX), idle (IDLE) and sleep (SLEEP) Basic Features (1) 2400-2483.5 MHz ISM and SRD bands (2) Maximum operating rate of 500kbps, supporting 2-FSK, GFSK and MSK modulation (3) High sensitivity (-101dBm at 10Kbps 1%) (4) Built-in hardware CRC error detection and point-to-multipoint communication address control (5) Low current consumption (13.3mA in RX) (6) Programmable output power, up to 1dBm for all supported frequencies (7) Support low-power electromagnetic wave activation function (8) Support automatic channel access clearing before transmission (CCA), i.e. carrier sense system (9) Suitable frequency hopping system brought by fast frequency change synthesizer (10) The module can be addressed by software, which is very convenient for software programming (11) Standard DIP spacing interface, convenient for embedded applications (12) Separate 64-byte RX and TX data FIFO WOR function: In order to save power, RF chips usually adopt sleep mode. The chip will inevitably lose information when it is in sleep mode. The WOR (Wakeup-on-Radio) function of CC22500 can avoid this well. The WOR function ensures that the chip wakes up periodically in deep sleep to detect whether there is a signal around. This process does not require CPU interruption. If a data packet is successfully received, the chip can notify the MCU to read it through the pin output interrupt. RSSI and LQI functions: RSSI reflects the strength of the received signal, and LQI reflects the quality of the signal connection. Both can be obtained by reading the registers of the chip. Although LQI can determine the quality of the connection, it will vary depending on the modulation method. RSSI is a good parameter for determining the distance between two nodes. After reading the value from the RSSI register, we need to perform a series of conversions to obtain the received strength value. CCA function: CCA (Clear Channel Assessment) can indicate whether the current channel is idle. Its function is similar to CSMA. When the chip is about to switch to the transmit mode, it will first check the channel. Only when the channel is idle will it enter the transmit mode, otherwise it will stay in the original mode or enter other modes by programming. Typical Applications Wireless remote control, wireless mouse, wireless keyboard; Industrial wireless control, automatic data acquisition system; Wireless sensors, wireless electronic tags, remote control toys; Wireless automatic meter reading for water, gas, heat, electricity and other residential meters; CC2420 is the first RF transceiver that complies with the 2.4GHz IEEE802.15.4 standard launched by Chipcon (acquired by TI). This device includes many functions and is the first RF device suitable for ZigBee products. It is based on SmartRF 03 technology and is made of 0.18um CMOS technology. It requires very few external components and works in the ISM band of 2400-2483.5MHZ. It consists of a fully integrated frequency modulator, a receiver with demodulator, a power amplifier, a crystal oscillator and a regulator. It can automatically generate preamble codes, and CRC can be easily programmed and configured through the SPI interface. It has low current consumption. It has stable performance and extremely low power consumption. The selectivity and sensitivity index of CC2420 can ensure the effectiveness and reliability of short-distance communication. Wireless communication equipment developed using this chip supports data transmission rates up to 250kbps and can achieve multi-point to multi-point rapid networking. Basic features: (1) Works in the ISM and SRD bands of 2400-2483.5 MHz. -Uses direct sequence spread spectrum. -Working rate 250kbps, chip rate 2 MChip/s. -Uses O-QPSK modulation. -High sensitivity (-95dBm). -Low current consumption (RX: 13.3 mA TX: 17.4 mA). -Strong ability to resist adjacent channel interference (39dB) -Internally integrated with VCO, LNA, PA and power rectifier. -Low voltage power supply (2.1~3.6V). -Output power is programmable and controllable. (2) IEEE802.15.4-2003 standard MAC layer hardware support. -Automatic generation and detection of preamble and synchronization field. -Automatic generation and detection of CRC-16. -Idle channel detection. -Energy detection, received signal strength and link quality indication. -MAC layer security protection (CTR, CBC-MAC, CCM) support. (3) 4-wire SPI standard interface is adopted to facilitate MCU configuration. (4) Independent 128-byte RX and 128-byte TX data FIFO. Typical Applications: Wireless Sensor Networks Control of Residential Buildings (Smart Home) Wireless Data Acquisition and Control of Industrial Instruments Consumer Electronics such as Wireless Mouse, Wireless Keyboard, Wireless Toys RFID Active Electronic Tags such as Wireless Access Control, Logistics Tracking, Warehouse Inspection Program Reference Design To use the CC2420 module, you do not need to master any professional wireless or high frequency theory. Readers only need to have a certain foundation in C language programming. Please refer to the CC2420 official manual or seek technical support from us. At the same time, to facilitate user development, we provide a series of supporting evaluation kits to escort product development, greatly accelerate wireless application development, and avoid unnecessary misunderstandings. The following are some relevant code segments in the sample program. CC2420 register read and write configuration CC2420 communicates with the microcontroller through the SPI interface, so you must first understand the SPI interface. The standard SPI peripheral serial interface consists of four lines: MOSI master output slave input (master write operation) MISO master input slave output (master read operation) SCK serial clock signal, controlled by the host CSN chip select signal, low level is valid SPI read operation code uint8 SPI_Read(void) { uint8 i,rxdata; rxdata = 0x00; for (i = 0;i < 8;i++) { rxdata = rxdata<<1; SCLK_ON(); if (MISO_IN) { rxdata |= 0x01; } else { rxdata &= ~0x01; } [size=4 ] SCLK_OFF(); } return rxdata; } SPI write operation code void SPI_Write(uint8 txdata) { uint8 i; for (i = 0;i < 8;i++) { if (txdata&0x80) { MOSI_ON(); } else { MOSI_OFF(); }[/ size] SCLK_ON(); txdata = txdata<<1; SCLK_OFF(); } } CC2420 configuration register read operation uint16 CC2420_ReadReg(uint8 addr)[ /size] { uint16 value; CSN_OFF(); SPI_Write(addr|REG_READ); value = SPI_Word_Read(); CSN_ON(); return value; }[/ size] CC2420 configuration register write operation void CC2420_WriteReg(uint8 addr, uint16 value) { CSN_OFF(); SPI_Write(addr|REG_WRITE); SPI_Word_Write(value); CSN_ON(); } CC2420 RAM read operation uint8 CC2420_RAM_Read(uint8 addr,uint8 block)
{
uint8 value;
CSN_OFF();
SPI_Write(addr|RAM);
SPI_Write((block<<6)|RAM_READ);
value = SPI_Read();
CSN_ON();
return value;
}
CC2420 RAM写操作
void CC2420_RAM_Write(uint8 addr,uint8 block, uint8 value)
{
CSN_OFF();
SPI_Write(addr|RAM);
SPI_Write((block<<6)|RAM_WRITE);
SPI_Write(value);
CSN_ON();
}
CC2420初始化
void CC2420_Init(void)
{
RESET_OFF();
delay_ms(10);
RESET_ON();
delay_ms(10);
CC2420_Command(CMD_SXOSCON);
delay_ms(10);
CC2420_PSDU[ 1 ] =
(PAN_ID_COMPRESSION<<6)|(ACKNOWLEDGMENT_REQUEST<<5)|
(FRAME_PENDING<<4)|(SECURITY_ENABLE<<3)|(FRAME_TYPE_DATA<<0);
CC2420_PSDU[ 2 ] =
(SOURCE_ADDRESSING_MODE<<6)|(FRAME_VERSION<<4)|
(DEST_ADDRESSING_MODE<<2);
CC2420_PSDU[ 3 ] = SEQUENCE_NUMBER;
CC2420_PSDU[ 4 ] = CC2420_Destination_PANID[0];
CC2420_PSDU[ 5 ] = CC2420_Destination_PANID[1];
CC2420_PSDU[ 6 ] = CC2420_Destination_IEEEAddr[0];
CC2420_PSDU[ 7 ] = CC2420_Destination_IEEEAddr[1];
CC2420_PSDU[ 8 ] = CC2420_Destination_IEEEAddr[2];
CC2420_PSDU[ 9 ] = CC2420_Destination_IEEEAddr[3];
CC2420_PSDU[10] = CC2420_Destination_IEEEAddr[4];
CC2420_PSDU[11] = CC2420_Destination_IEEEAddr[5];
CC2420_PSDU[12] = CC2420_Destination_IEEEAddr[6];
CC2420_PSDU[13] = CC2420_Destination_IEEEAddr[7];
CC2420_PSDU[14] = CC2420_Source_PANID[0];
CC2420_PSDU[15] = CC2420_Source_PANID[1];
CC2420_RAM_Write(RAM_PANID, 2, CC2420_Source_PANID[0]);
CC2420_RAM_Write(RAM_PANID+1, 2, CC2420_Source_PANID[1]);
CC2420_PSDU[16] = CC2420_Source_IEEEAddr[0];
CC2420_PSDU[17] = CC2420_Source_IEEEAddr[1];
CC2420_PSDU[18] = CC2420_Source_IEEEAddr[2];
CC2420_PSDU[19] = CC2420_Source_IEEEAddr[3];
CC2420_PSDU[20 ] = CC2420_Source_IEEEAddr[4];
CC2420_PSDU[21] = CC2420_Source_IEEEAddr[5];
CC2420_PSDU[22] = CC2420_Source_IEEEAddr[6];
CC2420_PSDU[23] = CC2420_Source_IEEEAddr[7];
CC2420_RAM_Write(RAM_IEEEADR, 2,CC2420_Source_IEEEAddr[0]);
CC2420_RAM_Write(RAM_IEEEADR+1, 2, CC2420_Source_IEEEAddr[1]);
CC2420_RAM_Write(RAM_IEEEADR+2, 2, CC2420_Source_IEEEAddr[2]);
CC2420_RAM_Write(RAM_IEEEADR+3, 2, CC2420_Source_IEEEAddr[3]);
CC2420_RAM_Write(RAM_IEEEADR+4, 2, CC2420_Source_IEEEAddr[4]);
CC2420_RAM_Write(RAM_IEEEADR+5, 2, CC2420_Source_IEEEAddr[5]);
CC2420_RAM_Write(RAM_IEEEADR+6, 2, CC2420_Source_IEEEAddr[6]);
CC2420_RAM_Write(RAM_IEEEADR+7, 2, CC2420_Source_IEEEAddr[7]);
CC2420_WriteReg(REG_MDMCTRL0, CCA_HYST|CCA_MODE|PREAMBLE_LENGTH|AUTOCRC|ADR_DECODE);
CC2420_WriteReg(REG_SYNCWORD,SYNCWORD);
CC2420_WriteReg(REG_SECCTRL0,0);
CSN_OFF();
SPI_Write(REG_RXFIFO|REG_READ);
SPI_Read();
CSN_ON();
CC2420_Command(CMD_SFLUSHRX);
CC2420_Command(CMD_SFLUSHTX);
delay_ms(10);
}
CC2420 FIFO发送流程FIFO写数据操作
void CC2420_WriteTXFIFO(void)
{
uint8 i;
CC2420_Command(CMD_SFLUSHTX);
CSN_OFF();
SPI_Write(REG_TXFIFO|REG_WRITE);
SPI_Write(CC2420_PSDU[0]);
for(i=0;i" cc2420_readrxfifo(void)[="" cc2420_rxpacket(void)[="" cc2420_setrxmode(void)[="" cc2420_txpacket(void)[="" csn_off();="" csn_on();="" div="" false;[="" fifo接收流程接收模式设置[="" for(i="0;i<CC2420_PSDU[0];i++)" i;[="" if((!sfd_in)&&(fifo_in))[="" return="" size]="" spi_write(cc2420_psdu[1+i]);[="" spi_write(reg_rxfifo|reg_read);="" true;[="" uint8="" while(!sfd_in);[="" while(sfd_in);[="" {[="" }="" }[="" 任何单片机都可实现对无线模块的数据收发控制,并可根据我们提供的程序,然后结合自己擅长的单片机型号进行移植;[="" 实际用户可能会应用其他自己熟悉的单片机做为主控芯片,所以,建议大家在移植时注意以下4点:[="" 无线模块的vcc电压范围为="" 标准dip插针,如需要其他封装接口,或其他形式的接口,可联系我们定做。[="" 硬件上面没有spi的单片机也可以控制本模块,用普通单片机io口模拟spi不需要单片机真正的串口介入,只需要普通的单片机io口就可以了,当然用串口也可以了。模块按照接口提示和母板的逻辑地连接起来[="" 除电源vcc和接地端,其余脚都可以直接和普通的51单片机io口直接相连,无需电平转换。当然对3v左右的单片机更加适用了。[="" 频道的间隔的说明:实际要想2个模块同时发射不相互干扰,两者频道间隔应该至少相差1mhz,这在组网时必须注意,否则同频比干扰。[="">