FORUM

SX126x Time-On-Air Calculation

Hello everyone

I have a question concerning the calculation of the time-on-air for the LoRa modem of the SX126x. On page 40 in the SX126x datasheet (V1.2) it is stated in Figure 6-2 and in the text (“The header is transmitted with maximum error correction code (4/8).”) that the header uses a fixed coding rate. To my understanding, the payload is transmitted with a user defined coding rate (4/5, 4/6, 4/7, or 4/8). As far as I understand, the coding rate has an influence on the time-on-air of a packet. In the time-on-air formula (p. 41) I don’t see where these facts are taken into account. As far as I can see, both N_byte_payload and N_sysmbol_header are multiplied by the same (user-defined) coding rate factor (CR+4). To my understanding, the header (N_byte_payload) should be multiplied by a different (fixed) coding rate factor (4+4).

I don’t understand why the unit of the variable “N_symbol_header” is symbols. The rest of the numerator in the formula on p. 41 appears to be in bits (bytes*8 or variables directly provided as number of bits). What would be the unit of the numerator if the unit of N_symbol_header would be symbols? Bits, Bytes, or Bit * Bytes?

I would appreciate any help with resolving the confusion.

Hello,

I agree with your observations ; I recommend you’d use formulas in the SX1276 datasheet (On pages 31 of Rev 6 for example), until we understand this better

Rgds

Are there any news on this?

Unfortunately, the datasheet for SX1276 does not state how to calculate the time-on-air for SF5 and the new version of SF6 which are available on SX126x.

Sorry for the latency.

We recommend to use the algorithm implemented in the latest release of the driver (driver available here - https://github.com/Lora-net/sx126x_driver)

@mantoine
@slebreton

Why don’t you simply answer rot_753’s question? He asked for an explanation of the time on air calculation, and not for an implemenation. I’m also interested in the composition of the time on air calculation.

I have tried to match each part in the LoRa PHY frame to the individual components in the time on air calculation, but I fail to match two components. In order to compute the number of symbols for the payload and payload crc, it’s necessary to compute the number of bit, multiply it by the overhead factor determined by the code rate configuration, and divide it by the SF since the SF specifies the number of bit per symbol.

  1. What is the purpose of the part -4 * SF + 8?

  2. What is the purpose of N_symbol_header? Firstly, the number of symbols for the header is already reflected by the 8 before the ceil. Secondly, the code rate for the header shall be 4/8. Thirdly, the numerator in the ceil should be the total number of bit so that by dividing with SF (bit / symbol), it yields the number of symbol. So how can N_symbol_header, which is specified in number of symbol, add up with number of bit?

  3. The header shall be encoded with a code rate of 4/8. Where in the formula is this reflected?

  4. The code rate specifies the overhead for the number of bit. For example, a CR of 1 means that for every 4 bit, we add 1 bit of redundancy. In other words, a CR of 1 leads to an overhead factor of 1.25. So if we have 24 bit of payload and crc, a CR of 1 leads to a total of 24 * 1.25 = 30 bit. According to my understanding, the overhead factor (CR + 4) / 4 should be applied to the numerator (number of bit) inside the ceil. So I would assume the following formula for the number of symbols for the payload and crc:
    N_symbol_payload_and_crc = ceil((8 * N_byte_payload + N_bit_crc) * (CR + 4) / (4 * SF))

Best regards
Roman Jasmann

Hello @roman.jasmann,

We cannot provide the information you are requesting.

The implementation given in the SX126x driver is an accurate one that can be reused.

Thanks.
_Matthieu