The pin level status in the DA1468x/DA1510x PRO-Development kit can not be maintained after sleep

⚠️
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//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
userYR
Offline
Last seen:3 years 4 months ago
加入:2016-11-08 08:28
The pin level status in the DA1468x/DA1510x PRO-Development kit can not be maintained after sleep

Hi,

Brief Description:
Based on the official offer routine for modified testing,
After the P1_7 pin triggers a falling edge, the D2 on the Demo board will be on,
Found that when cpu completely into sleep, Demo board D2 will go out.
Theoretically pin will remain the state before dormant, but now the actual situation is wrong.
The above effect is due to the configuration of the problems caused by what, please advise.

Details:
Using the routine for Chapter Eight Your First DA1468x Application - Blinky in UM-B-047-DA1468x Getting Started_4_1,
And follow the steps to add a flashing LED D2 program successfully.
Need to test the pin in the extended_sleep can continue to maintain the state of the pin, now make the following changes:

1, Set the sleep mode, as follows:
pm_set_wakeup_mode (true);
pm_set_sleep_mode (pm_mode_extended_sleep);

2, Detect external interrupt, used here to detect the falling edge of P1_7 will wake up the device, as follows:
#define cfg_wkup_debounce_time(32)
#define CFG_WKUP_COUNTER_THR (1)
#define CFG_WKUP_ISR_PRIORITY (1)
static void prvTemplateTask (void * pvParameters)
{
OS_TICK_TIME xNextWakeTime;
static uint32_t test_counter = 0;
uint32_t task_notify_val;

hw_gpio_configure_pin_power (HW_GPIO_PORT_1, HW_GPIO_PIN_7, HW_GPIO_POWER_V33);
hw_gpio_set_pin_function (HW_GPIO_PORT_1, HW_GPIO_PIN_7, HW_GPIO_MODE_INPUT_PULLUP, HW_GPIO_FUNC_GPIO);

hw_wkup_init(null);
hw_wkup_set_debounce_time (CFG_WKUP_DEBOUNCE_TIME);
hw_wkup_set_counter_threshold (CFG_WKUP_COUNTER_THR);
hw_wkup_register_interrupt (hw_extint_wkup_cb, CFG_WKUP_ISR_PRIORITY);
hw_wkup_set_pin_state (HW_GPIO_PORT_1, HW_GPIO_PIN_7, true);
hw_wkup_set_pin_trigger (HW_GPIO_PORT_1, HW_GPIO_PIN_7, HW_WKUP_PIN_STATE_LOW);
for (;;)
{
OS_TASK_NOTIFY_WAIT (task_h, OS_TASK_NOTIFY_ALL_BITS, & task_notify_val, OS_TASK_NOTIFY_FOREVER);
if (task_notify_val & (1 << 0))
{
test_counter ++;
if (test_counter% 2) {
hw_gpio_set_active (HW_GPIO_PORT_1, HW_GPIO_PIN_5);
}
else {
hw_gpio_set_inactive(hw_gpio_port_1,hw_gpio_pin_5);
}
}
}

}
static void hw_extint_wkup_cb (void)
{
hw_wkup_reset_interrupt ();
OS_TASK_NOTIFY_FROM_ISR (task_h, (1 << 0), OS_NOTIFY_SET_BITS);
}

Appendix:
According to P147 in Datasheet Revision 2.1 15-July-2016,
32.4 STATE RETENTION WHILE SLEEPING content of the section,
Into the debug mode, you find that indeed call the apply_wfi function in sys_power_mgr.c the following section:
if (dg_configBLACK_ORCA_IC_REV == BLACK_ORCA_IC_REV_A) {
hw_cpm_activate_pad_latches ();
hw_cpm_power_down_periph_pd ();
hw_cpm_wait_per_power_down ();
}

Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi useYR,

Hi useYR,

The 68x has the ability to retain the pin state while the device is in sleep mode, but when waking up (using a BLE enabled firmware) the function that configures the pins re-runs, so the pins will default to the state instructed in the periph_init() function, so one will have to implement logic that will "remember" the state of the pin before going to sleep and configure it in the periph_init() according to the state it was before going to sleep. In your case the LED should be on for less than 8 seconds (this is the maximum amount of time that the device can stay in sleep) after that it will go to sleep and waking up will just initialize the LED pins without restoring the state of pin since there is no code in the periph_init() to instruct otherwise.

Thanks MT_dialog

userYR
Offline
Last seen:3 years 4 months ago
加入:2016-11-08 08:28
Hi MT_dialog,

Hi MT_dialog,

Thank you for your help!

Applied the method you provided, by re-configuring the GPIO function for the pins used, in the periph_init().
现在可以在MPU睡觉时维护PIN状态。

在我们的项目中,我们希望在制作时保留外围设备和GPIO的所有设置,而不是每次MCU唤醒时都在PERIPH_INIT()中。
In this way, we believ that quite a lot of battery power can be saved, as our project is about a wearable device, and the battery is a critical issue.

So could you please provide us a SDK with this functionality?

MT_dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi userYR,

Hi userYR,

Please check your other posthttps://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ....

Thanks MT_dialog