How to determine max LoRa transmit size?

  • We are using Lorawan with ADR (adaptive data rate = True).

    How we we determine the current data rate or spreading factor set by ADR so we can then look up the maximum size payload we can send (we know the conversion from data rate or SF to max payload once we have one of the former values).

    Have tried:

    1. Reading lora.sf() - always returns SF7 - docs note that only works in raw LoRa mode, so did not expect to work.
    2. Transmit packet about 70 bytes, catch EMSGSIZE exception and try to transmit again with smaller packet. Returns EAGAIN exception on trying to transmit packet smaller than 50 bytes.

    Any other ideas welcomed !

  • @philberingar You may want to check lora.stats(), specifically sftx.

    The issue will be that this tells you the data rate of the last frame sent, not the next one, but IIRC ADR will only move the DR up or down by 1 at a time, so it might be a good starting point.

Log in to reply

Pycom on Twitter