(RF Communication Release) 2010: WWW - Robosoftsystems.co - in
(RF Communication Release) 2010: WWW - Robosoftsystems.co - in
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) 2 run mode: Single Byte Transfer Mode and Packet Mode Variable Packet length (0 to 40 bytes) Standard configuration baud rate of 9600 User friendly GUI for setting up RF Module (through configuration mode) Compact Size, Out of Box: Plug and Play On Board EEPROM for saving settings
Jumper Setting
CONFIG MODE Closed : Configuration mode Open : Run mode PACKET MODE Closed : Variable Packet Length (with device address selection)* Open : Single Byte Transfer (Broadcast) (80msec delay between 2 char)
Page 1 dfddfdfddfdf
www.robosoftsystems.co.in
Jumper Setting Priority Jumper J1 Configuration Mode Jumper Higher Priority Jumper J2 Packet Mode/Single Character Mode Jumper Lower Priority
When both the jumpers are connected, by default, the J1 Jumper (Configuration Mode) Will have higher priority. The Module will still be running in packet mode, but as J1 jumper is connected, configuration mode will be active & the module is ready to receive configuration settings.
Page 2 dfddfdfddfdf
www.robosoftsystems.co.in
Test settings are as below: RF Module No. 1: 1) Device id 1 , 2) Channel id 0 , 3) baud rate 9600
Page 3 dfddfdfddfdf
www.robosoftsystems.co.in
Initial Checking for successful switch into configuration mode & confirming the settings for DiD, CiD & baud rate:
After having placed the Jumper J1, one can check whether the module has entered Configuration Mode by Issuing Shift + $ on any Terminal Software . Following are the screenshots for the same check for both the above configured modules.
Page 4 dfddfdfddfdf
www.robosoftsystems.co.in
DiD CiD
Baud Rate
DiD CiD
Baud Rate
RF Module No. 1
RF Module No. 2
Following response is observed every time when the Module is in Configuration mode and is reset i.e. Power is replugged. Screenshot for the same is as below.
Remove the Jumper J1 and reset the module, The module has entered Run Mode correctly or not can be verified by following response on Hyper terminal. This response is observed every time when the Module is Run mode and is reset i.e. Power is replugged. Screenshot for the same is as below.
*Note:- While serial connection properly setup, and power to the module is resetted,
1st Character indicates whether the module is in Configuration mode or Run mode. 2nd Character indicates whether the module is in Single byte or Packet data transfer mode.
Page 5 dfddfdfddfdf
www.robosoftsystems.co.in
Test Case 1: PC to PC Wireless communication in Single Character Mode using CC2500 based RF modules. Initial Settings for Test Case 1: Enter configuration mode using jumper J1 only. Configuration mode : Follow the steps over page 3, 4 & 5 to configure the module.
RF Module No. 1: RF Module No. 2: 1) Device id 1 , 2) Channel id 0 , 3) baud rate 9600 1) Device id 2 , 2) Channel id 0 , 3) baud rate 9600
Testing Communication between 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 figure below for input and output on two different PCs.
Page 6 dfddfdfddfdf
www.robosoftsystems.co.in
Page 7 dfddfdfddfdf
www.robosoftsystems.co.in
Test Case 2: BOT to BOT Wireless communication in Single Character Mode 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.
Initial Settings for Test Case 2: Enter configuration mode using jumper J1 only. Configuration mode : Follow the steps over page 3, 4 & 5 to configure the module.
RF Module No. 1: RF Module No. 2: 1) Device id 1 , 2) Channel id 0 , 3) baud rate 9600 1) Device id 2 , 2) Channel id 0 , 3) baud rate 9600
Single Character Mode Activation: The jumper J2 needs to be removed while using the modules
in packet Mode. Jumper J1 and J2 are not needed while using Single Character mode.
Page 8 dfddfdfddfdf
www.robosoftsystems.co.in
// //
header file defining I/o operation CPU @ 8MHZ // SERIAL Communication @ 9600 baud // baud rate formula
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1) #include <util/delay.h> int main (void) { DDRB = 0xff; // DDRD = 0xfc; //
PORT B as output PORT D PIN 3-7 as output. PIN 2 is input for switch // // // main code begins header file defining delay
UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); UBRRL = BAUD_PRESCALE; // UBRRH = (BAUD_PRESCALE >> 8); unsigned char a=1; unsigned char b; while(1)
// Character Variable for Rx packet.
// loop forever
Page 9 dfddfdfddfdf
www.robosoftsystems.co.in
{
/* //BOT1 code //Tx Code
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;
// Read byte by byte from the Received Data Packet into the variable
if (b == '1') //check for Actual data from received Packet to be = (ASCII - '1') { PORTB = 0x01; } else PORTB = 0x00;
// led1 on led2 off if true if a[2] == 0x52
Page 10 dfddfdfddfdf
www.robosoftsystems.co.in
_delay_ms(1000); */ /*
//BOT2 code. //Rx Code
while ((UCSRA & (1 << RXC)) == 0); // Loop until UDR buffer is receiving RECEIVE data. b = UDR;
// Read byte by byte from the Received Data Packet into the variable
if (b == '1') //check for Actual data from received Packet to be = 0x52 (ASCII - R) { PORTB = 0x01; } else PORTB = 0x00; if (a == '0') a='1'; else a='0'; UDR = a;
// Add next byte to be transmitted to the UDR buffer // led1 on led2 off if true if a[2] == 0x52
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.
_delay_ms(1000);
*/
} return(0); }
Mount the RF modules, one each on the mounting space provided on the two bots. Switch on the two bots. 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,
Note 1:-
Note 2:-
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 12 dfddfdfddfdf
www.robosoftsystems.co.in
Packet Mode Activation: The jumper J2 needs to be placed while using the modules in packet
Mode. Jumper J1 is not needed while using in packet mode. Make sure that you note down the device id. After the packet mode is activated, open Hyper terminal. 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,
Test Case 3: PC to PC Wireless communication in Packet Mode using CC2500 based RF modules Packet Structure for Transmit Data in Packet Mode
Start Character Packet Length Device ID Actual Data
The format of the transmitted packet is as shown above. Its typical value are given in the below column. FRAME DEFINATION Start Character Packet Length Device ID Actual Data VALUES # 0x02 0x40 0x00 0xff Actual Data Size = packet length - 1 TYPE char char char Array of char
*Note:- In case of packet mode transmission, the packet send by a device will be
received by all the devices on the same channel id, but only the one with the same Device id (matching to packet) will accept the packet. The other devices will discard the received packet.
Page 13 dfddfdfddfdf
www.robosoftsystems.co.in
Note:-
The device id is at the receiver end is matched, and if found matching to its own, the packet is accepted. As a result, the user will find the following packet at the 3-wire serial interface end.
Packet Structure for Receive Data in Packet Mode Start Character Packet Length Actual Data
The format of the received packet is as shown above. Its typical value are given in the below column. FRAME DEFINATION Start Character Packet Length Actual Data VALUES # 0x02 0x40 Actual Data Size = packet length - 1 TYPE char char Array of char
Tx packet:
Page 14 dfddfdfddfdf
www.robosoftsystems.co.in
asdfghjk
# Tab 0 asdfghjk
Rx packet:
Page 15 dfddfdfddfdf
www.robosoftsystems.co.in
Tab
asdfghjk
# Tab asdfghjk
Test Case 2: BOT to BOT Wireless communication in Packet Mode using CC2500 based Robosoft RF modules. Initial Settings for Test Case 2: Enter configuration mode using jumper J1 only. Configuration mode :
RF Module No. 1: RF Module No. 2: 1) Device id 1 , 2) Channel id 0 , 3) baudrate 9600 1) Device id 2 , 2) Channel id 0 , 3) baudrate 9600
Packet Mode Activation: The jumper J2 needs to be placed while using the modules in packet Mode.
Jumper J1 is not needed while using in packet mode. Make sure that you note down the device id.
Page 16 dfddfdfddfdf
www.robosoftsystems.co.in
// //
header file defining I/o operation CPU @ 8MHZ // SERIAL Communication @ 9600 baud // baudrate formula
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1) #include <util/delay.h>> int main(void) > { DDRB = 0xff; DDRD = 0xfc; // // PORT D as output PORT D PIN 2-7 as output. // // // header file defining delay
UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); UBRRL = BAUD_PRESCALE; // UBRRH = (BAUD_PRESCALE >> 8);
Page 17 dfddfdfddfdf
www.robosoftsystems.co.in
while(1) {
// loop forever
unsigned char a[] = {0x23, 0x02, 0x30, 0x52, 0x00}; // Tx packet in the forrmat of //char array a[] = {0x23, 0x02, 0x30, 0x52, 0x00}, where 0x00 is not the part of actual //tx packet but is rather used to indicate within this code the end of packet. while (a[s] != '\0') { while ((UCSRA & (1 << UDRE)) == 0); ceive // next byte to be transmitted. UDR = a[s]; s++; // // // Loop until UDR buffer is ready to re// Loop to send tx packet through USART while scanning for \0
//
delay of 2 sec
reset counter
a[3] = 0x53; //modify char array to a[] = {0x23, 0x02, 0x30, 0x53, 0x00},
Page 18 dfddfdfddfdf
www.robosoftsystems.co.in
while ((UCSRA & (1 << UDRE)) == 0); ceive // next byte to be transmitted. UDR = a[s]; s++; // //
//
delay of 2 sec
unsigned char a[3]; // Char Array for Rx packet. unsigned char s; // for use as a counter
while ((UCSRA & (1 << RXC)) == 0); // Loop until UDR buffer is receiving RECEIVE data. for (s=0;s<3;s++) { while ((UCSRA & (1 << RXC)) == 0); // Loop until UDR buffer is receiving RECEIVE data. // loop for storing the received Rx packet as char array
Page 19 dfddfdfddfdf
www.robosoftsystems.co.in
a[s] = UDR; }
//
Read byte by byte from the Received Data Packet into the array
if(a[2] == 0x52) //check for Actual data from received Packet to be = 0x52 (ASCII R) { PORTB = 0x01; } else { PORTB = 0x02; } */ } return(0); } // While loop closed. // syntax never reached // led1 on led2 off if true if a[2] == 0x52 // led1 on led2 off if true if a[2] == 0x52
Page 20 dfddfdfddfdf
www.robosoftsystems.co.in
Note 1:-
Note 2:-
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.
Tx packet :
Page 21 dfddfdfddfdf
www.robosoftsystems.co.in
Page 22 dfddfdfddfdf
www.robosoftsystems.co.in
Rx packet:
Page 23 dfddfdfddfdf
www.robosoftsystems.co.in
Page 24 dfddfdfddfdf
www.robosoftsystems.co.in