SEEEDUINO MEGA - issue with serial communication

Hello and thanks for reading.

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?

Thanks for any help,
mmi.

Hey mmi, quick question: Does it work with the regular blink sketch :slight_smile:?

yes, blink works fine.

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

Good Luck;

Lefty

Thanks leftyretro.

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

Thanks, mmi.

Could you post the faulty hex (with the sketch) ?

@elbeem:
Ok, i keep it simple, this is the source:

void setup() {
  Serial.begin(57600);
  pinMode(13, OUTPUT);     
}
void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
  Serial.println("just a test");
}

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.

:100000000C9403010C9432010C9432010C943201D3
:100010000C9432010C9432010C9432010C94320194
:100020000C9432010C9432010C9432010C94320184
:100030000C9432010C9432010C9432010C94320174
:100040000C9432010C9432010C9432010C94320164
:100050000C9432010C9432010C9432010C940C0279
:100060000C9432010C9462030C9432010C94320112
:100070000C9432010C9432010C9432010C94320134
:100080000C9432010C9432010C9432010C94320124
:100090000C948E030C9432010C9432010C943201B6
:1000A0000C9432010C9432010C9432010C94320104
:1000B0000C9432010C9432010C9432010C943201F4
:1000C0000C9432010C9432010C9432010C94BA035A
:1000D0000C9432010C9432010C94E6030C9432011E
:1000E0000C94320100002100240027002A002D007A
:1000F0003000330001010000040107010A01000083
:100100002200250028002B002E00310034000201BF
:100110000000050108010B0100002000230026005B
:1001200029002C002F00320000010000030106010D
:10013000090105050505070508080808020202026D
:100140000A0A080804040404010101010101010173
:100150000303030303030303040707070C0C0C0C3E
:100160000C0C0C0C02020202060606060606060627
:100170000B0B0B0B0B0B0B0B0102102020080810B4
:100180002040102040800201020108040201010207
:1001900004081020408080402010080402018004E0
:1001A000020180402010080402010804020101023B
:1001B0000408102040800102040810204080000044
:1001C000090A02080B0C0D070603040100000000D9
:1001D000000000000000000000000000000000001F
:1001E00000000000000000000000100F0E000000E2
:1001F00000000000000000000000000000000000FF
:1002000000000000160511241FBECFEFD1E2DEBFB3
:10021000CDBF12E0A0E0B2E0EEEDFCE000E00BBFED
:1002200002C007900D92A631B107D9F714E0A6E1FC
:10023000B2E001C01D92AB37B107E1F712E000E078
:10024000C6E0D2E040E006C022974109FE014BBF64
:100250000E946906C430D1074007B1F70E945C01D3
:100260000C946D060C9400008DE061E00E94820108
:1002700068EE73E080E090E00E9454028DE060E060
:100280000E94820168EE73E080E090E00E945402D8
:100290008FE294E060E072E00E94360308958FE2FE
:1002A00094E040E051EE60E070E00E9412048DE0C6
:1002B00061E00E94630108950E947E020E944F0146
:1002C0000E943401FDCF282F30E0C90188589E4F8D
:1002D000FC019491F901EE5CFE4FE491EE2389F06C
:1002E000F0E0EE0FFF1FEC51FF4FA591B491662394
:1002F00029F48C91909589238C9308958C91892B66
:100300008C930895482F50E0CA0182549E4FFC01FF
:1003100094919A0128583E4FF9012491FA01EE5C1C
:10032000FE4FE491EE2309F476C0992309F462C0EC
:10033000933021F4909180009F7705C0943031F480
:10034000909180009F7D9093800054C0913019F46B
:1003500094B59F7704C0923021F494B59F7D94BDED
:1003600049C0963021F49091B0009F7705C0973036
:1003700031F49091B0009F7D9093B0003BC09830D5
:1003800021F4909190009F770BC0993021F49091C7
:1003900090009F7D05C09A3031F490919000977F36
:1003A0009093900027C09B3021F49091A0009F77FC
:1003B0000BC09C3021F49091A0009F7D05C09D3022
:1003C00031F49091A000977F9093A00013C09E30CD
:1003D00021F4909120019F770BC09F3021F49091E0
:1003E00020019F7D05C0903129F490912001977FD5
:1003F00090932001F0E0EE0FFF1FE250FF4FA59118
:10040000B491662329F48C91209582238C930895CE
:100410008C91822B8C9308951F920F920FB60F929E
:1004200011242F933F938F939F93AF93BF9380910A
:100430001A0290911B02A0911C02B0911D023091F2
:100440001E020196A11DB11D232F2D5F2D3720F017
:100450002D570196A11DB11D20931E0280931A02F3
:1004600090931B02A0931C02B0931D028091160270
:1004700090911702A0911802B09119020196A11D46
:10048000B11D8093160290931702A0931802B093A7
:100490001902BF91AF919F918F913F912F910F9032
:1004A0000FBE0F901F901895EF92FF920F931F931E
:1004B0007B018C018FB7F89420911A0230911B02B6
:1004C00040911C0250911D028FBF6FB7F89480912C
:1004D0001A0290911B02A0911C02B0911D026FBFE5
:1004E000821B930BA40BB50BE816F9060A071B0732
:1004F00060F71F910F91FF90EF900895789484B565
:10050000826084BD84B5816084BD85B5826085BD0F
:1005100085B5816085BDEEE6F0E0808181608083F5
:10052000E1E8F0E080818260808380818160808367
:10053000E0E8F0E0808181608083E1EBF0E08081A1
:1005400084608083E0EBF0E0808181608083E1E97A
:10055000F0E0808182608083808181608083E1EA35
:10056000F0E0808182608083808181608083E1E22D
:10057000F1E0808182608083808181608083E0E916
:10058000F0E0808181608083E0EAF0E0808181603A
:100590008083E0E2F1E0808181608083EAE7F0E03F
:1005A000808184608083808182608083808181609B
:1005B00080838081806880831092C10008950F93AA
:1005C0001F93CF93DF93EC018B0109C00F5F1F4F87
:1005D000E881F9810190F081E02DCE010995F801C3
:1005E0006081662399F7DF91CF911F910F91089554
:1005F000EF92FF920F931F93CF93DF93EC018B0148
:100600007A010DC0F80161918F01E881F9810190B3
:10061000F081E02DCE0109950894E108F108E1147C
:10062000F10481F7DF91CF911F910F91FF90EF902F
:100630000895DC01ED91FC910190F081E02D099588
:100640000895DC01ED91FC910280F381E02D099584
:100650000895CF93DF93EC016DE00E941903CE0162
:100660006AE00E941903DF91CF910895CF93DF9341
:10067000EC010E942103CE010E942903DF91CF915A
:100680000895CF93DF93482F9B01FB01E058FF4F64
:10069000C081D181CE01019660E870E00E9405061C
:1006A000BC01D901AE57BF4F8D919C91119768172E
:1006B000790729F0C20FD31F488371836083DF91CC
:1006C000CF9108951F920F920FB60F920BB60F9213
:1006D00011242F933F934F935F936F937F938F9347
:1006E0009F93AF93BF93EF93FF938091C6006FE109
:1006F00072E00E944103FF91EF91BF91AF919F91F2
:100700008F917F916F915F914F913F912F910F90BA
:100710000BBE0F900FBE0F901F9018951F920F9257
:100720000FB60F920BB60F9211242F933F934F9356
:100730005F936F937F938F939F93AF93BF93EF9349
:10074000FF938091CE0063EA72E00E944103FF9123
:10075000EF91BF91AF919F918F917F916F915F9139
:100760004F913F912F910F900BBE0F900FBE0F90A6
:100770001F9018951F920F920FB60F920BB60F9203
:1007800011242F933F934F935F936F937F938F9396
:100790009F93AF93BF93EF93FF938091D60067E24F
:1007A00073E00E944103FF91EF91BF91AF919F9140
:1007B0008F917F916F915F914F913F912F910F900A
:1007C0000BBE0F900FBE0F901F9018951F920F92A7
:1007D0000FB60F920BB60F9211242F933F934F93A6
:1007E0005F936F937F938F939F93AF93BF93EF9399
:1007F000FF93809136016BEA73E00E944103FF9101
:10080000EF91BF91AF919F918F917F916F915F9188
:100810004F913F912F910F900BBE0F900FBE0F90F5
:100820001F9018958F929F92AF92BF92DF92EF9296
:10083000FF920F931F93CF93DF93EC017A018B010B
:10084000413482E458078FE0680780E078070CF0B5
:100850007FC060E874E88EE190E0A80197010E94F3
:100860003A06CA01B901615070408040904022E0D0
:1008700030E040E050E00E943A0649015A01A501EB
:100880009401209530954095509594E0220F331FA8
:10089000441F551F9A95D1F760E074E284EF90E011
:1008A0000E943A06CA01B9012FEF30E040E050E063
:1008B0000E94E605A80197010E943A06C90121504D
:1008C0003F4F121613061CF4D82EDA9403C0DD2411
:1008D000D394D81A60E079E08DE390E0A801970105
:1008E0000E943A06CA01B9016150704080409040B0
:1008F00022E030E040E050E00E943A06209530953A
:100900004095509583E0220F331F441F551F8A9551
:10091000D1F760E074E284EF90E00E943A06CA01E9
:10092000B9012FEF30E040E050E00E94E605A80159
:1009300097010E943A06C90121503F4F1216130633
:100940001CF4282F215002C021E0281B2D1500F592
:10095000E885F98581E090E00A8802C0880F991F38
:100960000A94E2F7808360E079E08DE390E0A801EB
:1009700097010E943A06CA01B90161507040804057
:10098000904022E030E040E050E00E943A0604C08F
:10099000E885F98510829401EC81FD813083EE8138
:1009A000FF812083EA85FB85808121E030E0A90179
:1009B0000E8402C0440F551F0A94E2F7842B8083F3
:1009C000EA85FB858081A9010F8402C0440F551F71
:1009D0000A94E2F7842B8083EA85FB85808108886E
:1009E00002C0220F331F0A94E2F7822B8083DF912B
:1009F000CF911F910F91FF90EF90DF90BF90AF903C
:100A00009F908F900895FC01A085B18521898C91DC
:100A100090E0022E02C0959587950A94E2F780FF38
:100A2000F6CF0484F585E02D6083089560E172E0DF
:100A30007093300460932F048FE192E0909332041E
:100A40008093310485EC90E09093340480933304D8
:100A500084EC90E0909336048093350480EC90E031
:100A6000909338048093370481EC90E090933A049B
:100A70008093390486EC90E090933C0480933B048F
:100A800044E040933D0433E030933E0427E020935C
:100A90003F0495E09093400481E08093410470937B
:100AA000430460934204E3EAF2E0F0934504E093E8
:100AB0004404EDECF0E0F0934704E0934604ECECE2
:100AC000F0E0F0934904E0934804E8ECF0E0F093A0
:100AD0004B04E0934A04E9ECF0E0F0934D04E0931A
:100AE0004C04EEECF0E0F0934F04E0934E0440939E
:100AF00050043093510420935204909353048093F4
:100B000054047093560460935504E7E2F3E0F093C5
:100B10005804E0935704E5EDF0E0F0935A04E093B5
:100B20005904E4EDF0E0F0935C04E0935B04E0ED45
:100B3000F0E0F0935E04E0935D04E1EDF0E0F0930B
:100B40006004E0935F04E6EDF0E0F0936204E0936C
:100B5000610440936304309364042093650490938C
:100B600066048093670470936904609368046BEA79
:100B700073E070936B0460936A0465E371E07093B3
:100B80006D0460936C0464E371E070936F04609390
:100B90006E0460E371E0709371046093700461E32C
:100BA00071E0709373046093720466E371E0709374
:100BB0007504609374044093760430937704209313
:100BC00078049093790480937A040895629FD00109
:100BD000739FF001829FE00DF11D649FE00DF11DF8
:100BE000929FF00D839FF00D749FF00D659FF00DA7
:100BF0009927729FB00DE11DF91F639FB00DE11D94
:100C0000F91FBD01CF011124089597FB092E072676
:100C10000AD077FD04D049D006D000201AF4709590
:100C200061957F4F0895F6F7909581959F4F0895B0
:100C3000A1E21A2EAA1BBB1BFD010DC0AA1FBB1FE0
:100C4000EE1FFF1FA217B307E407F50720F0A21B52
:100C5000B30BE40BF50B661F771F881F991F1A94BF
:100C600069F760957095809590959B01AC01BD01E9
:100C7000CF01089597FB092E05260ED057FD04D00D
:100C8000D7DF0AD0001C38F4509540953095219557
:100C90003F4F4F4F5F4F0895F6F7909580957095B1
:100CA00061957F4F8F4F9F4F0895AA1BBB1B51E14A
:100CB00007C0AA1FBB1FA617B70710F0A61BB70BCC
:100CC000881F991F5A95A9F780959095BC01CD0171
:0E0CD00008950790F691E02D0994F894FFCF57
:100CDE006A757374206120746573740000000000DF
:060CEE000305DF02F8021D
:00000001FF

Thanks, mmi.

BTW: As a more complex application I connected a “danger shield” this weekend, all works fine (without serial though).

Hi,

of course, the sketch works perfectly on my seeedmega.

But incidently, the hex I produced with my own setup is a bit larger :
pastie.org/633016

Could you please test the hex (exactly doing what the pde describes).

It has been generated with arduino 0017 mac edition

I could suspect your arduino setup is wrong.

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

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.