How to handle BTM_LPM_STATE_LOW_POWER

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BeOl_4470266
Level 3
Level 3
25 replies posted 10 replies posted 10 sign-ins

Hello,

I am using a CYW4343W coupled with an STM32L4A6 and am using the BLE capabilities of the radio.

I have defined my own low power system, which enters SLEEP mode or STOP2 mode depending on what peripherals are currently being used.

I have defined functions that are called from platform_mcu_powersave_enable and platform_mcu_powersave_disable which allows me to know when the app would allow to enter STOP mode.

The system works fine until I integrate the BLE stack with my application. I have noticed from the demo that `BTM_LPM_STATE_LOW_POWER` leads to a call to platform_mcu_powersave_enable, but I am struggling to identify the matching call to platform_mcu_powersave_disable. Can anybody point me to where it is, and how this BTM_LPM_STATE_LOW_POWER works?

Has anybody worked with the STOP mode and Wiced, and knows how to handle this situation?

What I notice is that, after a few minutes, there has been more calls to platform_mcu_powersave_enable than there were calls to platform_mcu_powersave_disable which would make it possible to enter STOP mode when one of my thread required not to (using DMA for instance). The BLE stack appears to be what makes this extra call.

Thanks for your help

0 Likes
1 Solution

Hello - Bluetooth stack doesn't directly call any of the platform power save APIs. Mostly the platform power save API call should be in the platform driver code for your MCU (STM32L4A6).  Bluetooth stack for UART only calls wiced_uart_* APIs defined in wiced_platform_common.c file I believe.

Have you investigated your app and platform driver to confirm that they are not calling platform_mcu_powersave_disable call?

View solution in original post

8 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi BeOl_4470266 ,

Hope you are using WICED SDK .

To enable / disable BT low power, you have to use API wiced_bt_dev_set_low_power_mode. Please refer to the examples in :

- /43xxx_Wi-Fi/apps/demo/ble_wifi_introducer

- /43xxx_Wi-Fi/apps/snip/bluetooth/ble_hello_sensor

Regards,

Anjana

0 Likes

Hi,

Thanks for your answer.

I am indeed using latest WICED SDK.

I have checked the demo and snip you mentioned: the only reference to wiced_bt_dev_set_low_power_mode is to disable the low power, which might suggest it's enabled by default, when a call to wiced_bt_dev_set_low_power_mode(false) is made.

What was the part you wanted me to check in those demos?

However the BT stack keeps making a call to platform_mcu_powersave_disable due to the UART interface constently being used, even if no advertisement nor scans are active.

I have tried to call wiced_bt_dev_set_low_power_mode(true) which returns successfully but the BT Stack still prevents my MCU to use the lower power mode due to its calls to platform_mcu_powersave_disable.

Can you please advise?

Thanks

0 Likes

To debug this further you could print the return address in platform_mcu_powersave_disable and platform_mcu_powersave_enable. I would think that for most cases every disable, there would be a corresponding enable in the same function. If they don't then that would be useful info and can lead to more pointed debug.

Thanks,

Venkat

PS: I have experience of taking several products from prototype to production with WICED. I am available for consulting work and you can reach me at
contact@packetp.com

0 Likes

Discussion going on here: BT stack Memory leak

0 Likes

AnjanaM_61 wrote:

Discussion going on here: BT stack Memory leak

Please don't encourage people to hijack that discussion thread which is totally off-topic from the subject.

0 Likes

Hi AxLi_1746341 ,

Sorry if it added confusion.

However the last few discussion in thread BT stack Memory leak was specific to this thread topic. And since that responses are relevant I added the reference as per internal discussion.

We will make sure avoiding such confusions or mixing up of topics.

Thanks & Regards,
Anjana

0 Likes

AnjanaM_61

Actuall, the reason why the discussion appears in other thread is no response in this thread.

Since you already notice this issue.

I'm wondering why there is still no answer from cypress regarding this topic.

You can just tell the people the expect behavior rather than let people to

trace if the closed source library calls platform_mcu_powersave_disable or not.

(At least to clarify it's expected behavior or some kind of bug)

0 Likes

Hello - Bluetooth stack doesn't directly call any of the platform power save APIs. Mostly the platform power save API call should be in the platform driver code for your MCU (STM32L4A6).  Bluetooth stack for UART only calls wiced_uart_* APIs defined in wiced_platform_common.c file I believe.

Have you investigated your app and platform driver to confirm that they are not calling platform_mcu_powersave_disable call?