# 4. Extended Sleep configuration¶

To configure DA14531 device to extended sleep mode without OTP copy, follow the steps mentioned below.

1. Open the proximity reporter project from: …projects/target_apps/ble_examples/prox_reporter/Keil_5
2. Open the file user_config.h which is under the user_config folder.
3. Set the app_default_sleep_mode variable to ARCH_EXT_SLEEP_ON as shown below.
const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;

1. Save and compile (f7) the project
2. Build the project by pressing the BUILD button or browse through Project -> Build Target
3. Connect a PRO DK 376-18-B motherboard to the PC. Make sure the daughter board of DA14531 is connected to the motherboard.
4. Press the Start DEBUG session button and press again on the same button. This it will stop the debug session and make the DA14531 running.
5. Open our SmartSnippets toolbox and click on Power Profiler (available from our web site Dialog Semiconductor Web Site.) to observe the BLE events and extended sleep.

To configure DA14531 device to extended sleep mode with OTP copy, follow the steps mentioned below.

1. Open the proximity reporter project from: …projects/target_apps/ble_examples/prox_reporter/Keil_5
2. Open the file user_config.h which is under the user_config folder.
3. Set the app_default_sleep_mode variable to ARCH_EXT_SLEEP_OTP_COPY_ON as shown below.
const static sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_OTP_COPY_ON;

1. To wake up the device from extended sleep, there are two trigger mechanism that can be implemented.
• Wake up from RTC Timer
• Wake up from Timer1
1. Save and compile (f7) the project
2. Connect a PRO DK 376-18-B motherboard to the PC. Make sure the daughter board of DA14531 is connected to the motherboard.
3. Open our SmartSnippets toolbox and click on Power Profiler (available from our web site Dialog Semiconductor Web Site.)
4. Program the OTP with the compiled Hex file (follow the steps here in chapter 12 OTP Programmer)
5. Once the OTP is programmed, observe the BLE events and extended sleep.

## 4.1. Measuring the extended sleep current¶

In order to measure the extended sleep current over a digital multimeter, increase the advertising interval in the proximity reporter project under user_config.h. Follow the steps mentioned below:

1. Open the file user_config.h which is under the user_config folder.
2. Change the .intv_max & .int_min variable (as shown below) to 5000 (=5 sec) of the advertise_configuration user_adv_conf structure in order to have a bigger advertising interval. This will give some time to measure the EXTENDED sleep current.
static const struct advertise_configuration user_adv_conf = {

.intv_min = MS_TO_BLESLOTS(5000),                    // 5000ms

.intv_max = MS_TO_BLESLOTS(5000),                    // 5000ms

1. To observe the extended sleep current for maximum time, change the default handlers configuration to advertise the device forever, by configuring .adv_scenario to DEF_ADV_FOREVER, as shown below,
/*
****************************************************************************************
*
* Default handlers configuration (applies only for @app_default_handlers.c)
*
****************************************************************************************
*/
static const struct default_handlers_configuration  user_default_hnd_conf = {
// Configure the advertise operation used by the default handlers
// Possible values:

// It is measured in timer units. Use MS_TO_TIMERUNITS macro to convert
// from milliseconds (ms) to timer units.
.advertise_period = MS_TO_TIMERUNITS(18000), //this is for 18s

// Configure the security start operation of the default handlers
// if the security is enabled (CFG_APP_SECURITY)
// Possible values:
//  - DEF_SEC_REQ_NEVER
//  - DEF_SEC_REQ_ON_CONNECT
.security_request_scenario = DEF_SEC_REQ_NEVER
};

1. Repeat the steps from the previous section, step 4 to step 8 (either with or without OTP copy).
2. Use a digital multimeter, connect the positive of multimeter to J9[4] and the negative to J9[3] of the motherboard, as shown in the figure below,

Figure 7 Extended sleep power measurement

1. Observe the extended sleep current value displayed in the meter. The typical numbers is mentioned below where the IBAT_LOW values are for the Boost mode and the IBAT_HIGH values are for Buck mode.

Figure 8 Extended sleep power numbers in buck and boost mode

1. To change to Boost mode, use the switch on the daughterboard and put it to L. On the motherboard, put the jumper on J4[1-2], as shown in sleep mode overview chapter.
2. Repeat the steps from 1 to 6