UART as wake-up source in Light sleep mode

Ritu21
Posts: 14
Joined: Sat Aug 04, 2018 9:58 am

UART as wake-up source in Light sleep mode

Postby Ritu21 » Wed Sep 05, 2018 5:47 am

In technical reference manual of ESP32 ver-3.7 page no- 634-635, it is mentioned that UART can be set as wake-up source "Wake-up is triggered when the number or positive edges of RxD signal is greater than or equal to (UART_ACTIVE_THRESHOLD+2)."

I did this in my code:
REG_WRITE(UART_SLEEP_CONF_REG(UART_NUM_1),UART_ACTIVE_THRESHOLD); // value of threshold = 5
REG_WRITE(RTC_CNTL_WAKEUP_STATE_REG,((uint32_t)(REG_READ(RTC_CNTL_WAKEUP_STATE_REG) | 0x40000)));
esp_light_sleep_start();

ESP32-Wroom-32D is going on light sleep mode but never waking whenever RFID card is shown to the module. Am I missing something here???

Thanks
Ritu

Ritu21
Posts: 14
Joined: Sat Aug 04, 2018 9:58 am

Re: UART as wake-up source in Light sleep mode

Postby Ritu21 » Tue Sep 11, 2018 1:14 pm

I dont any reply for any of my questions.

ESP_igrr
Posts: 1144
Joined: Tue Dec 01, 2015 8:37 am

Re: UART as wake-up source in Light sleep mode

Postby ESP_igrr » Wed Sep 12, 2018 2:34 am

The issue, I think, is that esp_light_sleep_start will overwrite the wakeup selection you have set in the register. Can you please try using the following APIs instead of manual register operations?

https://docs.espressif.com/projects/esp ... rt_port_ti

https://docs.espressif.com/projects/esp ... rt_wakeupi

Ritu21
Posts: 14
Joined: Sat Aug 04, 2018 9:58 am

Re: UART as wake-up source in Light sleep mode

Postby Ritu21 » Fri Oct 05, 2018 12:16 pm

Hi,
Thanks for the reply.
I wrote a below task on ESP32, module is going in light sleep mode but not waking up when RFID card is shown.

void wakeup_uart(void *pvParam)
{
int wake_thresh = 3;
while(1)
{
printf(".. Configuring UART for light sleep mode...\n");
vTaskDelay(5000 / portTICK_PERIOD_MS);
printf("...CPU Going to sleep...\n");
uart_set_wakeup_threshold(UART_NUM_1, wake_thresh);
uart_get_wakeup_threshold(UART_NUM_1, &wake_thresh);
esp_sleep_enable_uart_wakeup(UART_NUM_1);
vTaskDelay(5000 / portTICK_PERIOD_MS);
esp_light_sleep_start();
printf("...Exiting from light sleep mode...\n");

}
}

Looking for your soonest reply.

Thanks
Ritu

Ritu21
Posts: 14
Joined: Sat Aug 04, 2018 9:58 am

Re: UART as wake-up source in Light sleep mode

Postby Ritu21 » Mon Oct 08, 2018 6:01 am

Waiting for your reply. Its Urgent...!!!

Ritu21
Posts: 14
Joined: Sat Aug 04, 2018 9:58 am

Re: UART as wake-up source in Light sleep mode

Postby Ritu21 » Wed Oct 10, 2018 7:35 am

Please reply. :oops:

ESP_igrr
Posts: 1144
Joined: Tue Dec 01, 2015 8:37 am

Re: UART as wake-up source in Light sleep mode

Postby ESP_igrr » Wed Oct 10, 2018 2:59 pm

Sorry for the late reply. Could you try EXT0 or EXT1 wake up method for UART RX pin, and see if it can wake the chip up from light sleep when something is received? Another thing to try, connect the external serial device to UART0 instead of UART1, and see if wake up from UART0 works using your code.

Ritu21
Posts: 14
Joined: Sat Aug 04, 2018 9:58 am

Re: UART as wake-up source in Light sleep mode

Postby Ritu21 » Thu Oct 11, 2018 7:35 am

Hi,

Method1:
So I am using GPIO 5 as Uart Rx. This is how you are saying
esp_sleep_enable_ext0_wakeup(GPIO_NUM_5, 1)
esp_sleep_enable_gpio_wakeup()
If it is ok, GPIO 5 cannot be used as wakeup source since it doesn't have RTC functionality.

Method2:
I cannot use UART0, since I am using it for flash the image.

Hope to see your early response.

Regards
Ritu

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

Re: UART as wake-up source in Light sleep mode

Postby WiFive » Thu Oct 11, 2018 9:48 am

UART1 wakeup does not seem to work on the console example either but gpio wakeup on gpio5 works with uart rx. Uart0 seems only works on default mux pins.

Ritu21
Posts: 14
Joined: Sat Aug 04, 2018 9:58 am

Re: UART as wake-up source in Light sleep mode

Postby Ritu21 » Thu Oct 11, 2018 11:14 am

I used GPIO 4 for Uart1 Rx but either data get corrupted when input level is low(0) in EXT0 or it is always awake when input level is high (1). Below is my code:

printf(".. Configuring UART for light sleep mode...\n");
rtc_gpio_pulldown_en(RXD_PIN);
ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(RXD_PIN, 1)); //input level is high.
//vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("CPU going on sleep mode\n");
vTaskDelay(2000 / portTICK_PERIOD_MS);
ESP_ERROR_CHECK(esp_light_sleep_start());
printf("CPU Awake\n");
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0);

RXD_PIN is GPIO_NUM_4.

Where am I wrong???

Who is online

Users browsing this forum: No registered users and 7 guests