Go Down

Topic: Arduino Mega serial only works with Serial monitor (Read 3260 times) previous topic - next topic


I just switched from an Arduino Deumilanove w/ ATMEGA328P to an Arduino Mega (not the UNO). The Deumilanove worked perfectly by turning LEDs on/off upon receiving letters over its serial interface. I would have my email client turn on two LEDs when I got new emails. After uploading the code to the mega, it worked fine with the serial monitor at 9600 baud. I then exited arduino and tried to send an A to it with the CLI
Code: [Select]
echo A > /dev/ttyUSB16 and nothing. I even tried it with python using pyserial... nothing! I finally tried the command again with the Arduino serial monitor open (to try to see if the arduino was sending anything back) and IT WORKED!! WTF!? I then exited the serial monitor and instantly the LED I turned on went off (which would have required me to send a lower case a normally). Does the Arduino Mega have some dis-feature that makes it suspend if the arduino serial monitor isn't open?? This never happened with the Deumilanove!!!!!!!!

PS: I use Linux as my one and only OS not windows.
PSS: And no, its not because I have it on /dev/ttyUSB16, thats just a UDEV rule I made to make it so its always on the same serial port no matter what else is plugged in.


Did you set the baud rate when you were trying to communicate outside of the Arduino serial monitor?  It may be reset each time the port is reopened.


I tried setting the baud rate with the python script, and for the cli.


Have you disabled auto-reset? The echo command may be triggering a reset. (The Duemilanove should have done the same thing, though.)
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


Wow, I'm having the exact same problem.  I don't have a solution sadly but I can confirm my serial reading is only working when I have opened the Serial Monitor prior to opening my processing program that sends out serial data.  I'm attempting this at 115200 Baud and everything was working just fine on the duemilanove before I switched the Mega2560.


I've discovered I have exactly the same problem - has anyone found a fix for this?

Go Up