Can DA14681 UART work in extended sleep mode

⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
13 posts / 0 new
Last post
guxiang
Offline
Last seen:1 week 6 days ago
加入:2017-05-12 04:18
Can DA14681 UART work in extended sleep mode

Hi, dialog
When the DA14681 in extended sleep mode , can it wake up by uart receive interrupt and receive data bytes from the transciver? And how to set it?

Device:
LC_Dialog
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello guxiang,

Hello guxiang,

The UART hardware is turned off in Extended sleep mode and so you cannot use it to wake the system up.

However, there is a workaround which you have to be very carefull about and it is not an officially recommended one.

You can map the UART pin to a GPIO for external wakeup just before going to sleep and use it as a trigger for wakeup and then map the pin back to UART after wakeup to receive the data over UART.

However, you got to be very carefull about managing the following things: baudrate, debounce and wakeup delay.

Best,
LC

guxiang
Offline
Last seen:1 week 6 days ago
加入:2017-05-12 04:18
Hi , LC

Hi , LC
can you give me a demo code to learn it?

LC_Dialog
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello guxiang,

Hello guxiang,

This method is used in the codeless project referred below. Take at look at the user_prepare_sleep() function as a starting point.

https://support.dialog-semiconductor.com/connectivity/reference-design/smartbond-codeless-serial-link

Best,
LC

guxiang
Offline
Last seen:1 week 6 days ago
加入:2017-05-12 04:18
hi, LC

hi, LC
The file showed "restricted" for me . Can give me the permission to download it?
my email:414095539@qq.com

LC_Dialog
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello guxiang,

Hello guxiang,

It is due to the license agreement needs to be accepted before downloading file. Please accept the license and you should be able to download the files on this support portal.

Best,
LC

guxiang
Offline
Last seen:1 week 6 days ago
加入:2017-05-12 04:18
hi , LC

hi , LC
I have accepted the license agreement and submited it , but it didn't reply me and still I can't get access to download the file.

LC_Dialog
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello guxiang,

Hello guxiang,

Can you provide a valid address and other details in your profile. We need some valid information to provide access to the content on the portal.

Best,
LC

guxiang
Offline
Last seen:1 week 6 days ago
加入:2017-05-12 04:18
Hi LC ,

Hi LC ,
I have updated my profile . Please check it again.

LC_Dialog
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hi guxiang,

Hi guxiang,

You should be able to download the content now.

Best,
LC

guxiang
Offline
Last seen:1 week 6 days ago
加入:2017-05-12 04:18
hi LC,

hi LC,
Now it can wake up from extended sleep mode via uart rx pin . But sometimes it will enter "HW_UART_INT_BUSY_DETECTED" interrupt after system wake up. Although I could use "hw_uart_transmit_fifo_empty(uart)" to exit "HW_UART_INT_BUSY_DETECTED" interrupt , I found the baudrate is incorrect which led to wrong character transfer. How to solve this problem?

LC_Dialog
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello guxiang,

Hello guxiang,

So first of all, you are configuring the UART Rx pin as a GPIO before going into sleep mode and you enabled the wakeup interrupt on this pin with 1 event to count. And to wakeup the system you are sending an @ character that can pull the pin low for enough clock cycles.

After you wakeup you then enable the UART. Is your implementation doing this and still you see the HW_UART_INT_BUSY_DETECTED interrupt. Please confirm.

Best,
LC

guxiang
Offline
Last seen:1 week 6 days ago
加入:2017-05-12 04:18
Hi, LC

Hi, LC
Yes, I can configure the UART Rx pin as a GPIO wakeup pin and can wakeup the system. Now it worked well in most cases . But I didn't sending only an @ character. Because sometimes only one @ character is not enough clock cycles to wake up . But when I send a long string (over 20 bytes @ character, baudrate 38400) to wake up the system , it's easier to occured "HW_UART_INT_BUSY_DETECTED" interrupt and it seems that the baudrate is wrong.
Configured code is as below:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void console_uart_leave_from_sleepmode(void)
{
hw_wkup_set_pin_state(UART_RX_PORT, UART_RX_PIN, false);
hw_gpio_set_pin_function(UART_RX_PORT, UART_RX_PIN, HW_GPIO_MODE_INPUT_PULLUP,
HW_GPIO_FUNC_UART_RX);// RX pin enable
console_uart_init();
uart_rx_int_enable(HW_UART1, true);
}
void console_uart_prepare_for_sleepmode(void)
{

hw_wkup_init(NULL);
hw_wkup_reset_counter();
hw_wkup_set_debounce_time(0);
hw_wkup_set_counter_threshold(1);

hw_gpio_set_pin_function(HW_GPIO_PORT_4, HW_GPIO_PIN_7, HW_GPIO_MODE_INPUT_PULLUP, HW_GPIO_FUNC_GPIO);
hw_wkup_set_pin_state(HW_GPIO_PORT_4, HW_GPIO_PIN_7, true);//configure rx pin as wake up pin
hw_wkup_set_pin_trigger(HW_GPIO_PORT_4, HW_GPIO_PIN_7, HW_WKUP_PIN_STATE_LOW);
hw_wkup_register_interrupt (wkup_handler configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);

hw_gpio_set_pin_function(UART_RX_PORT, UART_RX_PIN, HW_GPIO_MODE_INPUT,
HW_GPIO_FUNC_GPIO);// RX pin disable
uart_rx_int_enable(HW_UART1, false);
uart_clock_disable();
}