Hi, I'm new to Arduino platform and like what I see. Quick question here. What is the state of digital I/O during power up?? I assume, during the first few fractions of a millisecond, the boot loader loads, then my downloaded program loads. When my program loads, I set the pins as either inputs or outputs and setting the actual levels (high or low) at that point, but what I want to know is prior to that, what is their state? Some devices are tri-stated. Is this the case? Thanks for your help for a first time user and first time poster.
birddawg:
Hi, I'm new to Arduino platform and like what I see. Quick question here. What is the state of digital I/O during power up?? I assume, during the first few fractions of a millisecond, the boot loader loads, then my downloaded program loads. When my program loads, I set the pins as either inputs or outputs and setting the actual levels (high or low) at that point, but what I want to know is prior to that, what is their state? Some devices are tri-stated. Is this the case? Thanks for your help for a first time user and first time poster.
At initial power up (or pressing the reset button) all I/O pins default to input mode with no pull-up. This is equivalent to being tri-stated and if in fact you don't have an electrical connection that is providing a legal low or high signal the data read from such a state should be considered invalid and said to be a "floating input condition".
Soon after power up (or reset) the bootloader code is executed which places pin 13 in output mode as the bootloader wants to blink the pin 13 led to show it's active. Also pin 1 is set to output mode because the serial hardware the bootloader uses to talk to the arduino IDE if attached.
So yes you can assume that all I/O pins will be in input mode with no pull-ups enabled when you sketch takes over control.
This is for Uno and most other (all?) 8 bit AVR based arduino boards, not sure at all about the newer arm based arduino boards.
Lefty
Soon after power up (or reset) the bootloader code is executed which places pin 13 in output mode as the bootloader wants to blink the pin 13 led to show it's active. Also pin 1 is set to output mode because the serial hardware the bootloader uses to talk to the arduino IDE if attached.
I understand, bootloader switches back pins 1 and 13 to input and disables pullup, even if pins were high before. No matter if bootloader got a new sketch, or did not receive a request on Rx. ( Pin 0 )
And Pin 1 was output HIGH (serial IDLE = stopbit = high) for a short while, even if there's nobody sending any upload ?
An interesting detail to eventually consider when assigning IO Pins. Thanks for confirming!
So yes you can assume that all I/O pins will be in input mode with no pull-ups enabled when you sketch takes over control.
This is the standard answer, but obviously only half of the story ...
michael_x:
Soon after power up (or reset) the bootloader code is executed which places pin 13 in output mode as the bootloader wants to blink the pin 13 led to show it's active. Also pin 1 is set to output mode because the serial hardware the bootloader uses to talk to the arduino IDE if attached.
I understand, bootloader switches back pins 1 and 13 to input and disables pullup, even if pins were high before. No matter if bootloader got a new sketch, or did not receive a request on Rx. ( Pin 0 )
And Pin 1 was output HIGH (serial IDLE = stopbit = high) for a short while, even if there's nobody sending any upload ?
An interesting detail to eventually consider when assigning IO Pins. Thanks for confirming!So yes you can assume that all I/O pins will be in input mode with no pull-ups enabled when you sketch takes over control.
This is the standard answer, but obviously only half of the story ...
One thing to also keep in mind is that pin 1 will have an external pull-up voltage via a series resistor and then from the USB serial converter chip even if not plugged into a PC USB.