3 Replies Latest reply on Oct 14, 2020 11:41 PM by VeSu_1779701

    How to handle BTM_LPM_STATE_LOW_POWER

    BeOl_4470266

      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

        • 1. Re: How to handle BTM_LPM_STATE_LOW_POWER
          AnjanaM_61

          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

          • 2. Re: How to handle BTM_LPM_STATE_LOW_POWER
            BeOl_4470266

            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

             

            • 3. Re: How to handle BTM_LPM_STATE_LOW_POWER
              VeSu_1779701

              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