20719 stops entering sleep mode

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

cross mob
JeHu_3414236
Level 5
Level 5
10 likes received First like received

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