cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 LPTIM PWM from LSE appears broken.

JWieb
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

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.

View solution in original post

2 REPLIES 2
Peter BENSCH
ST Employee

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
Associate III

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?