cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB55 EXTI + BLE Low power

MichalPesko
Associate III

Hello,

I am using STM32WB55CEU6, when using EXTI callback with BLE and LPM enabled, the MCU never enters the desired STOP2 power mode. The callback triggers every 20 seconds and is used to set a task by calling  UTIL_SEQ_SetTask(...).

When a virtual timer is used (no EXTI callback) to set the task, MCU enters STOP2 when there is nothing to do, as expected.

Is the EXTI callback behavior an expected behavior (does EXTI break the LPM)? Is this a consequence of the sequencer being not re-entrant?

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
EPASZ.1
ST Employee

If by 'not recommended', you are referring to the slide ~ 2:40, then this clearly concerns only stack functions like the aci_gat... function shown there. Otherwise, you'd be sending multiple (maybe contradicting) commands to the stack. Other generic code can be executed here without issues. It just should be kept as short as possible - this is true in general for interrupts.

From an interrupt, the code returns to the place where it was interrupted - so in this case, it would be to the active task which was run before the interrupt.

View solution in original post

8 REPLIES 8
liaifat85
Senior III

When an EXTI interrupt occurs, it will wake up the MCU from STOP2 mode. If the EXTI interrupt happens every 20 seconds, this frequent wake-up can prevent the MCU from entering or staying in STOP2 mode for longer periods. Keep the EXTI ISR as short as possible. Consider deferring non-critical work to the main loop or a lower-priority task to allow the MCU to return to low-power mode more quickly. You can also consider using STM32WLE5CC instead and see a comparative result. STM32WLE5CC long-range wireless and ultra-low-power devices embed a powerful and ultra-low-power LPWAN-compliant radio solution, enabling the following modulations: LoRa®, (G)FSK, (G)MSK, and BPSK.

https://www.st.com/en/microcontrollers-microprocessors/stm32wle5cc.html

https://www.pcbway.com/project/shareproject/STM32WLE5CC_LoRaWAN_Sensor_Logger_aadebc34.html

 

Waking up every 20 seconds is what I actually want. The problem is that the MCU never enters STOP2 when using EXTI Callback. That is why I suspect that the EXTI Callback compromises the LPM.

I need to wake up on a sensor FIFO-full-interrupt-trigger that happens roughly every 20 seconds.

EPASZ.1
ST Employee

There shouldn't be any issue in this regard.

I'd suggest starting from one of the BLE examples. E.g. here I'm using the BLE_Beacon project. By default, the user buttons are set so that I can wake up the MCU and I added a simple code to switch between STOP and SLEEP modes. This is the resulting power consumption. 

EPASZ1_0-1719490847443.png

 

Even in ST´s video, using EXTI on STM32WB55 is not recommended, why is that? https://www.youtube.com/watch?v=Zgw3wRpGSRQ&list=PLnMKNibPkDnG9JRe2fbOOpVpWY7E4WbJ-&index=17

I got the low power with EXTI working by resetting the power for the board after uploading firmware, resetting the MCU was for some reason not enough. Now I am getting the same current consumption as with the timerserver setting the task.

 

If a task gets interrupted by the EXTI interrupt, does the code return to that task after the ISR is finished, or does it jump to the next task?

EPASZ.1
ST Employee

If by 'not recommended', you are referring to the slide ~ 2:40, then this clearly concerns only stack functions like the aci_gat... function shown there. Otherwise, you'd be sending multiple (maybe contradicting) commands to the stack. Other generic code can be executed here without issues. It just should be kept as short as possible - this is true in general for interrupts.

From an interrupt, the code returns to the place where it was interrupted - so in this case, it would be to the active task which was run before the interrupt.

Hi, the "simple code to switch between STOP and SLEEP modes" is not in the source files (stack 1.20.0).

Could you provide us ?

You can insert the following code e.g. into the APP_BLE_Key_Button3_Action in app_ble.c:

if (UTIL_LPM_GetMode() == UTIL_LPM_STOPMODE) UTIL_LPM_SetStopMode(1 << CFG_LPM_APP, UTIL_LPM_DISABLE);
else UTIL_LPM_SetStopMode(1 << CFG_LPM_APP, UTIL_LPM_ENABLE);