Page 1 of 2

Cant wake up from UART_NUM_1

Posted: Tue Jan 14, 2020 2:00 pm
by JosuGZ
Hi! I'm trying to make the UART_NUM_1 wake me up from light sleep with the following code, but it only wakes from the UART 0:

Code: Select all

ESP_ERROR_CHECK(esp_sleep_enable_uart_wakeup(0));
ESP_ERROR_CHECK(uart_set_wakeup_threshold(0, 3));
ESP_ERROR_CHECK(esp_sleep_enable_uart_wakeup(UART_NUM_1));
ESP_ERROR_CHECK(uart_set_wakeup_threshold(UART_NUM_1, 3));
I'm configuring the UART with the following code:

Code: Select all

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,
  .use_ref_tick = true
};
ESP_ERROR_CHECK(uart_param_config(UART_NUM_1, &uart_config));
ESP_ERROR_CHECK(uart_driver_install(UART_NUM_1, 2*1024, 0, 0, NULL, 0));
ESP_ERROR_CHECK(uart_set_pin(UART_NUM_1, 26, 27, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
In my understanding, this should work but I'm not sure whether I'm doing something wrong or there is something different between both UART.

I'm on version v3.2.2-290-g287bee03b3 (8a69ffc36f166c964d7c30188a865847bf199561).

PD: I don't know who or where to contact: I've tried to register with another email but probably due to a `ñ` on my name it won't send me the activation email, I'd like to delete that account so I can use the email on this one.

Re: Cant wake up from UART_NUM_1

Posted: Tue Jan 14, 2020 2:53 pm
by ESP_krzychb
Hi JosuGZ,

There are limitations to pin selection for wakeup signal, please see the note to function uart_set_wakeup_threshold().
This information is indeed missing in documentation of v3.2.2 you are using, but I see it provided for the latest stable release V3.3.1.

Re: Cant wake up from UART_NUM_1

Posted: Tue Jan 14, 2020 5:42 pm
by JosuGZ
Thanks, I recall reading something about "GPIO9 should be configured as function_5" at some point. I don't know what "configured as function_5 means though.

Re: Cant wake up from UART_NUM_1

Posted: Tue Jan 14, 2020 6:20 pm
by JosuGZ
Maybe I have to manually enable the GPIO_INTR_HIGH_LEVEL (= 5) on the pin? I will try it tomorrow.

Re: Cant wake up from UART_NUM_1

Posted: Wed Jan 15, 2020 10:17 am
by WiFive
You can only use gpio 3 for uart0 wakeup and gpio 9 for uart1 wakeup. Gpio 9 is usually connected to flash so unavailable. Otherwise just try using gpio wakeup on the RX pin.

Re: Cant wake up from UART_NUM_1

Posted: Wed Jan 15, 2020 1:52 pm
by JosuGZ
I don't see it connected to the flash, are you sure? Anyway, if this is true I think it is very bad. That let us with one "wakable" UART which is also the worst one (since it is usually used for flashing and logging purposes)...

Re: Cant wake up from UART_NUM_1

Posted: Wed Jan 15, 2020 9:40 pm
by WiFive
Gpio wakeup on rx would be faster anyway and the only advantage of uart wakeup is filtering glitches on rx line.

Re: Cant wake up from UART_NUM_1

Posted: Mon Jan 20, 2020 12:29 pm
by JosuGZ
GPIO 9 is available, but it's not working as a wakeup source for the uart.

Re: Cant wake up from UART_NUM_1

Posted: Mon Jan 20, 2020 11:14 pm
by WiFive
Did you set the mux for gpio9 to uart1 rx

Re: Cant wake up from UART_NUM_1

Posted: Fri Feb 28, 2020 1:25 pm
by JosuGZ
WiFive wrote:
Wed Jan 15, 2020 9:40 pm
Gpio wakeup on rx would be faster anyway and the only advantage of uart wakeup is filtering glitches on rx line.

Hi, I'm trying to do wake up from GPIO but it is not working, I get a lot of corrupted bytes, how can I do that?

Code: Select all

ESP_ERROR_CHECK(esp_sleep_enable_gpio_wakeup());
ESP_ERROR_CHECK(gpio_wakeup_enable(UART_RX, GPIO_INTR_LOW_LEVEL));