2021-12-16 04:09 PM
I am trying to get my STM32WB5MM-DK to output a PWM from LPTIM1 clocked from LSE in STOP mode.
I created a fresh project with STM32SCUBEIDE selecting HSI clock for the main CPU and LSE clock for the LPTIM1.
Then in User Code 2 section i put the following:
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN); //Shutdown CPU2
HAL_LPTIM_PWM_Start(&hlptim1, 999, 499);//DIV2 = ~16.4HZ 50% Duty
HAL_Delay(500); //PWM can be seen on scope here
HAL_PWREx_EnterSTOP0Mode(PWR_STOPENTRY_WFI); //PWM stops
However when i get to the stop mode, the pwm signal stops... what am i doing wrong?
Solved! Go to Solution.
2021-12-17 01:25 AM
Of course, you have to be careful where you are clocking the LPTIM1 from. In the RM0434 you will find the note:
If the LPTIM is clocked by an oscillator available in Stop mode, LPTIM is functional and the interrupts cause the device to exit the Stop mode.
Regards
/Peter
2021-12-17 01:25 AM
Of course, you have to be careful where you are clocking the LPTIM1 from. In the RM0434 you will find the note:
If the LPTIM is clocked by an oscillator available in Stop mode, LPTIM is functional and the interrupts cause the device to exit the Stop mode.
Regards
/Peter
2021-12-20 12:37 PM
Hi Peter,
Thank you for the prompt reply. After playing with this for a bit my problem was the pesky SysTick. Simply adding:
HAL_SuspendTick();
Fixed my issue.
However I do find it weird that the PWM of LPTIM1 would stop from this. Perhaps a hard fault was being generated?