Skip to main content
JWieb
Associate III
December 17, 2021
Solved

STM32WB55 LPTIM PWM from LSE appears broken.

  • December 17, 2021
  • 2 replies
  • 968 views

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?

This topic has been closed for replies.
Best answer by Peter BENSCH

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

2 replies

Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
December 17, 2021

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

In order 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.
JWieb
JWiebAuthor
Associate III
December 20, 2021

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?