esp32 light sleep wake-up from uart

kubera
Posts: 19
Joined: Wed May 20, 2020 10:21 am

esp32 light sleep wake-up from uart

Postby kubera » Thu Oct 22, 2020 6:45 am

Hi, I am using 5 and 4 for UART num 1.

uart_set_pin(UART_NUM, 5, 4, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);


I would like to implement a light sleep-wake up from UART. But according to the Doc, I am seeing some confusing things in pins selections.


Which is:

"in ESP32, the wake-up signal can only be input via IO_MUX (i.e. GPIO3 should be configured as function_1 to wake up UART0, GPIO9 should be configured as function_5 to wake up UART1), UART2 does not support light sleep wakeup feature."

So I am a little bit confused. Does the above sentence state that in order to wake up from light sleep using UART, I may need to use GPIO9 as my rx pin? If so is there anything I need to configure other than the normal GOPI configurations.


Below is how I initialize UART now.


"void uart_init(void)
{
/* Configure parameters of an UART driver,
* communication pins and install the driver */
uart_config_t uart_config = {
.baud_rate = 115200,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE};
uart_param_config(EX_UART_NUM, &uart_config);

//Set UART log level
esp_log_level_set(TAG, ESP_LOG_INFO);
//Set UART pins (using UART0 default pins ie no changes.)
uart_set_pin(UART_NUM, 5, 4, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
//Install UART driver, and get the queue.
uart_driver_install(EX_UART_NUM, BUF_SIZE * 2, BUF_SIZE * 2, 20, &uart0_queue, 0);

//Set uart pattern detect function.
uart_enable_pattern_det_intr(EX_UART_NUM, '+', PATTERN_CHR_NUM, 10000, 10, 10);
//Reset the pattern queue length to record at most 20 pattern positions.
uart_pattern_queue_reset(EX_UART_NUM, 20);
}"






Also according to the Doc ,


"The character that triggers wakeup is not received by UART (i.e. it can not be obtained from UART FIFO). Depending on the baud rate, a few characters after that will also not be received."


Does the above state that i will not be able get that characters through my UART even after wake-up.

kubera
Posts: 19
Joined: Wed May 20, 2020 10:21 am

Re: esp32 light sleep wake-up from uart

Postby kubera » Sat Oct 24, 2020 9:05 am

Can anybody please clarify

WiFive
Posts: 2985
Joined: Tue Dec 01, 2015 7:35 am

Re: esp32 light sleep wake-up from uart

Postby WiFive » Sat Oct 24, 2020 12:03 pm

Yes you have to use pin 9 but most cases you can't use it because it is connected to flash.

Yes you will lose data.

Who is online

Users browsing this forum: Google [Bot] and 33 guests