cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 keep pin high in StandBy mode?

misiael
Associate
Posted on November 03, 2017 at 17:53

Hi,

I work on design with STM32L452RET6P and I'm considering power managment. I've got some voltage regulators that needs high voltage on SHDN pin and i want to use GPIO to keep this regulators on. I have read datasheet, and i found information that in StadBy I/Os can be configured with internal pull-up, pull-down or floating. My question is: Is it enough to configure pin, pull-up,out, and set high before entry to Standby to keep this pin high during StandBy? 

Thank you for understending but i must be sure before design PCB. 

Best regards,

Micha?

#stm32l4 #standby
3 REPLIES 3
Szymon PANECKI
Senior III
Posted on November 03, 2017 at 18:11

Hello Michal,

Thanks for your interest in STM32L4 MCUs. This is correct that in Standby mode devices from L4 series can keep internal pull-up/down resistors active for I/O pins. 

Regarding the steps, which you need to do in order to have pull-up or pull-down active in Standby mode, please find below the minimum code based on HAL:

HAL_PWREx_EnableGPIOPullUp(PWR_GPIO_A, GPIO_PIN_2); 

HAL_PWREx_EnablePullUpPullDownConfig();

HAL_PWR_EnterSTANDBYMode();

WIth above code you will configure pull-up for PA2, enable keeping this setting in Standby mode and finally enter Standby mode. No additional configuration of the pin is required.

Regards

Szymon

Mark Shoe
Senior
Posted on March 08, 2018 at 13:55

Bug found in STM32Cube_FW_L4_V1.11.0

The function HAL_PWREx_EnableGPIOPullUp set the bit for pull up and one line later is clears the pulldown register

SET_BIT(PWR->PUCRA, (GPIONumber & (~(PWR_GPIO_BIT_14))));

CLEAR_BIT(PWR->PDCRA, (GPIONumber & (~(PWR_GPIO_BIT_13|PWR_GPIO_BIT_15))));

There might be something wrong with the 

CLEAR_BIT construction, only SET_BIT(PWR->PUCRA, GPIO_PIN_0);

 did work for me.
Posted on March 08, 2018 at 17:43

Thanks Szymon for the explanation.

Does it matter if the IO was configured as output before going to standby/shutdown ?

In other word, are the CR3_APC and PUCRX/PDCRX settings only used in standby/shutdown or do we need to 'prepare' the pins (setting them as input) before using the HAL_PWREx_EnableGPIOPullUp() API ?

Cheers,

Vincent