Hello! Sorry if this is not the correct category. I posted this on 3rd party boards before but I saw that a similar topic was moved to this category.
I'm working on a project using an ESP32 DevKit V1 development board on Arduino and an E220-900T22D LoRa module, trying to minimize current consumption.
When the module starts receiving data, it sends a low signal that wakes the ESP32 from deep sleep mode. The module also waits 2 to 3 ms before sending the received data through UART, but that's far from the time it takes for the UART peripheral to initialize. I measured it and it takes about 1 second to execute the first instructions after initializing the serial port.
I was wondering if there's a way to buffer the data until the uC is fully awake, or if I should change to light sleep mode.
Do you need to buffer the data from the E220 ?
Why not just have the transmitter keep sending the data until it receives a acknowledge reply from the receiver ?
So the first send wakes up the receiver, which then waits for another packet and when it receives it sends an ack to the transmitter.
And if you switched to SPI based LoRa modules what you are trying to do would be a lot easier since the LoRa device of the receiver will keep the packet data until you read it out.
in some experiments when when waking from deep sleep I found ESP32 reset and RFM95W module initialization cleared the receiver buffers
see can-lora-ra-02-wake-up-esp32-from-sleep
I thought using low level RFM95W function calls it may be possible on wakeup from deep sleep to read the receiver data????
not attempted it though!!
Exactly, I need to buffer the data from the E220 until the UART peripheral of the uC is ready. For the moment it is not possible to change to another module that uses a syncronous protocol. But you gave me a good idea for a temporary fix.
I'm avoiding using the RX module also as a transmitter due to power limitations, but I can send a first empty message that makes the E220 to wake up the uC, and after a couple seconds (when the uC is fully awake) send another message with the data. I don't have any power limitations on the TX side.
Sure that can happen, some ESP32 pins 'glitch' when going to sleep.
You need to choose the GPIO pin connected to the LoRa NRESET pin carefully.
Or just omit the connection to the NRESET pin, the SX127X has an internal pull up and will usually work quite well without an active NRESET pin.
Well exactly.
If you want reliable receipt of the LoRa packets you really ought to be using send with ack already.
And if you are using send and ack then you can easily work around the lack of a UART buffer.