Sie sind auf Seite 1von 14

[RF Communication Release] 2012

-By Robosoft Systems

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

[RF Communication Release] 2012


-By Robosoft Systems

Pin Configuration

Page 2 dfddfdfddfdf

www.robosoftsystems.co.in

[RF Communication Release] 2012


-By Robosoft Systems

Connecting the RF Module


Step 1 Step 2

Step 3

Step 4

Page 3 dfddfdfddfdf

www.robosoftsystems.co.in

Note

[RF Communication Release] 2012


-By Robosoft Systems

Configuring the RF Module

Version
The firmware version can be check by issuing ATFV command .

Out of the box


When powered on, RF module will send ok through serial port at 9600 baud. The default operation mode is Transceiver and the default sender and receiver address is 0. If you have two RF module , any data sent to RF_A from serial port the same data will be received by RF_B and displayed on the serial port.

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

[RF Communication Release] 2012


-By Robosoft Systems Example: +++ - Go to command mode, the RF module will return ok, starting cmd mode - Set Uart Baudrate of the RF module to 19200, returns ok on success and otherwise error. - Get UART Baudrate of the RF module, returns 1 and ok on success and otherwise error. - Switch to data mode from command mode, the RFBee will return ok and any data send afterwards will be transmitted again.

ATBD1<CR> ATBD<CR> ATO0<CR>

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

[RF Communication Release] 2012


-By Robosoft Systems Config: select wireless transmission data rate 0: 500kbaud RF CF 0-3 1: 250kbaud 2: 10kbaud 3: 2.4kbaud Baud Rate: Set Uart Baud rate of the RF. BD 0-2 0: 9600bps 1: 19200bps 2: 38400bps TH 0-32 Threshold: Set threshold in bytes that will 1 trigger RF to start transmission. r/w 0 r/w 0 r/w

Serial 0: Payload only.

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

[RF Communication Release] 2012


-By Robosoft Systems Mode: Set working mode of the RF. 0:transceive 1:transmit only 2:receive only Online: return to data mode

MD

0-2

r/w

Mode

CI

0-255 To select device channel ID.

r/w

Miscellaneous RS

Restore: restore the configuration to default settings.

Output format :
Using ATOF it is possible to change the output format of data packets received. ATOF set to 0: Payload

ATOF set to 1: Source address (1 byte) Destination address (1 byte) Payload

Page 7 dfddfdfddfdf

www.robosoftsystems.co.in

[RF Communication Release] 2012


-By Robosoft Systems

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

[RF Communication Release] 2012


-By Robosoft Systems

Receive window of RF Module No. 1

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.

Transmit window of RF Module No. 1

Fig 1(a )RF Module No. 1

Receive window of RF Module No. 2

Transmit window of RF Module No. 2

Fig 1(b ) RF Module No. 2

Page 9 dfddfdfddfdf

www.robosoftsystems.co.in

[RF Communication Release] 2012


-By Robosoft Systems

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.

Initial Settings for Test Case 2:


With default settings, address check is disabled. so, data transmitted by one RF will be received by all. For communication between 2 specific modules enable address check using AT commands : For ex: with ATAC =1 Configure the source and destination address using AT commands: ATMA = my address, ATDA = destination address, ATCI = channel ID. RF Module No. 1: RF Module No. 2: 1) ATMA 1 , 2) ATDA 2 3) Channel id 0, 3) baud rate 9600(ATBD=0) 1) ATMA 2 , 2) ATDA 1 3) Channel id 0, 3) baud rate 9600(ATBD=0)

Below is the code required to be programmed in both the bots:

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

[RF Communication Release] 2012


-By Robosoft Systems #include <avr/io.h> #define F_CPU 8000000// // header file defining I/o operation

CPU @ 8MHZ // SERIAL Communication @ 9600 baud

#define USART_BAUDRATE 9600

#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

main code begins

DDRD = 0xfc;

UCSRB |= (1 << RXEN) | (1 << TXEN);

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

[RF Communication Release] 2012


{ /* //BOT1 code //Tx Code if (a == '0') a='1'; else a='0'; UDR = a; // Add next byte to be transmitted to the UDR buffer -By Robosoft Systems

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

[RF Communication Release] 2012


_delay_ms(1000); */ /* //BOT2 code. //Rx Code 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 = 0x52 (ASCII - R) { PORTB = 0x01; // led1 on led2 off if true if a[2] == 0x52 } else PORTB = 0x00; if (a == '0') a='1'; else a='0'; UDR = a; // Add next byte to be transmitted to the UDR buffer // Read byte by byte from the Received Data Packet into the vari-By Robosoft Systems

Page 13 dfddfdfddfdf

www.robosoftsystems.co.in

[RF Communication Release] 2012


-By Robosoft Systems while((UCSRA & (1 << UDRE)) == 0); // Loop until UDR buffer is ready to receive // next byte to be transmitted. _delay_ms(1000); */ } return(0); } // While loop closed. // syntax never reached

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

Das könnte Ihnen auch gefallen