Go Down

Topic: stop getting values from arduino after some time (Read 6535 times) previous topic - next topic

ignas

Problem is not with my sketch, because led is change state and nothing backs to pc, so i will change usb cable, if it won't help, i will try that in linux

ignas

It fails even in linux with new cable, i think maybe i will print in serial without any millis() but always, maybe it somehow timing out or so, btw i am using Putty to gather all information from serial.

lucasvl

I am experiencing the same problem of failure of Serial after a varying amount of time. I use an Arduino 2009 to write Serial data and read it in using Matlab R2008b. Using USB and a simulated COM-port. I tried all kinds of things like dividing the message into shorter parts using both the standard Serial object, and the arduino object (http://www.arduino.cc/playground/Interfacing/Matlab -- which creates a serial object anyway).

In my case, however, after a certain period of no data, e.g., 5-30 minutes, it starts working again! Do you find that, too?
Did you also use USB? Or an actual COM port?

Then, I thought I should reset the Arduino through a serial command when I notice in Matlab that serial fails. But I didn't have time to make a proper setup using a 555 to do the reset (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1242847196) - and after reading this whole thread it seems resetting wouldn't have been enough to bring serial comm back to life, anyway.

"Solution":
In my case, I could live with a longer period without data and simply decided to stop checking for serial input for 10 minutes as soon as the serial fails. This avoids a slowing down of my Matlab program due to the timeout period used in trying to read serial data when it is not there. After 10 minutes I let Matlab try again, and so on until it gets something. This works for me, but will not for most applications.

Possible root cause?
I found that this is a problem that happens with other serial comm (not Arduino) as well (like http://www.mathkb.com/Uwe/Forum.aspx/matlab/110479/Failure-to-read-serial-port-after-5000-asynch-reads) which almost makes me think (sorry if this is stupid - I don't know the first thing about computers): is this something to do with the serial port (buffer?) as it is handled by Windows? Or the USB port driver or something?
Does anybody know something about this stuff?

In any case: good luck with your problem!

ignas

Thanks for your response. Actually i found out that the problem is based on electrical noises, interesting is that, why arduino and serial port is so sensitive ?

ignas

this info i guess will help me. http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Go Up