Pin status at boot

Hi there,

I'm designing a circuit which will be connected to Arduino that has several outputs and wil "control" a device.

There are some safety features build into the hardware, but nevertheless, it is very important that all outputs are set to a known state upon startup/reset of the Arduino. (Example: after a power failure, or upload of new software.)

I read in the ATmega datasheet that all ports are put in the "float" state when the microprocessor starts.

However, in an other trhead I read that upon boot most (but not all) ports are set to 0.
I suspect it is the bootloader that is doing this.

Can anybody tell what the boot status is of the pins of an Arduino board with an ATmega328?

Does the "pinmode" command make any change to this state?

Best regards,

At reset, Data Direction Registers (DDR) are zeroed, data registers (PORT) are zeroed

However, in real applications i have found it best to pull the lines low externally.

If its a concern, just set the pins you have stuff connected to yourself in the setup portion of the sketch with digitalwrite . I have my heating system controlled by arduino and I don't don't want that firing up whenever I reset the board, and so far it hasn't. :slight_smile:

Thanks for all the information.

I also want to protect against accidental disconnects. So I think I'll use an extra pin on the Arduino that needs to be high in order to enable the outputs on the interface.

Best regards,

Well the AVR datasheets say that all I/O pins default to inputs. I guess a more specific questions would be does the Arduino bootloader, say after a power-up, change any of I/O pins before 'jumping' to a previously uploaded sketch?

Lefty