5
\$\begingroup\$

I have looked through two datasheets and user manuals now for two different microcontrollers (LPC2387 and STM32F4xx), and I haven't found (probably missed) anywhere where the initial state of the GPIO pins was described on powerup or after reset.

My question is not specific for these MCUs, but in general, is it most common for GPIO pins to be initialized as input-floating (high-z) upon reset? Is there a standard convention, or do different MCUs do different things, and one needs to read the datasheet/manual for each MCU one works with?

\$\endgroup\$
6
\$\begingroup\$

I really don't believe that information is missing the datasheets. I have never seen it NOT there, although I have never used the particular microcontrollers you mention.

In general, at least for the micros I have used, I/O lines wake up to be as benign to the external circuit as possible. This means going to high impedance to the extent possible. In addition, pins that can be analog inputs are usually configured that way on power up. That is because digital inputs often are not intended to be held at intermediate voltages for extended time. Some might consume more power in that case, or oscillate, or do other annoying and possibly out of spec things.

However, the definative answer is in the datasheet of whatever micro you are using.

\$\endgroup\$
7
\$\begingroup\$

From the app note by ST (AN3430):

After a reset, all STM32F2 pins are configured as inputs except some JTAG pins such as PA15 JTDI with pull-up, PA14 JTCK with pull-down and PA13 JTMS with pull-up.

It makes sense to have high-Z state after reset because it is the safest default state. In case of STM32F2 series micros, it also has the least power consumption.

\$\endgroup\$
6
\$\begingroup\$

For the LPC2387 the information is definitely there, and I expect that this is also true for the STM. If you can't find the information in the datasheet, have a look at the series user manual; this contains all information shared by all members of a controller family, in the case of the NXP that's the LPC23xx. The information you need is on page 172: all I/O registers are set to input.

This is common to most controllers. The reason is that driving an output high or low on reset may have unwanted effects, depending on what's connected to the pins.

\$\endgroup\$
3
\$\begingroup\$

The most common behavior is for microcontrollers to set all configurable pins to some variety of high-Z float, thus allowing external circuitry which are about the state of the pins to safely use pull-ups or pull-downs without static current draw. Some controllers will set some or all pins to weak pull-up; some will set them to weak pull-down. I've never used a microcontroller with a pin-keeper function (weak pull-up when a pin is high; weak pull-down when low) but I wouldn't be at all surprised if micros that have such functions enable it by default.

It's probably important to note that many microcontrollers have some pins that can be configured as analog inputs, disabling the input buffers on them. This feature can save 10uA-100uA to the current drawn by the part for each pin that is sitting at half-rail. Some parts by default enable their input buffers, while other parts disable them. Parts that enable the buffers by default may draw excess current until code has run enough to disable them. Parts which disable them by default may cause problems with software which doesn't know that they must be enabled before use.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.