Skip to main content
PPrei
Associate
May 20, 2024
Question

STM32WB eddystone and sleep

  • May 20, 2024
  • 6 replies
  • 2144 views

I would like to use STM32WB (NUCLEO-WB55) with eddystone and sleep periodically.

I find examples about beacon and about power low mode but it's not easy merge them.

I'm looking for an example.

Thank you

Paolo Preioni

6 replies

STTwo-32
Technical Moderator
June 12, 2024

Hello @PPrei 

This example may help you on your project. Also, referring to this Wiki will be a good idea to understand how it works.

Best Regards.

STTwo-32

 

Graduate
August 6, 2025

The cited example shows continuous packet transmission. What would be needed is a function to stop transmission and a deinit before activating sleep. Upon waking, the system will then proceed with a new init and new transmission. How should the stop function be implemented? Thanks.

FilipKremen
ST Employee
August 6, 2025

Hello,

please check this topic as it may be helpful for you.

STM32WB55 BLE and LPM - STMicroelectronics Community

For using low power mode, you just have to enable it in app_conf.h file #define CFG_LPM_SUPPORTED 1.

The sequencer will automatically enter low power mode if there are no pending tasks.

Regarding the stop function, you could use a timer server which would periodically start advertising.

Best regards,

ST support

 

Graduate
August 7, 2025

@FilipKremen and thanks for your answer.

I read the suggested post (and also replied to it) and set CFG_LPM_SUPPORTED to 1.
However, it still doesn't work.
If I set "BT SIG Beacon" = disabled in the STM32CubeMX (because I only want to transmit data using the advertiser's manufacture-specific data), I have no problem putting the microcontroller to sleep and stopping the transmission of BLE packets, then waking it up and starting the cycle again.
On the other hand, when I set "BT SIG Beacon" = EDDYSTONE_TLM_BEACON, I have problems.
When the microcontroller goes to sleep, the sniffer continuously detects packet transmission. Furthermore, I can't wake the microcontroller from sleep.

Best regards

FilipKremen
ST Employee
August 7, 2025

Hello,

can you please send me your project?

Thank you.

Best regards,

Filip Kremen

Graduate
August 7, 2025

Hello.

Sorry, but I cannot disclose the project due to confidentiality.

FilipKremen
ST Employee
August 7, 2025

Do you use sequencer with low power manager, or do you have your own solution?

What is your current consumption requirement? Do you have any power consumption waveform to share?

Best regards,

Filip Kremen

 

Graduate
August 7, 2025

What exactly do you mean by "sequencer with low power manager"?
The current requirement is, of course, as low as possible. I don't have waveforms; our customer performed all these measurements directly.

Graduate
August 7, 2025

If you mean the "sequencer" entry in stm32cubeMX, this is enabled.

FilipKremen
ST Employee
August 7, 2025

Please read this Wiki page below for more information about sequencer.

Utility:Sequencer - stm32mcu

For the low power manager please visit section 4.6 in AN.

How to build wireless applications with STM32WB MCUs - Application note

I'm attaching the Beacon example with stop mode enabled.

Please let me know if it works on your side, you can see the current consumption of this application below.

Also, before measurement please remove JP2 and everything from JP5.

beaconstop.png

Best regards,

Filip Kremen

Graduate
August 8, 2025

Thak you @FilipKremen.

I understand what the example code you provided does. But that's not what I want to do.
I want the microcontroller to go to sleep for a certain amount of time (a few dozen minutes) after performing certain operations (acquisition of quantities, updating the EddystoneTLM_InitStruct structure for transmission with the Eddystone TLM protocol). To put the microcontroller to sleep, I use the following sequence:

HAL_LPTIM_Counter_Start_IT(&hlptim1, hlptim_prescaler);

HAL_SuspendTick();
HAL_NVIC_DisableIRQ(RTC_WKUP_IRQn);
HAL_NVIC_DisableIRQ(IPCC_C1_RX_IRQn);
HAL_NVIC_DisableIRQ(IPCC_C1_TX_IRQn);
HAL_NVIC_DisableIRQ(HSEM_IRQn);
HAL_PWREx_EnterSTOP2Mode(PWR_SLEEPENTRY_WFI);

Upon waking up:

HAL_LPTIM_Counter_Stop_IT(&hlptim1);
HAL_NVIC_EnableIRQ(IPCC_C1_RX_IRQn);
HAL_NVIC_EnableIRQ(IPCC_C1_TX_IRQn);
HAL_NVIC_EnableIRQ(HSEM_IRQn);
HAL_InitTick(TICK_INT_PRIORITY);
HAL_ResumeTick();

Everything works correctly: data transmission, the microcontroller in sleep, and waking up.
The problem is that even when the microcontroller is in sleep, I can still detect some transmission activity from my device using the sniffer (I haven't been able to identify what type of transmission it is).

This is a big problem because I'm consuming power (due to this activity) even when the microcontroller is asleep. Apparently, part of the firmware (stack) residing on CPU2 continues to send BLE packets. How can I stop this activity?

FilipKremen
ST Employee
August 12, 2025

Hello,

stop mode 2 is the deepest mode when RF can be still active. For your case, the standby mode could be more suitable. As I mentioned before, it's not necessary to do anything about entering low power mode, the sequencer will automatically enter the chosen low power mode. Please read this document for more information.

How to build wireless applications with STM32WB MCUs - Application note

I also recommend reading this topic as it could be very helpful for your application. (You can find there an example with standby mode)

Solved: Problem with entering standby mode in STM32WB55 wh... - STMicroelectronics Community

Best regards,

Filip Kremen