Hi,
I am working on a project wherein, the DA 14580 device is by default in extended sleep mode. On reception of a gpio interrupt, the device advertises for less than 1 second, and then goes to scanning mode. In between scanning, if any packets are received, the device also advertises those packets. The default sleep mode is extended, and its been invoked in user_app_init().
void user_app_init(){
// Set sleep mode
arch_set_sleep_mode(app_default_sleep_mode);
}
Now, the for entering the sleep mode and for waking up from an external interrupt , the following steps are performed :
void go_to_sleep(void)
{
arch_ble_ext_wakeup_on();
// Configure wakeup button
app_button_enable();
}
static void app_button_press_cb(void)
{
if (GetBits16(SYS_STAT_REG, PER_IS_DOWN))
{
periph_init();
}
my_state = arch_ble_ext_wakeup_get();
if (arch_ble_ext_wakeup_get())
{
arch_set_sleep_mode(app_default_sleep_mode);
arch_ble_force_wakeup();
arch_ble_ext_wakeup_off();
app_easy_wakeup();
}
}
/**
****************************************************************************************
* @brief Sets button as wakeup trigger
* @return void
****************************************************************************************
*/
static void app_button_enable(void)
{
app_easy_wakeup_set(app_wakeup_cb);
wkupct_register_callback(app_button_press_cb);
wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_INT2_PORT, GPIO_INT2_PIN), // select pin (GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)
WKUPCT_PIN_POLARITY(GPIO_INT2_PORT, GPIO_INT2_PIN, WKUPCT_PIN_POLARITY_HIGH), // polarity low
1, // 1 event
40); // debouncing time = 0
}
The GPIO_INT2_PIN is configured as follows :
GPIO_ConfigurePin(GPIO_INT2_PORT, GPIO_INT2_PIN, INPUT_PULLDOWN, PID_GPIO, false);
The following are the issues we face :
1. Now, on reception of a high value on the configured GPIO, the function app_button_press_cb() is invoked. The value of my_state = arch_ble_ext_wakeup_get() is also 1. But further, the function, app_wakeup_cb () is not getting invoked.
2.当前消费之前中断发生s, ie in th sleep period is around 0.7mA and not 2 uA. Does this mean that the device had not entered the extended sleep mode, and is present in an idle state?
Kindly suggest the possible reasons for the same.
Hi wisilica,
1) Could you please check if #define EXCLUDE_DLG_MSG in user_modules_config.h file is defined to 0? You should define it to 0, in order that the messages into your application to be handled by the SDK. If the value is 1, you should handle the application messages by your own. Probably, that’s the reason that app_wakeup_cb () is not getting invoked.
2) Regarding the current consumption, the current in sleep mode should be around 2uA. So, yes, your device isn’t entering the extended sleep mode and it still be in an idle mode.
Thanks PM_dialog