+ All Categories
Home > Documents > How to configure and use cc2500 module

How to configure and use cc2500 module

Date post: 28-Apr-2015
Category:
Upload: varun-nair
View: 673 times
Download: 26 times
Share this document with a friend
Description:
This CC2500 based wireless RF module is a plug and play replacement for the RS232 UART output.USB version of the module provides easy interface with PC. Please buy the USB cable seperately if you do not have it, check the related products list
14
-By Robosoft Systems [RF Communication Release] 2012 Page 1 www.robosoftsystems.co.in 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. Features 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 di- rectly to PC.
Transcript
Page 1: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 1 www.robosoftsystems.co.in

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.

Features

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 di-

rectly to PC.

Page 2: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 2 www.robosoftsystems.co.in

Pin Configuration

Page 3: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 3 www.robosoftsystems.co.in

Connecting the RF Module

Step 1

Step 4

Step 2

Step 3

Page 4: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 4 www.robosoftsystems.co.in

Note

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) .

Configuring the RF Module

Page 5: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 5 www.robosoftsystems.co.in

Example:

+++ - Go to command mode, the RF module will return “ok, starting cmd mode”

ATBD1<CR> - Set Uart Baudrate of the RF module to 19200, returns “ok” on success and otherwise “error”.

ATBD<CR> - Get UART Baudrate of the RF module, returns “1” and “ok” on success and otherwise “error”.

ATO0<CR> - Switch to data mode from command mode, the RFBee will return “ok” and any data send afterwards will be transmitted again.

For ex: In flash magic go to Tools—Terminal — select com port—option —-set new lines to CR ( car-riage return)

Command Parameter Specification De-fault

Type

Adressing

AC 0-2

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 ad-dress and the broadcast 0 address will be considered valid.

0 r/w

0:No address check

1:Address check, no broadcast 2:Address check and broadcast

MA 0-255 My Address: set the RF module’s own

0 r/w

DA 0-255 Destination Address: set address of the receiver

0 r/w

Page 6: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 6 www.robosoftsystems.co.in

RF CF 0-3

Config: select wireless transmission data rate

0 r/w

0: 500kbaud

1: 250kbaud

2: 10kbaud

3: 2.4kbaud

Serial

BD 0-2

Baud Rate: Set Uart Baud rate of the RF.

0 r/w 0: 9600bps

1: 19200bps

2: 38400bps

TH 0-32 Threshold: Set threshold in bytes that will trigger RF to start transmission.

1 r/w

OF 0-3

0: Payload only.

0 r/w 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

Page 7: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 7 www.robosoftsystems.co.in

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

ATOF set to 0:

ATOF set to 1:

Payload

Mode

MD 0-2

Mode: Set working mode of the RF.

0 r/w

0:transceive

1:transmit only

2:receive only

O 0 Online: return to data mode w

CI 0-255

To select device channel ID.

0 r/w

Miscellaneous RS - Restore: restore the configuration to

default settings. - w

Source address (1 byte) Destination address (1 byte) Payload

Page 8: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 8 www.robosoftsystems.co.in

ATOF set to 2:

ATOF set to 3:

As ATOF2, but now all byte values (except Payload) displayed as decimal and all fields separated by comma’s.

RSSI: Received Signal Strength Indicator. One byte signed data, unit dBm.

LQI: Link quality indicator. One byte data, see CC2500 datasheet for details.

Broadcasting : When every RF module has it’s 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 com-munication 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.

Payload length (1 byte)

Source

Address (1 byte)

Destination address

(1byte)

Payload RSSI

(1 byte)

LQI

(1 byte)

Page 9: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 9 www.robosoftsystems.co.in

Test Case 1: PC to PC

Wireless communica-

tion using CC2500

based RF modules.

Configure the mod-

ules using AT com-

mands: By default ad-

dress 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

PC’s and are powered on

with the terminal initial-

ized on both of them,

the connection may be

tested. Any data trans-

mitted 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.

Receive window of RF Module No. 1

Transmit window of RF Module No. 1

Fig 1(a )RF Module No. 1

Fig 1(b ) RF Module No. 2

Receive window of RF Module No. 2

Transmit window of RF Module No. 2

Page 10: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 10 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.

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: 1) ATMA – 1 , 2) ATDA – 2 3) Channel id – 0, 3) baud rate – 9600(ATBD=0)

RF Module No. 2: 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 11: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 11 www.robosoftsystems.co.in

#include <avr/io.h> // header file defining I/o operation

#define F_CPU 8000000 // CPU @ 8MHZ

#define USART_BAUDRATE 9600 // SERIAL Communication @ 9600 baud

#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1) // baud rate formula

#include <util/delay.h> // header file defining delay

int main (void) // main code begins

{

DDRB = 0xff; // PORT B as output

DDRD = 0xfc; // PORT D PIN 3-7 as output. PIN 2 is input for switch

UCSRB |= (1 << RXEN) | (1 << TXEN); // Enable Rx & Tx of USART

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; // Character Variable for Rx packet.

while(1) // loop forever

Page 12: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 12 www.robosoftsystems.co.in

{

/* //BOT1 code

//Tx Code

if (a == '0')

a='1';

else

a='0';

UDR = a; // Add next byte to be transmitted to the UDR buffer

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 vari-

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;

Page 13: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 13 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 vari-

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

Page 14: How to configure and use cc2500 module

-By Robosoft Systems

[RF Communication Release] 2012

dfddfdfddfdf Page 14 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);

*/

} // While loop closed.

return(0); // 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 Com-

puters one for each bot. Create a connection with following settings:

1) Port – Com1, 2) Baud rate – 9600, 3) Flow Control – None, 4) Data – 8bit,

5) Parity – None, 6) Stop Bit – 1bit

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 0’s and 1’s in terminal.


Recommended