cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO at Power-On briefly drives HIGH before it's initialized low [STM32H745]

bnguy.1
Associate III

Immediately after power-on, but before my main gets to initializing the GPIOs (HAL_GPIO_Init

GPIOX->MODER = 1 // Output Push Pull

GPIOX->BSRR = 0 // Set Pin Low

GPIOX->OTYPER = 10U // Output

GPIOX ->PUPDR = 2U // Pulldown

)

I see the pins (ex. PJ2,PJ3, etc) briefly drive high for about 60ms. There is an external strong pull-down, so it's not tristate.

I would expect all pins to be Input/Tristate, or at least according to the datasheet "Analog Function Mode".. but not drive high as this could be dangerous.

I've tried initializing the registers in different order, and as early as possible in main.c yet no luck.

What am I doing wrong that is causing the chip to drive uninitialized pins?

0693W00000GWPSIQA5.png

3 REPLIES 3
TDK
Guru

> I see the pins (ex. PJ2,PJ3, etc) briefly drive high for about 60ms. 

You're saying ALL gpio pins are driving high after reset? Or just specifically PJ2/PJ3?

Debug the project, and set an immediate breakpoint at Reset_Handler to verify GPIO registers are as expected and outputs are as expected.

If you feel a post has answered your question, please click "Accept as Solution".
bnguy.1
Associate III

The Reset_Handler in startup_stm32h745xihx.s looks correct, for example all GPIOJ registers show values 0xFFFFFFFF.

I don't have access to many of the pins, but interestingly with the CPU paused at Reset_Handler, some pins are low (ex. PJ3) yet others are High (PJ2).

If the register indicate the pins are in high impedance analog mode, the pins are probably in high impedance analog mode. You would need an external resistor to force them high or low.

These are mature chips, there's unlikely to be showstopper problems like this in the silicon. Doubly so if the pins behave as expected when configured as GPIO outputs. Much more likely the problem is in your code or hardware. Revisit assumptions, recheck hardware.

If you feel a post has answered your question, please click "Accept as Solution".