Hi, everybody. I suppose that on powerup the I/O pins stay in high impedance mode until the program takes control. Is this correct? Thanks, Alberto.
That is correct, specifically they come out or reset mode as input pins. However the bootloader has to set at least the Tx pin to ouput pin mode.
Lefty
Thanks Lefty.
Hi lefty,
Would it be possible to change the state of the I/0 pins at start up. I'm controlling the state of the pins to a high value inside my program however, when I switch ON my Arduino Mega 2560 R3, the I/0 pins are configured as inputs and thus the output (until my program starts running) become low. Is it possible to change the state to High before my program loads?
Regards
Norbert
No.
You could do is add pullup resistors.
Or maybe change the bootloader to enable the internal pullups before it started the bootload sequence.
"The Port A (to L) pins are tri-stated when a reset condition becomes active, even if the clock is not running."
norbert7:
Hi lefty,Would it be possible to change the state of the I/0 pins at start up. I'm controlling the state of the pins to a high value inside my program however, when I switch ON my Arduino Mega 2560 R3, the I/0 pins are configured as inputs and thus the output (until my program starts running) become low. Is it possible to change the state to High before my program loads?
Regards
Norbert
Typically one does that with hardware. If you need a pin to remain high while the chip is in reset use a pull-up resistor to a +5vdc voltage, 10k ohms is a typical value, but is mostly dependent on what you are driving with the output signal.
Lefty
I'm generating PWM signals and I have an inversion in my hardware so I need to counteract this through another inversion in my code however, when arduino resets these pin get low and due to the inversion the inversion I have the PWM signals become high which is undesired. Is there a way to do it in software?
when arduino resets these pin get low
No, they don't. They "float." Whether that causes them to behave as low or high will depend on the external circuitry.