Go Down

Topic: Mega - serial1, 2 und 3 - initialization fails (Read 10 times) previous topic - next topic

Kompi

Aug 12, 2009, 03:48 pm Last Edit: Aug 12, 2009, 06:53 pm by kompi Reason: 1
Hi,
I just got the Arduino Mega - works perfectly, but not the serial communication.
As long as i reference the serial communication package, the sketch does not run after uploading.
Note that the Mega has 4 serial interfaces and ATmega1280.
I downloaded the latest software 0017, but the same result.
Luckily after commenting out the initialization of serial1, 2 and 3 in hardware/core/arduino/HardwareSerial.cpp lines 216 to 218 (version 0017), it worked at least with first Serial port.
Seems the initialization of serial1,2 and 3 crashes.

Till now i would use only one serial, but it would be good to have the rest also working.

And some info:
running openSUSE 11.1 (i586)

SUN jre:
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Server VM (build 14.1-b02, mixed mode)

AVR:
avr-libc-1.6.7-4.1
cross-avr-gcc44-4.4.1_20090722-19.1
cross-avr-binutils-2.19.51-15.2
avrdude-5.5-137.6

Regards,
Kompi

Kompi

Hi,

Anyone having the arduino mega with successfully initialized serial interface?
Or should i better return it as deffect?
I still hope it is software issue.

Regards,
Kompi

bhagman

Working great here.

You should post your code and we can have a look at what is going on.

b

Kompi

Hi,

Which OS are you running? I can try with the same version as yours.
I will also try the windowz version tomorrow.

Actually there is no real code, even this hangs:
void setup()
{
 Serial.begin(9600);
}
void loop()
{
 Serial.println("Hello world!");
 delay(1000);
}

bhagman

I know this may sound silly (like "make sure it's plugged in" kinda silly), but are you sure you've selected the right board in the IDE?

Tools->Board->Arduino Mega

Don't shoot me for asking.  I've made the mistake myself a few times.

b

Kompi

sure, i have selected the right board,
when commenting out the serial1,2,3 object initialization (HardwareSerial.cpp), the first serial works fine alone

are you running your IDE on Windows?

retrolefty

#6
Aug 25, 2009, 09:18 am Last Edit: Aug 25, 2009, 09:19 am by retrolefty Reason: 1
Running version 17 and windows xp sp3. I tested my mega with a simple sketch that outputs on serial port and one other of the three remaining mega serial ports (serial2,3,4, there is no serial1 port, it's just called serial in software).

I was able to get a simple sketch to stream data out two serial ports at a time and tested that all three of the extra serial ports worked. I used the IDE serial monitor to watch the serial port and used a TTL/RS232 convertor module to monitor the additional active serial(x) port using a PC terminal program on a comm port. Everything seems to work fine.

Lefty

Adr1an

Running XPSP3 and also Vista 64 and Win7 (7100) and haven't tried more than three Serial's in 0017(Serial, Serial2-3) yet, but under 0016 I had all 4 running (Serial, Serial1-3)

No problems here.
Checkout my projects development blog @ SLiDA

Kompi

Hi,

I just tried it under windows and it runs fine.
So it seems it is a linux problem - i have the latest versions of avr* .
I will invest some time looking for differences and comparing versions.

Just noticed:
The windows version has: gcc version 4.3.2 (WinAVR 20081205)
and i have the 4.4.1 under linux.

Is it worthy to check the latest avr-gcc under windows?

What OS are using the Arduino team for development and testing?
Think it is better to use the same or?

Cheers

Kompi

just downgraded to gcc 4.1.3 and the serial seems to work now.
Versions:
cross-avr-gcc-4.1.3_20080612-26.5
cross-avr-binutils-2.19-9.1
avr-libc-1.6.1-1.15
avrdude-5.5-111.33

bhagman

Strange.

I got your PM, and I've uploaded a compiled version of the ASCIITable example:

http://www.mediafire.com/Arduino
under Compiled Examples


Can you provide a listing for the .elf file from the 4.4.1 avr-gcc compile?  Or just send the .elf file.  Either way.

To create a listing file: avr-objdump.exe -h -S filename.elf

b

Kompi

major difference:
working version: the constructor is a function
non-woking: the constructor is expanded 4 times - inlined

Kompi


mmi

Has somebody a solution in the meanwhile?

I have same issue in Linux on a seeeduino mega.

Thanks for any hints,
mmi

riftware

The solution for the moment is actually 2 or 3 responses up - I had same issue under 64bit linux.  It turns out to be a problem if you take too new a version of the avr compiler software from your distro - downgrade to the version mentioned a couple posts up and it will magically start working for you :)

Go Up