How To Configure and Use cc2500 Module
How To Configure and Use cc2500 Module
How To Configure and Use cc2500 Module
Overview
RFSv4.3 is a RF module providing easy and flexible wireless data transmission between devices. It is based on AVR Atmega8 with serial output which can be interfaced directly to PC.
Features
2.4 GHz Carrier Frequency RS232 UART interface with variable baud rate Input supply voltage: 5V to 12V 255 possible Channels frequencies (0 to 255) Programmable Device Address (255 per channel) Default mode is 0 and baudrate is 9600. Easy-to-Use AT command: Set working mode, Serial Baud Rate, etc. Compact Size, Out of Box: Plug and Play Supported Baud Rate 9600,19200, 38400. Two easily configurable modes: Data mode and Command node.
Page 1 dfddfdfddfdf
www.robosoftsystems.co.in
Pin Configuration
Page 2 dfddfdfddfdf
www.robosoftsystems.co.in
Step 3
Step 4
Page 3 dfddfdfddfdf
www.robosoftsystems.co.in
Note
Version
The firmware version can be check by issuing ATFV command .
AT Commands
The configuration of the RF module can be modified using AT commands. At startup the RF module is in data mode. To submit AT commands, the RF module must be switched to command mode by sending three plus signs (+++) on serial port software. When the RF module receives the (+++) on the serial port it will respond with: ok, starting command mode. The RFBee is now in command mode until switched back to data mode (using ATO0 see below) or power reset.
AT Format:
AT + Comand(ASCII) + parameters (optional, character)+<CR> Where <CR> is Carriage Return which has binary value 13 (0x0D in Hex) .
Page 4 dfddfdfddfdf
www.robosoftsystems.co.in
For ex: In flash magic go to ToolsTerminal select com portoption -set new lines to CR ( carriage return)
Command
Parameter
AC Adressing
0-2
Specification Address Check: determines whether the RF module checks the incoming packet address against its own address or not. If broadcast is enabled both its own address and the broadcast 0 address will be considered valid. 0:No address check 1:Address check, no broadcast 2:Address check and broadcast My Address: set the RF modules own Destination Address: set address of the receiver
Default
Typ e
r/w
MA DA
0-255 0-255
0 0
r/w r/w
Page 5 dfddfdfddfdf
www.robosoftsystems.co.in
OF
0-3
1: source, dest, payload 2: payload len, source, dest, payload, rssi, lqi 3: same as 2, but all except for payload as decimal and separated by comma's
r/w
Page 6 dfddfdfddfdf
www.robosoftsystems.co.in
MD
0-2
r/w
Mode
CI
r/w
Miscellaneous RS
Output format :
Using ATOF it is possible to change the output format of data packets received. ATOF set to 0: Payload
Page 7 dfddfdfddfdf
www.robosoftsystems.co.in
ATOF set to 2:
Payload length (1 byte) Source Address (1 byte) Destination address (1byte) ATOF set to 3: As ATOF2, but now all byte values (except Payload) displayed as decimal and all fields separated by commas. RSSI: Received Signal Strength Indicator. One byte signed data, unit dBm. LQI: Link quality indicator. One byte data, see CC2500 datasheet for details. Payload RSSI (1 byte) LQI (1 byte)
Broadcasting :
When every RF module has its a unique address assigned (e.g. 1,2,3 and 4 if you have 4 RF module) there are two ways to let all RF modules receive the same packets:
1. Set ATAC to 0: this will disable address checking and all RF modules will receive all packets sent.
Downside of this is that any private communication between e.g. 2 and 3 will always show up at 1 and 4.
2. Set ATAC to 2: this will enable address checking including broadcasts. This will enable private communication between RF modules (e.g. packets between 2 and 3 will not show up at 1 and 4). The RF module sending the broadcast must set the destination address to 0. Packets with destination address 0 will be received by all four RF modules.
Page 8 dfddfdfddfdf
www.robosoftsystems.co.in
Test Case 1: PC to PC Wireless communication using CC2500 based RF modules. Configure the modules using AT commands: By default address check is disabled and data transmitted by one module will be received by all other modules. Once the 2 modules have been connected to 2 different PCs and are powered on with the terminal initialized on both of them, the connection may be tested. Any data transmitted from one PC will appear on the other PC, character by character. Check fig.1 (a) and 1(b) for input and output on two different PCs.
Page 9 dfddfdfddfdf
www.robosoftsystems.co.in
Test Case 2: BOT to BOT Wireless communication using CC2500 based RF modules
The example shows the implementation of data transfer using the modules. The following code will allow LED1 of BOT1 to be synchronized with LED1 of BOT2.
The code part labeled as bot1 will be the master. For the master the bot2 code must be commented. The code part labeled as bot2 is for slave. For the slave the bot1 code must be commented. In the below code, the Bot2 section (slave bot) is shown as commented. Make sure to use proper commenting for each case, in order for the code to work correctly.
Page 10 dfddfdfddfdf
www.robosoftsystems.co.in
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1) // baud rate formula #include <util/delay.h> int main (void) { DDRB = 0xff; // PORT B as output // PORT D PIN 3-7 as output. PIN 2 is input for switch // Enable Rx & Tx of USART // // header file defining delay
DDRD = 0xfc;
UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); // 8bit, 1 Stop bit, no parity UBRRL = BAUD_PRESCALE; // setting baud rate @ 9600 baud
UBRRH = (BAUD_PRESCALE >> 8); unsigned char a=1; unsigned char b; while(1) // Character Variable for Rx packet.
// loop forever
Page 11 dfddfdfddfdf
www.robosoftsystems.co.in
while ((UCSRA & (1 << UDRE)) == 0); // Loop until UDR buffer is ready to receive // next byte to be transmitted. while ((UCSRA & (1 << RXC)) == 0); // Loop until UDR buffer is receiving RECEIVE data. b = UDR; able if (b == '1') //check for Actual data from received Packet to be = (ASCII - '1') { PORTB = 0x01; // led1 on led2 off if true if a[2] == 0x52 } else PORTB = 0x00; // Read byte by byte from the Received Data Packet into the vari-
Page 12 dfddfdfddfdf
www.robosoftsystems.co.in
Page 13 dfddfdfddfdf
www.robosoftsystems.co.in
Note 1:- Mount the RF modules, one each on the mounting space provided on the two bots. Switch on the two bots. Note 2:- To trace the communication simultaneously on Terminal, open terminal on separate Computers one for each bot. Create a connection with following settings: 1) Port Com1, 5) Parity None, 2) Baud rate 9600, 6) Stop Bit 1bit 3) Flow Control None, 4) Data 8bit,
Make use of the 3 wire serial interface provided on the board besides the MCU to watch the signals. You should get a stream of toggling 0s and 1s in terminal.
Page 14 dfddfdfddfdf
www.robosoftsystems.co.in