Go Down

Topic: d13 LED reacts differently without bootloader (Read 367 times) previous topic - next topic


Any reason for this?  I am using the exact same code, but on 1 pro mini I have the bootloader in tact, the other no bootloader.

The code has a blinking onboard LED to indicate communication with a sensor.  But for some reason once I run the boards without the bootloader the LED is fairly dim.

Ive duplicated it several times.  Same code. Bootoader bright onboard LED, no bootloader onboard LED is blinking fine, but dim.

I can only assume the bootloader contains some reference to a resistor or something?  Totally unforseen problem, I assumed the bootoader only contained info for bootloading, reset timing and what not.  Obviously Im super wrong.

Please help.


Well I didnt know this was a function of the bootloader, but to fix it I had to add


to the code on the non-bootloader version.  After adding that in the void setup the light is back to being bright.

So apparently the bootloader contains a default setting for the 13 digital pin.

Now that I seem to have found the solution I suspect others will post, oh yeah of course its like that.  Ha ha


Seems odd that the bootloader leaves the pin set as OUTPUT, but doing a google search does bring up some references to other people noticing this behavior.

Personally I would consider it a bug in the bootloader, my assumption has always been that the I/O pins default to INPUT mode.  Not something I would have noticed in your case because if I were using pin 13 as an output I'd have assumed setting it to OUTPUT in my code was necessary.  Probably the reason you were getting the LED lighting dimly without setting the pin to OUTPUT was that writing a HIGH to the port activates the internal pullup resistor.


Which board, and which bootloader?
Current Optiboot (used on the Uno and new, genuine Arduino Nanos) carefully resets the state of IO ports to their power-on defaults (or it's supposed to.)
3rd party Nanos and "Pro Mini" may have one of several other bootloaders, and I think there was at least one version that did not change the pin13 LED back to "input"...


I recommend bootloading anything with a '328p on it as an Uno (or better yet, with MiniCore, since that brings in the app-writing-to-flash thing too)
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up