2 posts / 0 new
Last post
point85
Offline
Last seen: 4 days 12 hours ago
Joined: 2018-06-29 15:31
Sleep current in hibernate

Hi, 

 

I have been doing some testing with the hibernation function on the DA14682 and the DA14681.

 

I have been using the ble-adv example as specified in the power measurement document. I have changed the sleep mode to "pm_mode_hibernation".

 

I am measuring a current of around 192uA when the device is in hibernate on a DA14681 basic dev kit.

 

On our production PCB with a DA14682 I am measuring a sleep current of about 200uA.

 

It appears to me that something isn't going to sleep fully, the flash maybe? Any ideas?

 

Thanks in advance.

Device: 
PM_Dialog
Offline
Last seen: 8 hours 46 min ago
Staff
Joined: 2018-02-08 11:03
Hi point85,

Hi point85,

In general, in order to put the system into hibernation mode you should make sure that :

  1. All the tasks are in IDLE state
  2. No intensive write flash operations
  3. Timers are in IDLE state
  4. No interrupt activity (for example put the sensors in sleep / power down mode )
  5. The debugger should not be attached

Any of the above statements will prevent the system to hibernate and as a result a cold boot will take place. You can do the following modifications in ble_peripheral_task.c of ble_peripheral example. 

1. Set up an OS_TIMER() in order to stop advertising after 15 seconds:

PRIVILEGED_DATA static OS_TIMER hiberbation_timer;

static void hiberbation_timer_cb(OS_TIMER timer)
{
        ble_gap_adv_stop();
}

2. Start the timer in ble_peripheral_task:

/* create timer for going into hibernation after 15sec*/
hiberbation_timer = OS_TIMER_CREATE("hibernate", OS_MS_2_TICKS(15000), OS_TIMER_FAIL,
                                                (void *) OS_GET_CURRENT_TASK(), hiberbation_timer_cb);
        
OS_ASSERT(hiberbation_timer);
OS_TIMER_START(hiberbation_timer, OS_TIMER_FOREVER);

3. Upon the timer expiration, the advertising will stop, so the handle_evt_gap_adv_completed() will be triggered and the system will go into hibernation.

static void handle_evt_gap_adv_completed(ble_evt_gap_adv_completed_t *evt)
{
        ble_reset();
        hw_cpm_trigger_sw_cursor();
        pm_set_sleep_mode(pm_mode_hibernation);
}

Thanks, PM_Dialog