Hello
I connect an enable pin of a voltage regulator to Port PB2 . No my problem is that on powering up the pin is first High and enables (activates) the voltage driver until I configure the ports in the startup function and set the pin Low.
How can I boot the Atmaga so that the Port PB2 is in Low until the setup function is executed and I can control the state of the pin?
Thanks Martin
According to the ATmega328 data sheet, the port pins are set to input on power up. It seems possible that the pullup resistor on the pin is activated on power up (I have a hard time sorting out the complete port pin logic diagram), but if so, you could override that pullup by putting a 1 to 2 Kohm pulldown resistor on PB2. That shouldn't affect normal function of the port.
Edit: It occurred to me that something in the program loader, or init functions could be leaving PB2 in the output state before your program takes control. You might need to use another port pin.
If this is the 328, then PB2 is pin 10 which is not special so will go to INPUT
mode (no pullup) as reset is pushed and stay like that until changed by the sketch.
Your voltage regulator presumable has its own pullup, since enables are usually
designed to be optional connections, so it will pull high without active opposition.
Which regulator? Its datasheet may indicate what value of physical pull-down will
cure your issue.
jremington:
According to the ATmega328 data sheet, the port pins are set to input on power up. It seems possible that the pullup resistor on the pin is activated on power up (I have a hard time sorting out the complete port pin logic diagram), but if so, you could override that pullup by putting a 1 to 2 Kohm pulldown resistor on PB2. That shouldn't affect normal function of the port.
Edit: It occurred to me that something in the program loader, or init functions could be leaving PB2 in the output state before your program takes control. You might need to use another port pin.
Pullup resistors are disabled on power up. Page 92 of the datasheet (full) contains the I/O Port register description. PORTx and DDRx are all set to 0s initially, meaning input with pull ups disabled.
Hello.
I spend now a couple of hours to make this work.
I use a TSP7933 5-Pin version.
I connected the PB2 with a pull-down resistor of 1k to GND and a pull-up resistor of 10k to 5V.
Now, on booting the Atmega the Pin stays low.
If I make the PB2 as an Output ( DDRB = B00000100;) this should drive the Enable pin High, right?
But it doesn't, it stays at 1.8V and the TSP7933 want switch on.
I tried to change the values of the Pull-Down and Pull-Up resisters, without success.