Pages: [1]   Go Down
Author Topic: Arduino Mega serial only works with Serial monitor  (Read 1213 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Online Online
God Member
*****
Karma: 32
Posts: 506
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you disabled auto-reset? The echo command may be triggering a reset. (The Duemilanove should have done the same thing, though.)
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: