2026-04-12 11:17 PM
This is in relation to post "Strange behavior with STM32G474QE pin PB4(Solved: Re: Strange behaviour with STM32G474QE pin PB4 - STMicroelectronics Community)"
I'm facing the issue of PB4 going high for 27ms approx after MCU reset. My design is freezed, And this pin is connected to a relay which turns ON when this pin goes high. The relay turn on time is 7.5ms. Is there a solution in code initialization so that this pulse stays below 7.5ms. I'm attaching the waveform.
Solved! Go to Solution.
2026-04-15 3:29 AM - edited 2026-04-15 3:30 AM
Hello,
There is an internal pull-up activated during reset and the device you have (STM32G474) and according to the reference manual RM0440 belongs to the category 3:
which doesn't feature the option byte to disable that internal pull up.
So the internal pullup is internally hardwired in your device (category 3). Not possible to deactivate it.
The 27ms duration you are seeing depends on the reset assert duration on NRST pin.
The internal pull-up resistor value is around 40K. The only thing I can suggest is to add an external pull down resistor to make a resistor divider on the GPIO output to compensate that voltage.
Meanwhile you need to make sure you calculate that resistor in a such a way the output voltage during the reset phase is lower than the VIHmin of your relay circuit activation.
Suppose the VIHmin of your circuit = 2V.
Vmax = Repd/(Ripu+Repd) * VDD < 2V
Where:
If you fix Vmax at 0.5V, after calculation you find Repd = 7K.
Conclusion: with these conditions, if you put a pull down resistor of 7K on PB4, you should have maximum level of 0.5V on the output which I think acceptable.
Hope that answers your question.
2026-04-13 6:44 AM
As discussed on the linked thread, use an external pulldown or a different pin. You cannot change the pin behavior at reset.
2026-04-15 3:29 AM - edited 2026-04-15 3:30 AM
Hello,
There is an internal pull-up activated during reset and the device you have (STM32G474) and according to the reference manual RM0440 belongs to the category 3:
which doesn't feature the option byte to disable that internal pull up.
So the internal pullup is internally hardwired in your device (category 3). Not possible to deactivate it.
The 27ms duration you are seeing depends on the reset assert duration on NRST pin.
The internal pull-up resistor value is around 40K. The only thing I can suggest is to add an external pull down resistor to make a resistor divider on the GPIO output to compensate that voltage.
Meanwhile you need to make sure you calculate that resistor in a such a way the output voltage during the reset phase is lower than the VIHmin of your relay circuit activation.
Suppose the VIHmin of your circuit = 2V.
Vmax = Repd/(Ripu+Repd) * VDD < 2V
Where:
If you fix Vmax at 0.5V, after calculation you find Repd = 7K.
Conclusion: with these conditions, if you put a pull down resistor of 7K on PB4, you should have maximum level of 0.5V on the output which I think acceptable.
Hope that answers your question.