2025-05-05 4:53 AM - edited 2025-05-05 4:55 AM
Hi
I was here with a timer question not long ago, and everything seemed solved. https://community.st.com/t5/stm32-mcus-wireless/timer-tim2-does-not-work-when-ble-is-initialized-in-stm32wb55/m-p/794896#M24405
I am working on a custom device, but I made a demo version for the nucleo board to share the project.
Respected @FilipKremen helped me then. Also, when regenerating the project with entering standby mode, everything crashed, and for many days, I couldn't find what the problem was because most of the files seemed to be identical. And now I added the functionality with the standby mode to the project with the timer example, and I was able to trace the problem.
If I activate #define CFG_LPM_SUPPORTED 1, entering standby mode on a long press of button 1 works, but the timer doesn't start at the initialization.
At the same time, if CFG_LPM_SUPPORTED is 0, the timer works fine, but entering standby mode does not work.
Is this a bug, or am I missing something? Please help me
I am attaching a project for the Nucleo board
Solved! Go to Solution.
2025-05-06 6:47 AM
Hello,
in this case, I would recommend using timer servers as mentioned in this application note.
How to build wireless applications with STM32WB MCUs - Application note (4.5)
You could take an inspiration from BLE_HeartRate example where HW_TS is used for periodic measurement.
Please don't hesitate to ask further.
Best regards,
ST support
2025-05-06 1:23 AM
Hello,
when you set CFG_LPM_SUPPORTED 0, it will disable the low power manager. This function below is called when there are no pending tasks and since the LP manager is disabled, it won't enter standby mode.
void UTIL_SEQ_Idle(void)
{
#if (CFG_LPM_SUPPORTED == 1)
UTIL_LPM_EnterLowPower();
#endif /* CFG_LPM_SUPPORTED == 1 */
return;
}
TIM2 is clocked by SYSCLK (APB1) and SYSCLK source clock is HSE which is turned off during stop 2 mode and this will introduce delay to the LED blinking. (you can try to set Prescaler = 31999 and Period = 2 and you will see it works, however with delay)
Best regards,
ST support
2025-05-06 6:35 AM
Hello
Thank you for your reply. The LED is indeed blinking about once every half a second, but I use the LED for indication and clarity. What I really need to do is put a task on this timer that will run very fast. Is there any way to do this while still being able to go to standby?
2025-05-06 6:47 AM
Hello,
in this case, I would recommend using timer servers as mentioned in this application note.
How to build wireless applications with STM32WB MCUs - Application note (4.5)
You could take an inspiration from BLE_HeartRate example where HW_TS is used for periodic measurement.
Please don't hesitate to ask further.
Best regards,
ST support
2025-05-06 7:40 AM
Thanks for the reply
What if I have another timer that drives the passive buzzer with some sort of PWM? Do I need to try to transfer it to HW_TS too? Maybe I can somehow call UTIL_LPM_EnterLowPower(); manually when entering standby (perhaps after stopping all timers manually?), and then the timers will work in regular mode? Or is it not recommended to do that?
2025-05-07 3:52 AM
Hello,
for using PWM, you could try the LP timer which runs in all LP modes except for standby mode.
Please have a look here in section 27.
It's not necessary to call UTIL_LPM_EnterLowPower(), the sequencer does it automatically.
Best regards,
ST support
2025-05-07 6:29 AM
Hello.
Thank you, I will try to do that.
I just discovered another unpleasant thing. When CFG_LPM_SUPPORTED is activated and I try to do what you told me to do in this thread https://community.st.com/t5/stm32-mcus-wireless/turning-ble-on-and-off-in-stm32wb55/td-p/795553 (not to use appe_Tl_Init() to not enable BLE immediately), nothing works. I saw that MX_APPE_Init(); and the following functions after it are executed without errors, but then my debugger crashes. You can see this behavior in my project by commenting out appe_Tl_Init(). How can I fix this problem?
2025-05-12 2:19 AM
Maybe I should start a new thread?
2025-05-12 2:19 AM
Hello,
I regenerated the project and it works fine on my side.
Can you please try to generate the code again and set CFG_LPM_SUPPORTED 1 again?
Thank you.
Best regards,
ST support
2025-05-12 3:34 AM
Hmm, yeah, it's working now. Thank you very much! Now, as far as I understand, if I want to go into standby on a long press of the SW1 button, I should call Trig_Go_standby(); without Trig_BLE_exit();? But if I do that, I get an error. If no BLE has been enabled, can't I go to standby?
Sorry, I'm probably annoying with all these questions.