A few days ago i’ve got a Seeeduino mega. It works great so far, but i have a problem if i want to use serial communication for user data transfer (flashing sketches works fine).
My PC sends a string to Seeeduino via USB and this string should be simply send back (echoed) to the PC. Thats a loop, repeated each 2 seconds. This sketch and the PC program should not have bugs because all this works fine on 2 other arduino clones w/ atmega 328 ( i have no other 1280 board).
In addition my sketch lights the LED on pin 13 as long as Serial.available() returns true. This happens not with Seeeduino, only the FTDI RX LED indicates receiving. Baudrate at both sides is ok.
I use the original Arduino 0017 ide and i choose “board=Arduino mega”. There is no other choice making sense for an Atmega 1280, i think. This way, sketches without any serial commands run fine.
But if i run a simple led blinking sketch and insert only f.e. “Serial.begin(57600)” - for test purposes without any further serial commands - the sketch seems not to run (no LED blinks). It can be said, that as soon as serial lib will be included, the code hangs, freezes or whatever.
But why? As said before, all this works fine on Arduinos with Atmels 328. Is “board=Arduino mega” in the IDE not compatible enough for Seeeduino mega in this case?
Can somebody show me complete commands for avr-gcc and avrdude to compile the cpp source and flush the Seeeduino from command line?
Well I added the statement Serial.begin(57600); to the setup loop in the standard example blink sketch and uploaded and pin 13 LED blinks fine. Is your IDE reporting “done uploading” after you select uploading? Switch on Mega in the auto reset position?
I’m Running:
Seeeduino Mega
Version 17 Arduino IDE
Windows XP pro sp3
I tried a lot till now, so you can be sure that i generally have the correct basic settings like boardname, baudrate, etc. and flushing of new sketches is done faithfully.
As i said before, all applications without serial run fine on this seeeduino mega. But as soon as “he sees” one of the serial commands (this can also be a procedure which is never called!), he doesn’t execute any other code. The same sketches run fine on my other arduinos while the only difference is that these are 328/168 and not 1280.
The only reason i see is, that there goes something wrong with code generation for 1280 if SoftwareSerial will be included. Although this works fine for other Atmels, maybe avr-gcc for my 64 bit Environment under Linux has an issue in this case. I have no other idea (and currently no other 1280 for testing).
The HEX file is about 9K, and sorry for the inconvenience i posted it here. I wanted to attach it as a seperate file, but none of my filenames with different extensions had been accepted.
Thanks elbeem, that’s very helpful and you’re right - your hexfile runs fine!
So it seems like there’s something wrong with the integration to my 64 bit Linux. Just wondering why there aren’t any issues with 168/328 arduinos, but i’m rather sure now where i have to look though.
Now i know my seeeduino mega is ok - i’m happy.
Thanks again for the help!
mmi.
EDIT:
In the meanwhile (and a little bit late for me) i found a discussion in another forum about this issue which seems to happen with avr-gcc version 4.4. (i use 4.4.1). This is mostly used on Linux systems and it helps to downgrade to a version < 4.0. Windows users normally should have this “older” version.