I just started with Arduino, so probably I'm doing something wrong....
I installed the arduino software on my (Arch) Linux PC. When I connected my Arduino Duemilanove for the first time to a USB-port, the "L" led started flashing. So it worked.
After that I compiled the sketch under file -> examples -> 1.basics -> Blink and tried to upload this to the Arduino. After a short flashing of the TX and RX leds the L led goes on, and stays on.
If i change the order like this:
void loop() {
digitalWrite(13, LOW); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, HIGH); // set the LED off
delay(1000); // wait for a second
}
and compile and upload, the L led stays off.
Holding the Shift key during the upload gives the following output:
Binary sketch size: 1020 bytes (of a 30720 byte maximum)
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/tmp/build7976589511234931586.tmp/Blink.cpp.hex:i
avrdude: Version 5.4-arduino, compiled on Oct 22 2007 at 13:15:12
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
User configuration file is "/home/ko/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyUSB0
Using Programmer : stk500v1
Overriding Baud Rate : 57600
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
AVR Part : ATMEGA328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
make sure you did all the correct steps for linux: Arduino Tutorial - Getting ready
Use a current limiting resistor (1000 ohms) before the led to make sure it doesn't burn out.
I installed with Linux a while ago and version 17 of the software would work, not later versions, though they have probably fixed that by now.
I seem to remember a bug in a version of avr-binutils causing the delay function not to work correctly. You can check the version by executing the command "avr-as --version". I version I use on my machine is "GNU assembler (GNU Binutils) 2.20.1.20100303"
I have a similar case (using UBUNTU 10.10)
You need to install arduino via synaptics and then update that version since the synaptics install version 0018
Then to update to the last version of arduino use this tuturial http://www.arduino.cc/playground/Linux/Ubuntu
It should be similar of your distro
Thanks for all responses. Wow! this really is an active community! I'll try your suggestions one by one; maybe also install the Arduino software on Windows.
I can confirm that my Duemilanove works in Windows XP. I can upload the 'Blink' sketch there, make it work, change, upload again etc. So there's obviously something wrong with the installation in Linux. There don't seem to be very many Arch-Linux users working with Arduino.
I'll have a look at your suggestions.
Hi,
i have the same problem with arduino uno (i'm using arch linux too).
For the arduino ide seems that the upload was succesfull.
In windows Vista everything works fine.
I can confirm that the problem is in the delay() function. I've found this sketch: http://arduino.cc/en/Tutorial/BlinkWithoutDelay; compiled & uploaded it, and it works: BlinkWithoutDelay really blinks!
To: finarfin:
I don't get what you mean with the link. It seems to point at a Ubuntu-discussion??
It seem that there are problems with arduino uno and linux. And this discussion if you checked in archlinux wiki is indicated as a possible solution for problem encountered uploading sketch.
I am not a Duemilanove expert, as I don't have one, nor am I using Arch Linux. So anything I may say here will be guesswork. Probably someone else can offer better advice.
What I would do first is try to find a Mac or Windows PC, and upload the sketch with that. This eliminates problems with the board, its interrupts, and the bootloader.
If that fixes it then it would seem that the "core library" uploaded alongside your sketch is not handling delays properly.
As far as I can see, delay is implemented by looping waiting for micros () to return a value indicating the delay time is up. So the question is, does micros () work for you? This sketch might test that out:
But if you find the number does not increment, then the micros is faulty (probably because interrupts are not firing) and thus delay will loop forevever. How to fix? Try upgrading your version of the IDE (development environment). Try searching for "blink delay +Duemilanove ".
I already eliminated problems with the board, etc.: it works in Windows XP (see my previous post).
I tried your sketch, and captured this output in the serial monitor:
mrtaylor:
I seem to remember a bug in a version of avr-binutils causing the delay function not to work correctly. You can check the version by executing the command "avr-as --version". I version I use on my machine is "GNU assembler (GNU Binutils) 2.20.1.20100303"
Yes this is correct. What happens is, in any sketch with no initialised global variables (no data section), the linker puts the uninitialised globals (bss section) at an illegal address, and one of those uninitialised globals is the micros counter. Hence delay won't work properly. See these two threads:
That seems to be the right analysis of the problem. I tested this version of Blink:
char dummyvar = 123;
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
void setup() {
dummyvar++;
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, LOW); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, HIGH); // set the LED off
delay(1000); // wait for a second
}
And that works. More a workaround than a solution, of course..
This is a "fake" solution, because only the Blink sketch works....
If you use some sketch more complex than Blink, you won't get your code working.
A few days ago I changed OS, from Ubuntu to Arch, and I had to fight with the binutils-avr bug. Using this solutions just fix the Blink sketch. But if I try to use this fix with ArduinoISP when I go to flash an external micro I get "programmer is out of synch".
But if I compile the ArduinoISP on a old computer of mine running Lubuntu, I get a "perfect working" sketch and I can flash standalone chips like a charme....
So, this fix does NOT... fix the problem. There should be something else related to the buggy linker that comes up during compilation.
HI.. I've just bought an Arduino Uno (I'm from taly also ).. I'm runining on archlinux and i tryed to start the blink sketch and it was not working. So I've searched around and i found a warning on Archlinux wiki. I've just updated binutils-avr so i've got:
$> avr-as --version
GNU assembler (GNU Binutils) 2.21
So the problem wasn't fixed with the new version.. Any really workaround to bring back the dalay() function?