[SOLVED] Sketch not uploading correctly on Fedora 15 64 bit

I bought my first Arduino (the Arduino Uno) board today. I installed the IDE using the command:

sudo yum install arduino

Next I plugged in the board and opened the Blink program in the Basic category. When I clicked upload, it says "Done uploading" in the IDE and "Binary sketch size: 1020 bytes (of a 32256 byte maximum)" in the output. But the LED doesn't blink. I did the same thing on my friend's WIndows 7 machine and the example worked. What could be the issue in Fedora? How do I go about fixing it? I've added my user to the groups uucp, lock and dialout

Thanks in advance! :slight_smile:

Any error messages perhaps ?

What version of avr-libc and avr-gcc ... are installed ?

Does the arduino ide downloaded from THIS site work (and not from some code repository of unknown quality) ?

No there is no error message. It just says done uploading.. Here are the avr-libc and avr-gcc versions:
avrdude-5.10-3
avr-libc-1.7.0-1

I installed it from Fedora's repositories. Just ran sudo yum install arduino. I remember reading somewhere that some version of rxtx has an issue. I don't remember where. But the version installed is: rxtx-2.2-0.5.20100211. Finally, I'm using jre-1.6.0_25.

Linux and avr-gcc (avr-libc-1.7.0) had some issues with delay().
Does the LED light? Or nothing? Try the following code. All it does is turn on the LED at pin 13. No blinking, just on.

void setup()
{
   pinMode(13,OUTPUT);
   digitalWrite(13,HIGH);
}

void loop()
{
}

BTW, if that is the problem, it is fixable. I upgraded to avr-gcc 4.5.1 (avr-libc-1.7.1), and with a text editor modification to two files, it is running fine!

Hey you're right! I tried a few programs with out the delay function and they work. Thanks :slight_smile:

I did some searching and read that (http://arduino.cc/forum/index.php/topic,71875.0.html) this is because of code optimization. So how do you fix the problem?

Here is a thread that covered the bug and fix report.
http://arduino.cc/forum/index.php/topic,68785.0.html

Here is where to get the software. I unpacked it in a local directory before deciding where in my Linux version it went. You will probably need the AVR 8 bit version for Linux 64 bit OS.

When you unpack it, in that directory will be an /avr/include/util/delay.h file. Open it with a text editor, and at line 44 (after the other includes) add
#include <math.h>

If you do not add that line, you will get a delay.h "no declaration for fabs" and "no declaration for ceil" error when you try to compile a sketch.

Then I copied all the directories to the /usr/ directory. I had installed mine from a repository (buggy tho), and that is where my repository put it. They fit into existing directories. the /avr/ directory is the hint. Check where your /avr/ directory is.
/usr/avr/
/usr/bin/
/usr/doc/
etc..

Now the avr-libc problem is corrected, but that correction will create an error with a define in the Arduino wiring.h file.
Open this file:
arduino-0022/hardware/arduino/cores/arduino/wiring.h
and comment out line 79. It is a "#define round" macro. It causes problems with the new avr-gcc version.

If you don't comment out that line, you get a math.h "expected blah or ; before double" error when compiling your sketch. That is the round macro replacing the word "round" in the math.h file with that macro. Not good.

Recompile your problem sketches and that should do it. The blink example is a good test.

That upgrades both avr-gcc (to v4.5.1) and avr-libc (to v1.7.1).

Worked without any problems. Thanks a ton! :slight_smile: Now what actually fixed the problem and how?

Good to hear it worked for you.

I don't know what was wrong with avr-libc-1.7.0. All I know is version 1.7.1 was released a bit before they were ready because of that bug. It is mentioned on the website. Read the right column here about v1.7.1 released:

The fixes you did were because:

  1. they forgot to put that "#include <math.h>" in the final release.
  2. Arduino was probably using the "#define round" to do part of the delay in the previous versions.

Just a question. Was your install (Fedora) also in the /usr/ directory?

Yes, avr-gcc and avr-libc were in /usr.

However, the IDE was in /usr/share/arduino/

OK. That will help others. I had problems with the Arduino ethernet library, and downloaded the IDE into a local directory from the Arduino website to insure I had the latest version. I'm not sure where the repository put that.

I recommended to another Fedora user having problems with delay to read this thread. Your input should help. :slight_smile:

I upgraded to Fedora 16 this week (a clean install rather). What's odd is it shows the following version numbers:

avr-gcc-4.6.1-3.fc16.x86_64
avr-libc-1.7.1-1.fc16.noarch

The delay function doesn't work again. I thought 1.7.1 solved the problem :expressionless: Don't know what I am missing now. Also avr-gcc's version, seems to have got an upgrade from what I last downloaded from Atmel's site last time. What could be the issue now?

Can you be more specific about the delay() not working?
Is it not compiling? (red errors in IDE lower window)
Or not running once the sketch is compiled and uploaded? (freezes)

I think its getting optimized out again. The blink program is not working - the LED doesn't blink at all.

The code compiles with no errors. It uploads with no errors too. If I add Serial.begin(9600) in setup() the blink program works.

Sorry to hear that. But you know how to fix it.

I'm testing a Ubuntu v11.10 Arduino IDE now. The ethernet and blink works with it.

Yea. I'll do that in the morning. Its just that I found it strange. The version number for avr-libc in the fedora repository matches what is mentioned in your fix and yet the problem persists. Could something be wrong in the repository's package?

I am not certain the Fedora repository is using my fix. I know that avr-libc-1.7.1 had a delay.h bug. Mine would not even compile the blink example. I got red error messages in the lower IDE window.

I don't know how they tried to fix it. I know my fix works. :slight_smile:

Ok then I think I should point this out there. You're right about them using a different fix. Even adding your fix to the files installed in their package didn't work. I'll install atmel's packages first thing tomorrow morning. Thanks again :slight_smile:

SurferTim:
I'm testing a Ubuntu v11.10 Arduino IDE now. The ethernet and blink works with it.

Be careful because Ubuntu 11.10 and derivativescompile sketches that are not 100% perfect.
If you compile ArduinoISP under 11.10 and try to upload a sketch on a standalo ne micro, you'll get an "out of synch" error.
See this. Same issueproblem using Arch Linux.
I don't know if it is related to kernel 3.0 or to other pieces of the OS.