cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 BLE and LPM

MahmoudAhmed11
Associate II

Hello,

I am using p-nucleo-wb55. I have a code with an RTC alarm interrupt triggered every 5 seconds. In the ISR, I set a sequencer task that sends a message via BLE. I have enabled the LPM as I want the MCU to enter sleep mode while it isn't working and only wakeup with the RTC alarm. I realized that the MCU doesn't stay in the sleep mode and when I debug, I realized that it wakes up so fast as the IPCC RX Interrupt is triggered continuously with high frequency.
How can I control this, knowing that I don't need the MCU to do any task through those 5 seconds, I just want it to sleep and wakeup only after 5 seconds.

Thanks in advance

7 REPLIES 7
STTwo-32
ST Employee

Ahlin @MahmoudAhmed11 and welcome to the ST Community.

Could you try to disable the IPCC RX Interrupt and all unnecessary interrupts before entering the Sleep mode and reenable them directly after the wake-up. 

Best Regards.

STTwo-32

 

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.

MahmoudAhmed11
Associate II

Ahlin @STTwo-32 , thanks for your reply.
If you mean trying HAL_NVIC_DisableIRQ(IPCC_C1_RX_IRQn); before entering the sleep mode and HAL_NVIC_EnableIRQ(IPCC_C1_RX_IRQn); after it.
Yes, I tried that, and for some reason, the code enters hard fault ISR and gets stuck in the while(1) at some point. I have asked an AI if this solution is possible, and he replies that it isn't possible as disabling it will break BLE Stack operations, and in fact, it doesn't just affect the BLE, it makes the whole application stuck.

STTwo-32
ST Employee

Hello @MahmoudAhmed11 

Could you try to use to tasks one is the sending task, and the other one is the IDLE task that take the system to sleep mode when there is no transmission. and for the 5 seconds interval, you may use a HW timer. More details are available on the AN5289;

Best Regards.

STTwo-32

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.

MahmoudAhmed11
Associate II

@STTwo-32 

Yes, I made only one task that is triggered from the ISR that happens every 5 seconds, and since there aren't any other tasks, the sequencer enters the stop mode. The problem is that it wakes up quickly due to the IPCC RX interrupt.

FilipKremen
ST Employee

Hello,

would it be possible to share the project?

Thank you.

Best regards,

Filip Kremen

MahmoudAhmed11
Associate II

Hello @FilipKremen 
Thanks for your message.
Unfortunately, I can't share the project as it's confidential.
But if you can make a simple example that sends dummy data via BLE every 1 minute and enters sleep mode and never wakes up unless the minute is finished, this will be very helpful, and I will really appreciate that.
I think I can compare it with my project to understand the problem or consider it as a template.
Also, I will try to communicate with the client and ask him if he doesn't mind if I share the project with you.
Thanks for your consideration.

Best Regards,

Mahmoud A.

FilipKremen
ST Employee

Hello,

I apologize for late reply due to my vacation.

Can you please visit this topic on ST community?

Sending sensor data via BLE - Page 2 - STMicroelectronics Community

It's similar to your needs and there is attached project.

After certain interval, RTC wakes up the MCU and the data from sensor are read and sent via BLE.

You can set the sleep mode by disabling stop and standby mode. More information can be found here.

How to build wireless applications with STM32WB MCUs - Application note

UTIL_LPM_SetOffMode(1 << CFG_LPM_APP_BLE, UTIL_LPM_DISABLE); UTIL_LPM_SetStopMode(1 << CFG_LPM_APP_BLE, UTIL_LPM_DISABLE);

Also, please note that CFG_DEBUGGER_SUPPORTED must be set to 1 if you want to use the debugger in low power mode.

Please let me know, if you need further help.

 

Best regards,

Filip Kremen