Fragmentation Session Downlink Data Fragment header


I noticed that Downlink Data Fragment header generated by lora-app-server is backwards. According to specification it should be:

For example, 8th data fragment prepared by loraserver has header 08 09 00. In my opinion (and according to specs) it should be 08 00 09. This bug is also present in loramac-node, the header is parsed by this piece of code:

                fragCounter = ( mcpsIndication->Buffer[cmdIndex++] << 0 ) & 0x00FF;
                fragCounter |= ( mcpsIndication->Buffer[cmdIndex++] << 8 ) & 0xFF00;

                fragIndex = ( fragCounter >> 14 ) & 0x03;
                fragCounter &= 0x3FFF;

So this two implementations are kind of ‘compatible’, both use wrong headers.

Correct fragmented data generator implementation can be found in this repository and is provided by semtech.

I also stumbled upon another issue (maybe this is not issue with loraserver). I can’t send file that is over 63kB. The fragmentation session is sending file like always but the LDPC frames are not reparing lost frames corectlly. I made some tests and even with same amount of frames lost and same indexes I could send <63kB file but not file >63kB. Repaired frames were just wrong

Ok, I think I solved my issue :stuck_out_tongue:

In regards to the second issue. There was an overflow in loramac-node stack. It is fixed now.

1 Like