2 Replies Latest reply on Jan 31, 2016 10:10 PM by BoonT_56

    Something wrong when I try to make the BLE go to sleep

    naturesphere

           I develop ble with BCM920736TAG_Q32 and WICED-Smart-SDK-2.2.1

       

           I add some code in the create function below:

      void xxx_create(void)

      {

           ......

        devlpm_init();

        devlpm_enableWakeFrom(DEV_LPM_WAKE_SOURCE_QUAD);

        devlpm_registerForLowPowerQueries(application_time_to_sleep_callback, 0);

        devlpm_registerForEarlyWakeNotification(application_time_wakeup_callback,NULL);

        }


      the application_time_to_sleep_callback function is:

      UINT32 application_time_to_sleep_callback(LowPowerModePollType type, UINT32 context)

      {

        switch(type)

        {

        case LOW_POWER_MODE_POLL_TYPE_SLEEP:

                 ble_trace0("LOW_POWER_MODE_POLL_TYPE_SLEEP");

                  return ~0;

        case LOW_POWER_MODE_POLL_TYPE_POWER_OFF:

                 ble_trace0("LOW_POWER_MODE_POLL_TYPE_POWER_OFF");

                  return 1;

        default:

                  return ~0;

        }

      }

      and the application_time_wakeup_callback function:

      INT32 application_time_wakeup_callback(void* arg)

      {

        BACKEY_TRACE("WAKING UP!");

        return 0;

      }

      when I run the program, the log keep showing:

       

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

      19:20:58 - LOW_POWER_MODE_POLL_TYPE_SLEEP

       

      When a puart interrupt comes, it stops showing  LOW_POWER_MODE_POLL_TYPE_SLEEP

      and never show it again! Does it means the chip never sleep? If the chip sleep, why it keep printing

      LOW_POWER_MODE_POLL_TYPE_SLEEP but not just print once? If it waked up, why application_time_wakeup_callback

      do not run?

      Because something difficult in my device, I just can not measure the current.