cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 pin PB4 stays high for 27ms approx, After reset and before making it low as GPIO

anand_mohan
Associate

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. 

1 ACCEPTED SOLUTION

Accepted Solutions
mƎALLEm
ST Employee

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:

mALLEm_1-1776248759526.png

which doesn't feature the option byte to disable that internal pull up. 

mALLEm_2-1776248884705.png

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:

  • Repd is the external pull down resistor to calculate
  • Ripu is the internal pull-up = 40K
  • Vmax the voltage you shouldn't exceed on PB4 to drive the relay.

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
TDK
Super User

As discussed on the linked thread, use an external pulldown or a different pin. You cannot change the pin behavior at reset.

If you feel a post has answered your question, please click "Accept as Solution".
mƎALLEm
ST Employee

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:

mALLEm_1-1776248759526.png

which doesn't feature the option byte to disable that internal pull up. 

mALLEm_2-1776248884705.png

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:

  • Repd is the external pull down resistor to calculate
  • Ripu is the internal pull-up = 40K
  • Vmax the voltage you shouldn't exceed on PB4 to drive the relay.

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.