Go Down

Topic: arduino MEGA reset sequence (Read 507 times) previous topic - next topic

wzakaras

Dec 15, 2011, 05:33 pm Last Edit: Dec 15, 2011, 05:36 pm by wzakaras Reason: 1
i have a project where I have leds connected to PWM pins 2-13  I notice on a RESET that the led connected to PWM 13 flashes at full brightness whenever a reset occurs.  Is there a way to disable this function??  This occurs on the MEGA board

retrolefty

Quote
Is there a way to disable this function??  This occurs on the MEGA board


That is a result of the bootloader program on the mega becoming active upon a reset. When the bootloader detects that there is not a new sketch upload being attempted it 'times out' and then jumps to any sketch that was previously uploaded to the chip. All arduino boards that use a bootloader use pin 13 as a signaling device. So if your application cannot have that behaviour you will have to erase the bootloader and load the sketch via ISP with a hardware programmer.

Lefty


MarkT

Or use a different pin, or recompile a version of the bootloader that doesn't toggle pin13...
[ I won't respond to messages, use the forum please ]

wzakaras

thank you,  recompile/reload the bootloader   is more then i want to tackle.  another pin is not an option.  i need 13  outputs.  after learning that analogwrite 0 & 1  (PWM 0 & 1) are not really available, as the are either on or off and can't be pulsed (Very misleading when the spec says 14 analog outputs, there are really only 12).  So I'll propose another solution and possibly you can offer your thoughts.

In the circuit Pin 13 is driving the input transistor of an open collector darlington array.  the output of the darlington sources 200ma of current to drive 2 ultrabright leds..  Simple enuff circuit   
when a reset occurs the ultrabright leds go full blast ruining the effect that I am building.

If I were to AND the output of Pin 13 and another Digital output (eg 24) would that solve my issue upon a reset?  Digital Pin 24 should be low upon a reset and after initialization I can set it HIGH via a  digitalwrite(24,HIGH)  thus enabling the normal operation of PWM 13

Does this sound like it would work?

Thanks for your input. 

MarkT

With a pull-down resistor, as most pins are hi-Z (INPUT mode) on reset.
[ I won't respond to messages, use the forum please ]

Go Up