ESP32-S3 read HaerdwareSerial immediately after woke up

fabiobertolini
Posts: 4
Joined: Fri Feb 17, 2023 12:17 am

ESP32-S3 read HaerdwareSerial immediately after woke up

Postby fabiobertolini » Thu Jan 11, 2024 2:08 pm

Good morning,
I have a problem with reading hardware serial 1 on ESP32-S3 after woke up by deep sleep: basically, I send the LoRa modem E220 to sleep and then the esp32 to deep sleep.
When a message arrives, the modem receives it, it throw LOW the aux pin that wakes up the ESP32 and with the latter I have to read the Hardware 1 serial.

The problem is that when it wakes up and I create the object, it doesn't find anything in the serial because in my opinion when it creates the serial object, it clears the buffer.

I'm asking for advice if anyone knows anything.

lbernstone
Posts: 829
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32-S3 read HaerdwareSerial immediately after woke up

Postby lbernstone » Fri Jan 12, 2024 1:58 pm

The hardware uart is off until you turn it on, so yes, the buffer is empty until then.
You can use light sleep, and then wakeup from uart. https://docs.espressif.com/projects/esp ... sleep-only
You can use the ULP to buffer a few characters while the system is waking up.
https://github.com/boarchuz/HULP/blob/m ... uart.h#L23
Both of these methods will require additional power domains to be active in sleep, so will reduce your battery life span.
There may be a way to request a retransmit from the LORA. This would be the best option.

fabiobertolini
Posts: 4
Joined: Fri Feb 17, 2023 12:17 am

Re: ESP32-S3 read HaerdwareSerial immediately after woke up

Postby fabiobertolini » Mon Jan 15, 2024 11:16 am

I noticed that it is possible to use ULP for my purpose, has anyone already had experience with this?

Who is online

Users browsing this forum: No registered users and 173 guests