Cant wake up from UART_NUM_1

JosuGZ
Posts: 4
Joined: Tue Jan 14, 2020 9:47 am

Cant wake up from UART_NUM_1

Postby JosuGZ » Tue Jan 14, 2020 2:00 pm

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.

User avatar
ESP_krzychb
Posts: 241
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: Cant wake up from UART_NUM_1

Postby ESP_krzychb » Tue Jan 14, 2020 2:53 pm

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.

JosuGZ
Posts: 4
Joined: Tue Jan 14, 2020 9:47 am

Re: Cant wake up from UART_NUM_1

Postby JosuGZ » Tue Jan 14, 2020 5:42 pm

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.

JosuGZ
Posts: 4
Joined: Tue Jan 14, 2020 9:47 am

Re: Cant wake up from UART_NUM_1

Postby JosuGZ » Tue Jan 14, 2020 6:20 pm

Maybe I have to manually enable the GPIO_INTR_HIGH_LEVEL (= 5) on the pin? I will try it tomorrow.

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

Re: Cant wake up from UART_NUM_1

Postby WiFive » Wed Jan 15, 2020 10:17 am

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.

JosuGZ
Posts: 4
Joined: Tue Jan 14, 2020 9:47 am

Re: Cant wake up from UART_NUM_1

Postby JosuGZ » Wed Jan 15, 2020 1:52 pm

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)...

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

Re: Cant wake up from UART_NUM_1

Postby WiFive » 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.

JosuGZ
Posts: 4
Joined: Tue Jan 14, 2020 9:47 am

Re: Cant wake up from UART_NUM_1

Postby JosuGZ » Mon Jan 20, 2020 12:29 pm

GPIO 9 is available, but it's not working as a wakeup source for the uart.

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

Re: Cant wake up from UART_NUM_1

Postby WiFive » Mon Jan 20, 2020 11:14 pm

Did you set the mux for gpio9 to uart1 rx

Who is online

Users browsing this forum: ed2000, FaithRaven, Majestic-12 [Bot] and 17 guests