cancel
Showing results for 
Search instead for 
Did you mean: 

Studio Bluetooth

JeHu_3414236
Contributor II

I am doing repeated BLE scan/stop scan and after around 10 times I will stop getting the sleep callback.  I am not doing any more BLE actions at this time.  What is preventing this from happening?  This is my sleep config:

    sleep_config.sleep_mode             = WICED_SLEEP_MODE_NO_TRANSPORT;

    sleep_config.device_wake_gpio_num   = WICED_P07;

    sleep_config.device_wake_mode       = WICED_SLEEP_WAKE_ACTIVE_HIGH;

    sleep_config.device_wake_source     = WICED_SLEEP_WAKE_SOURCE_GPIO;

    sleep_config.host_wake_mode         = WICED_SLEEP_WAKE_ACTIVE_HIGH;

This is my sleep handler.  I check 2 pins are low before I allow sleep:

uint32_t sleep_handler(wiced_sleep_poll_type_t type )

{

    uint32_t ret = WICED_SLEEP_NOT_ALLOWED;

    switch(type)

    {

        case WICED_SLEEP_POLL_SLEEP_PERMISSION:

            if ((wiced_hal_gpio_get_pin_input_status(WICED_P07) == 0) &&

                (wiced_hal_gpio_get_pin_input_status(WICED_P08) == 0))

            {

                ret = WICED_SLEEP_ALLOWED_WITHOUT_SHUTDOWN;

            }

            break;

        case WICED_SLEEP_POLL_TIME_TO_SLEEP:

            if ((wiced_hal_gpio_get_pin_input_status(WICED_P07) == 0) &&

                (wiced_hal_gpio_get_pin_input_status(WICED_P08) == 0))

            {

                ret = WICED_SLEEP_MAX_TIME_TO_SLEEP;

            }

            else

                ret = 0;

            break;

    }

    return ret;

}

If I don't get the sleep callback, does it mean it is not going to sleep anymore?  I still get GPIO interrupts but no sleep callback after processing is done. 

7 Replies
AbhishekK_31
Employee

From your code it looks like you are trying to enter PDS mode. The only sure way to check if the device has entered PDS mode is to measure the current.

The power management unit will keep asking for permission to sleep from the application and other internal modules. Once all the modules including you application allows it to sleep, the application won't get any callbacks until the device wakes up again

So let's say you are doing ADV with 1 second interval then the device will keep waking up every 1 second to do the ADV and ask for permission to sleep again. In this scenario you will get callbacks at approximately 1 second interval. If the ADV stops now, the device will go to sleep and won't wake up as there is no ADV packets to send. Similar logic applies while connected to another device.

So you need to check the current levels to know if your device is entering PDS or not

Refer to the CYW20706 and CYW20719 Low-Power Modes for more details

JeHu_3414236
Contributor II

Why do I not get any callbacks after I wake up by GPIO interrupt? I have

to use hardware reset to get sleep mode working again. Something in the BT

ROM is blocking sleep mode. I stopped all BT activity from my application

already.

0 Likes
JeHu_3414236
Contributor II

I made a test program to work on Q40EVB based on the sample app low_power_sensor.  It will print debug to PUART.  I see the same problem.  Press SW3 to start BLE scanning.  When scan times out after 35s, press SW3 to start again.  After a few timeouts I will see sleep stop working.  I verified by measuring the current.  During sleep and no scan it is 40uA.  During scan it is 4mA.  When sleep stops working, it is 3.5mA when no scanning and 5.5mA when scanning.

0 Likes
JeHu_3414236
Contributor II

This problem was fixed by getting a ROM patch from some Cypress developer in USA.  Nobody from Cypress who supports this forum apparently handles ROM patches or knows what has been fixed in patches or else this problem would have been solved immediately instead of almost 1 month.  Sleep mode is completely broken with the patch released with WICED Studio 6.2.1.2.  I still don't know what the patch I received does besides fix my sleep problem.  There are no release notes or known issues list even after I asked for it.  To people who are using 20719 where are you getting support for it?  I am using the chip only, not a module.

0 Likes
MichaelF_56
Moderator
Moderator

Unfortunately, ROM Patches are not normally distributed via the community.  If a ROM patch is needed, one can always reach out to their local distributor/Cypress Sales & FAE team and they can provide the patch (if available) directly.

0 Likes
SuSo_1702516
New Contributor II

Have you received ROM patches from your Cypress local team directly or someone in Cypress? If so, could you help to let me know the name you contacted? I have the same issue but it takes time for my local support team to find this patch. If you mind it to write here, please email me (sunnys@uniquest.co.kr). Thanks in advance.

0 Likes
NeDh_4602711
Contributor II

Hello

I am having same problem. can you share ROM patch on (neeraj@iotiansglobal.com).

Thanks in advance.

Thank you .

Regards,

Neeraj

0 Likes