I want to send char though Atmega2560 to the xbee coordinator(AT mode), and router(which is connected to the computer) should receive that char. I can correctly receive messages
from router -> coordinator -> atmega. Which means UART receive function works correctly. But when I'm trying to send that way atmega -> coordinator -> router, in router I keep getting messages like that 01 02 03 04 ... 0D...
and so on.
UART initiazilation:
void uart_init(int baud_rate){
UBRR0H = 0x00;
UBRR0L = baud_rate; //103
/*Enabling Tx and Rx*/
UCSR0B = (1<<TXEN0);
UCSR0B = (1<<RXEN0);
/*Setting stop 8 bits and non-parity*/
UCSR0C = (1<<USBS0|3<<UCSZ00);
}
Here is my code for sending messages via UART:
void uart_send(byte data){
while (!(UCSR0A & (1<<UDRE0)))
{}
UDR0 = data;
}
I'm sending messages from the main loop. Data to be sent is '0x73'. Im using sparkfun explorer for router, both of them is xbee series 1. Formula for baud_rate is (F_CPU /(BAUD*16) – 1). I've tried to replace router with coordinator, but nothing changes.
The thing is that even when I'm unpluging this xbee from microcontroller, it keeps sending hexademicals from 0x01 to 0xff.
So I want to know, what causing these problems.
Best Answer
I had the same problem using an XBee-PRO XSC module with one of the Sparkfun boards and the answer I received from Digi technical support was:
If you look at the XBee Explorer Schematic you'll see pin 6 is connected to an RSSI LED because that pin is used as an RSSI indicator on some other modules. For the new revision of the board you'll see there's a jumper SJ1 that you can cut to disconnect that line which should solve the problem. I had an earlier board without that jumper so instead removed R7 for the same effect.