Go Down

Topic: Blink does not blink... (Read 10866 times) previous topic - next topic


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

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:

Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


Hi Stimmer,

That seems to be the right analysis of the problem. I tested this version of Blink:

Code: [Select]

char dummyvar = 123;

  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.

void setup() {
  // 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:
Code: [Select]

$> 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?


Go Up