2024-05-21 07:51 AM
Hello,
I'm developing an application on the NUCLEO-U5A5ZJ-Q. I need some pins to stay high while the microcontroller is in Stop3 mode.
The Datasheet suggests to use internal pull ups, because the GPIO peripheral is not active in Stop3 mode. For this reason, I have configured the GPIO as input and with internal pull-up before entering Stop3 mode.
I've used the following functions:
LL_GPIO_SetPinPull(GPIOC, LL_GPIO_PIN_6, GPIO_PULLUP);
LL_GPIO_SetPinMode(GPIOC, LL_GPIO_PIN_6, LL_GPIO_MODE_INPUT);
It works and the pin stays high. However, whenever the microcontroller go into Stop3 mode, the GPIO voltage goes to zero.
Any Idea? Am I missing something?
Thank you in Advance
Solved! Go to Solution.
2024-05-21 09:49 AM
Hello @gianmarco.cerutti,
Please check whether the APC bit in the PWR_APCR register is set! According to RM, the I/O state in stop3 mode is determined by this bit
If the APC bit is set, the I/Os can be configured either with a pull-up (see PWR_PUCRx registers), or with a pull-down (see PWR_PDCRx registers), or can be kept in an analog state if none of the PWR_PUCRx or PWR_PDCRx register is set.
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.
2024-05-21 09:49 AM
Hello @gianmarco.cerutti,
Please check whether the APC bit in the PWR_APCR register is set! According to RM, the I/O state in stop3 mode is determined by this bit
If the APC bit is set, the I/Os can be configured either with a pull-up (see PWR_PUCRx registers), or with a pull-down (see PWR_PDCRx registers), or can be kept in an analog state if none of the PWR_PUCRx or PWR_PDCRx register is set.
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.
2024-05-22 02:12 AM
Thank you for your answer.
Yes the problem was not configuring the Pull Up through the PWR_PUCRx register but through the GPIO peripheral.
I write here a snippet of code that worked for me.
SET_BIT(PWR->APCR, PWR_APCR_APC);
HAL_PWREx_EnableGPIOPullUp(PWR_GPIO_C, GREEN_LED_Pin);
Best Regards
2024-06-27 02:25 PM - edited 2024-06-27 02:25 PM
From what I can tell this is the only way for a GPIO to remain SET when the core enters into STOP3 mode. Can anyone confirm?