Pages: [1]   Go Down
Author Topic: Arduino reset when serial buffer overflows?  (Read 1612 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Arduino Gurus,

I usually establish a wireless link between two Arduino Unos using xbees, with a labview modulated window at the receiving end. Recently I was testing them and I found that the sender Arduino was resetting after some time, and it wasn't a consistent amount of time. Sometimes it would automatically reset after 10 seconds, other times after 15-20 seconds. We later discovered that the antennas may not have been able to see each other very well and raised them to get good line of sight and everything worked fine. I'm now designing something else where I may not be able to ensure that the link is always good. This has me worried about whether the sender Arduino will keep resetting.

So, does the Arduino reset if the serial buffer overflows? If it does, how does one fix the problem?

The code's attached (all the extra zeros being written out to serial are because of deficiencies in the labview code), the header file defines.h contains all the values of the constants.

Thank you,

Siddharth

* Telemetry_sender.ino (3.91 KB - downloaded 18 times.)
Logged

New River, Arizona
Online Online
God Member
*****
Karma: 19
Posts: 932
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No, the arduino doesn't reset when the serial buffer overflows.  I took a look at your code and didn't see anything that would obviously cause it to reboot.  However, it's just slightly possible that your robbing the device of power during transmission.  I say this because I had an arduino that was rebooting (I didn't know, it was hidden away) when it was transmitting.  Seems the XBee was sucking the life out of the power supply and lowering the voltage enough to cause a reboot periodically and unpredictably.  A new power supply fixed this problem.
Logged

Trying to keep my house under control http://www.desert-home.com/

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought that was the case, but when this problem was occurring, I constantly measured the voltage across the terminals that were powering the Arduino and the voltage never really dropped, which should've happened if it was running out of juice. Also, the Xbee takes about 200mA when transmitting and this was a 7Ah lead acid battery. Then again, if this was the issue, then it should've continued to happen once the antennas were seeing each other, isn't it?
Logged

New River, Arizona
Online Online
God Member
*****
Karma: 19
Posts: 932
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Before you give up on the idea though, take a quick check of the voltage to the power pin on the processor.  It could drop while the VIN is staying stable.  I've never seen this on an arduino, but I have on other devices where the 3.3 volts is derived from 5V regulator instead of the VIN.  I suspect it is staying stable because it didn't die when you moved the antenna.

But, there a lot of arduinos out there that have nothing hooked to the serial pins when they are running, and they're putting debug info out the serial port all the time without any problem.  I have a bunch of those and they never reboot because of buffer overflows.

Logged

Trying to keep my house under control http://www.desert-home.com/

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have a bunch of those and they never reboot because of buffer overflows.

And that is true because it's not possible to truly 'overflow' the serial buffer. The serial buffer uses a circular buffer where if you don't read out the characters fast enough newer characters just write over older characters that you didn't read in time. So you can loose characters but you can't overflow and clobber something else in memory.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using one of the Sainsmart shields to interface between the Arduino and xbee, do you think that's where the issue might be? It's just I'm trying to figure out exactly what the difference is between having antenna lock and not having antenna lock as far as the power goes...

Thanks for your insight, by the way!
Logged

New River, Arizona
Online Online
God Member
*****
Karma: 19
Posts: 932
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The difference between the two is that the XBee will automatically retry the transmission.  This means a longer transmission time if it can't get the message out.  This will use a little more power, but it doesn't sound like enough to kill things.  I'm not familiar with the shield, could it have something floating around the reset pin?  Maybe pull it high as an experiment or something.

I had an arduino close to a permanent magnet motor (a big one) and the reset pin had a wire running to a switch on the side of the enclosure.  The arduino would reset sometimes because the wire picked up enough noise from the motor to actually reset the board.  Totally random event and it was easy to fix by filtering the stupid wire.  Took a while to figure out though since my presence in the noise field would cause it to stop having a problem.  Every time I sat and watched the thing to see what was going on, it quit failing.
Logged

Trying to keep my house under control http://www.desert-home.com/

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm...well there were a bunch of solenoid valves sitting around at a certain distance. Then again, if that were causing this, it should've happened regardless of whether the antennas were in view or not.
Logged

New River, Arizona
Online Online
God Member
*****
Karma: 19
Posts: 932
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good point.  You may be stuck without an answer until something kicks it into failing again and you have the time to chase the problem.
Logged

Trying to keep my house under control http://www.desert-home.com/

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Everyone,

Just thought I should give you an update on this matter. We ran some tests yesterday. We used the Sainsmart shield and disconnected the receive antenna and the Arduino started to reset in a matter of seconds. Then we used the Sparkfun xbee shield and disconnected the receive antenna and it ran smoothly without resetting. So it looks like it's either poor design or some sort of a "feature" of the Sainsmart shield.

I guess we're going with the Sparkfun shield.

Thanks for your help!

Siddharth
Logged

Pages: [1]   Go Up
Jump to: