DA14680 restart itself after pm_set_sleep_mode(pm_mode_hibernation)

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
huiui
Offline
Last seen: 1 year 5 months ago
Joined: 2017-07-08 22:32
DA14680 restart itself after pm_set_sleep_mode(pm_mode_hibernation)

Hello,

 

I have found sometime DA14680 will restart itself after pm_set_sleep_mode(pm_mode_hibernation). The way I implement it is that there is a button on the board, and if button is clicked, it will run pm_set_sleep_mode(pm_mode_hibernation).

I am using a cunstom board. Strangly whether or not DA14680 will retart itself dpendens on situations, as summarized below.

 

DA14680 enter hibernation and not restart cases:

--Afer suota_initial_flash_jtag_win program . In this case, after  click button, it will stay in hibernate mode.

--Use J-link RTT viewer and do file->connect. It reset the board and after click button, it will stay in hibernate mode.

 

DA14680 enter hibernation and restart shortly after:

--After hardware restart(disconnect power supply and reconnect), if click button, DA14680 will restart itself and will not enter hibernate mode.

--After WKUP from hibernate mode, if click button, DA14680 also will restart itself and will not enter hibernate mode.

 

I am very confused how could this happen. Can you please give me some insights? Thank you very much!

 

 

Device: 
PM_Dialog
Offline
Last seen: 1 week 6 days ago
Staff
Joined: 2018-02-08 11:03
Hi huiui,

Hi huiui,

Can I ask which is the version of the DA1468x? Is it the DA14680/681 or DA14682/3? Additionally, are you using your own application code?

Generality, in order to put the system into hibernation mode you should make sure that you don't have any activity with the flash, the peripherals etc. To do so, you should take care that:

  • All the tasks are in IDLE state
  • No intensive write flash operations
  • Timers are in IDLE state
  • No interrupt activity (e.g. put the sensor in sleep / power down mode)

When the device exits from hibernation mode or the hibernation fails, a COLD BOOT takes place, which means that the application code is executed from the scratch (like a hardware reset).

Please find below some steps in order to put the system into hibernation using ble_peripheral example of the SDK. The changes should be applied in the ble_peripheral_task.c file:

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:

/* go 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, stop advertising. So that the handle_evt_gap_adv_completed() is triggered and the system will go into hibernation.

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

4. I don’t know which flash you are using, so make sure they you have the correct configuration.

Thanks, PM_Dialog