Pages: [1]   Go Down
Author Topic: Why do LEDs on pins 8 and 9 flash during upload  (Read 686 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Uno with eight LEDs wired to pins 2...9.
As I upload a "null" program
    void setup(){}
    void loop(){}

I see (in roughly this sequence);
  • The LEDs on pins 8 and 9 flash briefly once simultaneously
  • Flashing on the onboard 'L' LED
  • Flashing on the onboard TX RX LEDs
  • The LEDs on pins 8 and 9 flash briefly once simultaneously

If I now press the "Reset" button only the onboard "L" LED flashes.

With the sketch loaded when I plug in the USB I see;
  • The LEDs on pins 8 and 9 flash briefly once simultaneously
  • Flashing on the onboard 'L' LED

Why do the LEDs on pins 8 and 9 flash once during power-up and twice during uploading (once at the start of upload and once at the end)?

Logged

UK
Offline Offline
God Member
*****
Karma: 10
Posts: 903
Twitter: @simonmonk2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have no idea why 8 and 9 flash.

I would guess that the Bootloader flashes 13, just to show its installed.
Logged

--
My New Arduino Book: http://www.arduinobook.com

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


@Si: You have confirmed that pins 8 and 9 flash an attached LED when the bootloader runs?
Logged

UK
Offline Offline
God Member
*****
Karma: 10
Posts: 903
Twitter: @simonmonk2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@coding - no I haven't. Just taking radman at his word.
Logged

--
My New Arduino Book: http://www.arduinobook.com

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino on the rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The bootloader (at least ATmegaBOOT_168.c) initializes the port B to blink the LED (pin 13). As the LED is on PB5, and pins 8 and 9 are on PB0 and PB1, this initialization apparantly makes those pins low for a short while. Pins 10, 11 and 12 could react the same. The pins 2 to 7 are on port D, so are not affected.
Logged

Offline Offline
God Member
*****
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think my circuit was correct because it operated the LEDs the way I was expecting, apart from the brief flashes during upload.

I have now just got LEDs on pins 8, 9 and 3 and I still get the same flashing on upload.
However if I remove the LED from pin 3 I no-longer get the flashing.

The circuit is 3 x LEDs and 3 x 560ohm resistors.
Pins 8, 9 and 3 each go to the +Ve of a separate LED.
The -Ve of the LEDs go through a resistor to GND.

This is as per the CIRC-02 diagram I got as part of the kit.
Everything is well spaced, and there are no obvious faults.

If somebody could reproduce the same thing on an UNO that would be good.
I don't have an electronics background, and am only just starting to explore the Arduino, so I would be grateful if any explanations did not assume any knowledge.

I noticed another post "Brief digital high on startup" that appears to describe something similar on another board.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


This is the source of the blink...
http://arduino.cc/forum/index.php/topic,64256.0.html

Quote
If I now press the "Reset" button only the onboard "L" LED flashes.

...is the test that divides the problem between the board / bootloader and your circuit.  Because the circuit behaves correctly when you press the reset button, the problem has to be with the board or the bootloader.  In this case, the problem is with the board (the auto-reset circuit).
Logged

Offline Offline
God Member
*****
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Coding Badly. Thanks for identifying the problem as being the board, it is nice to know there is an explanation for what was happening. As I am only experimenting its not a big issue for me, but I can see how it could cause problems for others.
Logged

Pages: [1]   Go Up
Jump to: