Hello, not sure if this is the right place to ask...
Is there any limit how how much the Serial Monitor can handle?
I have a Mega 2560 board that print one line with data every 5th second. And it can keep on doing so for days. But I noticed that several time I do not get any data in the monitor and some time later I loose the USB interface on the PC. I have to restart the PC to get it back.
The sketch/controller is doing fine all the time.
When I removed the code that print out data to the serial interface every 5th second, the problem is gone.
thehardwareman:
I have a Mega 2560 board that print one line with data every 5th second. And it can keep on doing so for days. But I noticed that several time I do not get any data in the monitor and some time later I loose the USB interface on the PC. I have to restart the PC to get it back.
What do you mean by "I loose the USB interface"? In the IDE (which version)? In the operating system (which one)? After how many characters / lines / messages / minutes do you get the problem?
thehardwareman:
No, I have not. Not sure what you mean by "another Serial terminal". Do you mean using a different program on the PC, like Putty?
I think that that was meant. I'm using Windows and RealTerm for those situations.
sterretje:
What do you mean by "I loose the USB interface"? In the IDE (which version)? In the operating system (which one)? After how many characters / lines / messages / minutes do you get the problem?
I think that that was meant. I'm using Windows and RealTerm for those situations.
IDE version 1.8.12. Windows 7 Ultimate.
I first start loosing text from the Arduino (only the timestamp is shown as if I did a "Serial.println("")'.
Then I loose the USB interface and sometime the network connection (Internet).
When I disabled the logging lines that are printed every 5th second it works OK. The arduino (Mega 2560) can stay on for days printing logs every 5th second.
So for me it seems like there is a memory problem in the serial monitor that cause this problems. I'll try Realterm and see what happens.
You arduino should not be impacted by what happens on the PC side.
Can you see if the MEGA keeps on running even if the Serial terminal is dead ?
if the MEGA dies, it likely points at an issue in your code.
J-M-L:
You arduino should not be impacted by what happens on the PC side.
Can you see if the MEGA keeps on running even if the Serial terminal is dead ?
if the MEGA dies, it likely points at an issue in your code.
The mega just keep on going and going It also use a WiFi module and it send data every minute - no problem.
The problem only occur when there is a lot of data (over time) to the serial monitor. Currently the Mega has been on for 4 days with minimum use of Serial.print and Serial.println. And the USB port is OK.
The Mega has it's own power supply - 5V 3A. It work well if I disconnect the USB plug. There is a few LEDs, a 2004 display, a RTC and a WiFi module. An amp-meter show about 300 mA steady load.
I know that restarting the serial monitor cause the Mega to restart.
"Is there any limit how how much the Serial Monitor can handle?"
There may be issues in the IDE where unbounded saving the input to the serial monitor can cause an IDE stall or lockup. In the past there were issues with orphan files being created by the IDE that resulted in creation of huge temporary files, but this may not be an issue now. Does the issue disappear when the serial monitor is not left open for extended amounts of time?
Today it has stopped even with small amount of ouput. Restarting the Mega did not help. I had to disconnect it from the PC and connect it again. Then it worked.
I use String a few places, but changed that to use char[] instead. I'll let it run for 4-5 days and see.
Put something in your code that will also blink an LED every so often. When things lock up, if the LED is still blinking, you can assume the code is still running and it isn't an issue with the board and the code.
zoomkat:
Put something in your code that will also blink an LED every so often.
But remember to make that delay-less else it tells you nothing.
It's easy just to take the stuff from blink without delay into any sketch. What I often do to keep things tidy is put blink without delay's loop stuff in a function called say proofOfLife() and call that from loop() of my actual sketch.
I already got a heart beat led that blink like heart beat and it works all the time. Also, I'm using a GET request to send data to a web server which send it to a MySQL server (should have used POST but the values are in the GET request), which also work fine. The update of the 2004 LCD display works fine.
And there are no delay() in the code except in the setup() function. I'm an timed event handler that calls different function based on millis and how often each function should be called.