Pages: 1 [2] 3   Go Down
Author Topic: Baud Rate/ Serial Timing Problem?  (Read 3491 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Thanks, the pic helps! Where do the shields come from?

They are the original Arduino XBee Shields, I think I got them from Amazon (New, I don't buy used parts).

http://www.arduino.cc/en/Main/ArduinoXbeeShield
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep just found that, thanks. You could use the explorer for one XBee and do this for the other:

Quote
With the jumpers in the USB position (i.e. on the two pins nearest the edge of the board), the DOUT pin the Xbee module is connected to the RX pin of the FTDI chip, and DIN on the Xbee module is connected to the TX pin of the FTDI chip. This means that the Xbee module can communicate directly with the computer - however, this only works if the microcontroller has been removed from the Arduino board. If the microcontroller is left in the Arduino board, it will be able to talk to the computer normally via USB, but neither the computer nor the microcontroller will be able to talk to the Xbee module.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep just found that, thanks. You could use the explorer for one XBee and do this for the other:

Quote
With the jumpers in the USB position (i.e. on the two pins nearest the edge of the board), the DOUT pin the Xbee module is connected to the RX pin of the FTDI chip, and DIN on the Xbee module is connected to the TX pin of the FTDI chip. This means that the Xbee module can communicate directly with the computer - however, this only works if the microcontroller has been removed from the Arduino board. If the microcontroller is left in the Arduino board, it will be able to talk to the computer normally via USB, but neither the computer nor the microcontroller will be able to talk to the Xbee module.

Is there any way to pull out the microcontroller with lowest riskof breaking it :o just tried pulling it a little, it's really in there...
« Last Edit: January 19, 2012, 08:21:31 pm by falven » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there any way to pull out the microcontroller with lowest riskof breaking it :o just tried pulling it a little, it's really in there...

They can be tough to get started. I use a very small flat-blade screwdriver, work from one end then the other, little by little. I think there's really little chance of breaking it.

The other thing to try is to take the shields off, wire the TX from one Arduino to RX on the other and vice versa, see if the little test sketch works that way. Just trying to eliminate some variables. But if that works OK, then I'd still want to test the XBees standalone.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there any way to pull out the microcontroller with lowest riskof breaking it :o just tried pulling it a little, it's really in there...

They can be tough to get started. I use a very small flat-blade screwdriver, work from one end then the other, little by little. I think there's really little chance of breaking it.

The other thing to try is to take the shields off, wire the TX from one Arduino to RX on the other and vice versa, see if the little test sketch works that way. Just trying to eliminate some variables. But if that works OK, then I'd still want to test the XBees standalone.

Ok, I got it off smiley any specific operations you think I should perform?

« Last Edit: January 19, 2012, 08:25:35 pm by falven » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I got it off smiley any specific operations you think I should perform?

Good deal. You have a terminal program? CoolTerm or TeraTerm or whatever? Start two copies. Put one XBee on the Explorer, the other on the Arduino without the MCU. Connect one of the terminals to each. See if both will respond to commands OK. When they're not in command mode, whatever goes in one should come out the other.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I got it off smiley any specific operations you think I should perform?

Good deal. You have a terminal program? CoolTerm or TeraTerm or whatever? Start two copies. Put one XBee on the Explorer, the other on the Arduino without the MCU. Connect one of the terminals to each. See if both will respond to commands OK. When they're not in command mode, whatever goes in one should come out the other.

Seems normal...

Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool, so the two talk back and forth ok, so the XBees are fine. Now I'd put the chip back in, remove the shields, and see if the Arduinos will talk back and forth with the TX and RX lines cross-coupled.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Earlier I see the XBees have 10ED firmware version. The latest on the Digi site seems to be 1xEC. Is that the firmware they came with?
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Earlier I see the XBees have 10ED firmware version. The latest on the Digi site seems to be 1xEC. Is that the firmware they came with?

No I believe they came with something else, I updated them to 10ED a couple of days ago.

Quote
Cool, so the two talk back and forth ok, so the XBees are fine. Now I'd put the chip back in, remove the shields, and see if the Arduinos will talk back and forth with the TX and RX lines cross-coupled.

Here you have it, they are sending and recieveing correctly at 115200bps
I'm at a loss.

« Last Edit: January 19, 2012, 10:09:02 pm by falven » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK just curious on the firmware, I'm sure it's fine.

I think there's only one thing we didn't exercise, unless you happened to do it. With the MCU pulled from the Duemilanove, when you did the XBee-to-XBee test, it would be good to test both shields on the Duemilanove in that scenario.

Other than that, I'm out of ideas at the moment. I'd offer to try and duplicate your setup, but there would be several differences. I have Unos, BoArduinos, Pro Minis, and ATmega328s on breadboards. I have Adafruit XBee adapters instead of shields. And not least, I have S2 low power XBee modules. Not sure if we'd learn anything from that. Still, let me know if you think it useful, because it wouldn't take all that long to do. I have a friend that has some Pro XBees, but they're also S2.

Anyhoo it's been a long day and I need to call it quits. Maybe sleeping on it will help. Where abouts are you, by the way? Michigan here. Very cold night coming up!
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK just curious on the firmware, I'm sure it's fine.

I think there's only one thing we didn't exercise, unless you happened to do it. With the MCU pulled from the Duemilanove, when you did the XBee-to-XBee test, it would be good to test both shields on the Duemilanove in that scenario.

Other than that, I'm out of ideas at the moment. I'd offer to try and duplicate your setup, but there would be several differences. I have Unos, BoArduinos, Pro Minis, and ATmega328s on breadboards. I have Adafruit XBee adapters instead of shields. And not least, I have S2 low power XBee modules. Not sure if we'd learn anything from that. Still, let me know if you think it useful, because it wouldn't take all that long to do. I have a friend that has some Pro XBees, but they're also S2.

Anyhoo it's been a long day and I need to call it quits. Maybe sleeping on it will help. Where abouts are you, by the way? Michigan here. Very cold night coming up!

Thanks for all the help so far! It's been a great learning experience. I will continue to try and pursue the culprit and posting in this board. Hopefully somebody might read up and know what the problem is.

I'm in Seattle where we are currently having a blizzard/ice-over; biggest one since 1985. Stay warm friend!

I just tried both shields and they both work fine. Could it be possible that both the XBees say they are functioning at 115200bps but in reality are functioning at another baud rate, or vice-versa? I tried chaning the baud rates of the serial monitor but none of the pre-set rates match.
Is there a way to measure their baud rate? Maybe write a program that tries all different baud rates up to, say, 130,000 while I check the output and see if any of the other rates stabilize the output?

Thanks again,
-Francisco

Edit: Interesting read, seems related.
http://forums.digi.com/support/forum/viewthread_thread,7255
« Last Edit: January 20, 2012, 03:43:35 am by falven » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I followed the recommendation of this thread:
http://forums.digi.com/support/forum/viewthread_thread,7255
and set ATBD1B207 (111,111 baud) along with my sketches, and to my surprise (with 115200 baud in the serial monitor) I am recieving the data I sent.
This solves the two problems I was having. I can now recieve Data at the higher Baud Rates. I still, however, am getting the garbage byte data, but only on the initial write.
Thanks,
-Francisco
« Last Edit: January 20, 2012, 07:10:30 am by falven » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That's an interesting thread, I was aware of the accuracy issue. There are baud rate error tables in the ATmega328 datasheet. So things are pointing toward baud rate errors between the XBees and the Arduinos, since when the XBees are connected directly to the PC, things are OK. I assume the Mega has a 16MHz clock, what about the Duemilanove?

Something is still odd though. I've never had an issue, and I've used 115200 a lot, and with resonator-clocked MCUs that aren't as accurate as crystals. That thread said the XBees have 16MHz clocks. So if they're connected to an MCU with a 16MHz clock, the errors would presumably be similar, and everyone is happy (or maybe not, there are some assumptions made in that statement!)

Since the garbage data byte is still happening, we obviously aren't understanding everything yet. To measure the baud rate would require a scope, do you happen to have one?
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pardon me if I am stating the bleeding obvious here, but your "garbage" byte appears to be 0xFF (the y with two dots on it).

This could easily be caused by a single "low" glitch in the line, since 0xFF is otherwise 1 bits. And the single 0 injected (for whatever reason) would appear to be a start bit.

Also, with reference to the baud rate discrepancies, I discovered recently that the onboard USART (if you are using it, I'm not sure about that) has some sort of error-correcting built into it. I'm not sure if that is designed to resync to an "off" baud rate, but conceivably it could.
Logged

Pages: 1 [2] 3   Go Up
Jump to: