Go Down

Topic: Arduino board & stability (Read 1 time) previous topic - next topic

Ask

Dear forum

Very new here. I find the board very interesting - and I'm looking forward to test it.
Does anyone use the board 24/7, daily intensive use or similar?
I expect to use the board for PC, director + serial xtra for some interactive installations, and hope that it does not need reboot/restart from time to time.
Any experiences you like to share?

Regards Ask

CosineKitty

One thing to watch out for is that the time function millis() will overflow and wrap around every 9 hours or so.  This could cause programs to crash/misbehave.  For example, calling delay() right before the overflow occurs could possibly cause a permanent hang, in which case reset would be the only way out.

bigfun

I'm running the Arduino board continuously to control a hot water solar panel pump based on the data from several temperature sensors.  The board itself is very reliable, but occasionally the serial port hangs and needs to be disconnected and then reconnected - though this might not be the Arduino's fault.  I have, however, seen this behavior when using it with both Linux and Windows boxes.  But I'm connecting through a cheap Chinese 150 foot USB cable that I know to be unreliable in electrically noisy environments.

kg4wsv

Quote
The board itself is very reliable, but occasionally the serial port hangs and needs to be disconnected and then reconnected - though this might not be the Arduino's fault.  I have, however, seen this behavior when using it with both Linux and Windows boxes.  But I'm connecting through a cheap Chinese 150 foot USB cable that I know to be unreliable in electrically noisy environments.


Is this the arduino serial board?  Like many designs that try to stay simple and inexpensive, it plays the game of basically stealing voltage from one pin to get the RS232 voltage for the other.  I've had problems with other devices that do this in the past, although I haven't used the arduino serial specifically.

A true RS232 tranceiver (MAX232, MAX233, etc) may help solve these problems.

If it's really noisy you could also try to use RS422, which IIRC uses differential signalling.  Either use a serial port that's RS422 capable or convert from 422 to 232 at the computer end.

-j

kg4wsv

On the millis() wraparound issue:  is there a safe way to reset the counter?  If I use it I should theoretically know when it's safe to reset and when it isn't.

Perhaps an appropriate function be provided to reset it?

Does the arduino actually hang due to this, or only if you happen to be in the middle of a particular library call when it happens?

-j

CosineKitty

See here for how to reset the timer back to zero:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1167861718/4#4

Actually, now that I look at the code for delay(), I'm not sure a hang will occur after all:

Code: [Select]

void delay(unsigned long ms)
{
   unsigned long start = millis();
   
   while (millis() - start < ms)
       ;
}


For example, suppose the first call to millis(), where "start" is initialized, returns the maximum possible value right before the overflow (something like 0xffffffff).  Then the wraparound occurs, and millis() starts returning values just above 0 again.  Then (0 - 0xffffffff) == 1 (i.e. two's complement underflow occurs during the subtraction), but that is the correct result, because 1 millisecond has elapsed.  So it looks like this might work right even during a wraparound.

mellis

CosineKitty: that's the idea.  I think delay() should continue to function even as millis() wraps around, but I haven't tested it.

brainfart

> I'm connecting through a cheap Chinese 150 foot USB cable that I know to be
> unreliable in electrically noisy environments.

The USB specification demands cable lenghts of 3 to 5 meters max if I remember correctly. Even when chaining hubs or using line extenders the maximum specified cable lenght is well below 150 feet due to signal propagation delays. That's like running standard ethernet over a 200 meter long CAT5 cable.

Ask

Tks. for all the response.

Quote
The board itself is very reliable...

That is good information.

I'll try to stay away from millis() and bad cabling.
Are there any system call/function that returns general status of the board ?




Go Up