LoRa Delay (endPacket())

Hey,

I am testing the LoRa functionality of a Heltec ESP32 V2 board. I can easily send and receive packets using the Heltec library with an Arduino IDE. I then implemented a function to send an Acknowledge after the receiver receives a packet. While doing this I found that there is quite large delays and I started to search for the reason.

When sending a packet my code looks like this:

LoRa.beginPacket();
LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);
LoRa.print(packet);
LoRa.endPacket();

And I found that there is a huge delay (>500ms) for the function Lora.endPacket(). I looked up this function in the Heltec library and it looks like this:

int LoRaClass::endPacket()
{
// put in TX mode
writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_TX);

// wait for TX done
while((readRegister(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) == 0);

// clear IRQ’s
writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK);

return 1;
}

The readRegister() and writeRegister() functions work without measurable delay, the problem is created by the while look in the code above. This loop is passed extremely often before the register signals that the transmission is done.

Can it be that transmitting a packet takes more than 500ms? Is this normal? Why does this take so long? Can this be shortened? Any help highly appreciated.

Best,
Sebastian

Yes it can definitely be much much longer than 500ms. 32 bytes of payload at SF12 is 1.8 seconds.

Check out a LoRa Airtime calculator (first one I found…seems to work)

1 Like