2018-11-02 12:13 PM
I've got some S/W running on the STM32L432KCU6 on a NUCLEO-L432KC and couldn't get it into stop mode, or at least it seemed to come out immediately so the next step was to try the NUCLEO-L432KC example programs PWR_STOP1_RTC and PWR_STOP2_RTC. Neither of these work and both display the same symptoms as my program. The PWR_STANDBY_RTC example works perfectly but power usage is much greater than suggested in the manual (measured at 320uA at JP1). Can anyone help getting the examples working? I'm using latest CubeMX and HAL libraries and SWSTM32 IDE
2018-11-02 09:28 PM
Hello peter,
Here i've shares few lines of codes that i have successfully tested on STM32L476, I think almost all the controllers have same things to follow with little changes.
Hope this will help you.
Huzaifah
if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
{
/* Clear Standby flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
/* Blink LED to indicate that the system was resumed from Standby mode */
HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
HAL_Delay(500);
HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
HAL_Delay(500);
}
/* Turn on LED3 */ //For testing purpose
HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
/* Insert 5 seconds delay */
HAL_Delay(5000);
/* The Following Wakeup sequence is highly recommended prior to each Standby mode entry
mainly when using more than one wakeup source this is to not miss any wakeup event.
- Disable all used wakeup sources,
- Clear all related wakeup flags,
- Re-enable all used wakeup sources,
- Enter the Standby mode.
*/
/* For power consumption's sake, appropriately configure the GPIO corresponding to
the wake-up pin, fill up the pull-down control register and set the APC bit. */
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStructure.Pin = Button_Pin;
GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
GPIO_InitStructure.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
HAL_PWREx_EnableGPIOPullDown(PWR_GPIO_A, PWR_GPIO_BIT_0);
HAL_PWREx_EnablePullUpPullDownConfig();
/* Disable used wakeup source: PWR_WAKEUP_PIN1 */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);
/* Clear all related wakeup flags */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* Enable wakeup pin WKUP1 */
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_HIGH);
/* Enter the Standby mode */
HAL_PWR_EnterSTANDBYMode();
2018-11-03 01:25 AM
Hi Huzaifah
Thanks for the code. I did get the standby mode example working but for my application I need STOP MODE 2 and the example program for that simply doesn't work as supplied in Cube