STMicroelectronics / STM32CubeWL

STM32Cube MCU Full FW Package for the STM32WL series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on boards provided by ST (Nucleo boards)
Other
107 stars 54 forks source link

Fragdecoder not working as expected sometimes. #75

Open nilesh-dryad opened 1 year ago

nilesh-dryad commented 1 year ago

set-up

Linux Machine Simulator for Frag Decoder. (I have made to make testing faster) GCC

bug

We are encountering difficulties while utilizing the Frag Decoder module. Specifically, we are facing issues with the reconstruction of certain unique sequences of missing fragments. Although the decoder manages to reconstruct all fragments, a subsequent CRC check of the resultant file yields an incorrect value. Upon further investigation, it has become evident that the reconstructed fragments are not being reconstituted accurately.

Here are some details regarding our situation:

We are attempting to send a single file with a size of 499 bytes. The original file has been attached as 'original.txt'. The coded fragments have been stored in a file named 'coded.txt'. Both are binary files but I renamed them as text files.

During a simulation, we purposefully dropped a selection of uncoded and coded fragments as follows: Uncoded Fragments (16 in total): 1, 2, 3, 4, 7, 15, 17, 18, 20, 21, 22, 24, 28, 29, 31, 32 Coded Fragments (14 in total): 3, 6, 7, 9, 11, 12, 18, 20, 22, 23, 24, 25, 26, 27

For example, during the transmission of the original 32 fragments, the fragments with the numbers 1, 2, 3, 4, 7, 15, 17, 18, 20, 21, 22, 24, 28, 29, 31, and 32 were not received by the recipient and the same for coded fragments with above 14 indexes.

Our current configuration is as follows: FRAG_MAX_REDUNDANCY: 1000 FragDecoder->FragNb: 32 FragDecoder->FragSize: 16 codeRate: 32 fragtolerance: 32 fileSize: 499 file CRC: 901076938 number of missing uncoded fragments : 16 number of missing coded fragments : 14

Please see below log of Frag Decoded for more information. You will see FRx print in the log. Its representation is as follow.

FRx : a-b/c, d/(e+f)
a = Fragment number of the Fragment received
b = Total number of the Fragment reconstructed by decoder
c = Total number of packet lost at a time of receiving this Fragment
d = Total number of Fragment received at a time of receiving this Fragment
e = total number of expected uncoded fragments
f = total number of expected coded fragments

Decoder Log

-- 1693391003 :FRx: 5-0/4, 1/(32+32) Missing Indexes: 1 2 3 4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:5 FragNbLost:4 FragNbLastRx:5

-- 1693391003 :FRx: 6-0/4, 2/(32+32) Missing Indexes: 1 2 3 4 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:6 FragNbLost:4 FragNbLastRx:6

-- 1693391003 :FRx: 8-0/5, 3/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:8 FragNbLost:5 FragNbLastRx:8

-- 1693391003 :FRx: 9-0/5, 4/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:9 FragNbLost:5 FragNbLastRx:9

-- 1693391003 :FRx: 10-0/5, 5/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:10 FragNbLost:5 FragNbLastRx:10

-- 1693391003 :FRx: 11-0/5, 6/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:11 FragNbLost:5 FragNbLastRx:11

-- 1693391003 :FRx: 12-0/5, 7/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:12 FragNbLost:5 FragNbLastRx:12

-- 1693391003 :FRx: 13-0/5, 8/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:13 FragNbLost:5 FragNbLastRx:13

-- 1693391003 :FRx: 14-0/5, 9/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:14 FragNbLost:5 FragNbLastRx:14

-- 1693391003 :FRx: 16-0/6, 10/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:16 FragNbLost:6 FragNbLastRx:16

-- 1693391003 :FRx: 19-0/8, 11/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 1 1 1 1 1 1 1 1 1 1 1 1 1 FragNbRx:19 FragNbLost:8 FragNbLastRx:19

-- 1693391003 :FRx: 23-0/11, 12/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 1 1 1 1 1 1 1 1 1 FragNbRx:23 FragNbLost:11 FragNbLastRx:23

-- 1693391003 :FRx: 25-0/12, 13/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 1 1 1 1 1 1 1 FragNbRx:25 FragNbLost:12 FragNbLastRx:25

-- 1693391003 :FRx: 26-0/12, 14/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 1 1 1 1 1 1 FragNbRx:26 FragNbLost:12 FragNbLastRx:26

-- 1693391003 :FRx: 27-0/12, 15/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 1 1 1 1 1 FragNbRx:27 FragNbLost:12 FragNbLastRx:27

-- 1693391003 :FRx: 30-0/14, 16/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 1 1 FragNbRx:30 FragNbLost:14 FragNbLastRx:30

-----now coded fragments-----

-- 1693391003 :FRx: 33-1/16, 17/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:33 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 34-2/16, 18/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:34 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 36-3/16, 19/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:36 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 37-4/16, 20/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:37 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 40-5/16, 21/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:40 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 42-6/16, 22/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:42 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 45-7/16, 23/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:45 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 46-8/16, 24/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:46 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 47-9/16, 25/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:47 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 48-10/16, 26/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:48 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 49-11/16, 27/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:49 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 51-12/16, 28/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:51 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 53-13/16, 29/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:53 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 60-14/16, 30/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:60 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 61-14/16, 31/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:61 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 62-15/16, 32/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:62 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :FRx: 63-15/16, 33/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:63 FragNbLost:16 FragNbLastRx:33

Packet 31 not retrieved constructed: 94 17 50 DB 1D F8 A9 76 5E 2E 8C 0B 64 BC ED 7D expected: 94 17 50 2B 48 A4 C0 51 70 8A 51 2D 27 8A 95 CF

Packet 29 not retrieved constructed: E7 A3 00 D2 9D CA 69 04 26 31 DD 31 D7 21 28 F4 expected: E7 A3 00 22 C8 96 00 23 08 95 00 17 94 17 50 46

Packet 28 successfully retrieved Packet 24 not retrieved constructed: C0 58 08 30 D5 05 21 D8 50 6D DD 7E 4B F7 B8 EB expected: C0 58 08 C0 80 59 48 FF 7E C9 00 58 08 C1 C0 59

Packet 22 successfully retrieved Packet 21 not retrieved constructed: 00 ED A7 7A C0 5A 59 FC 24 FF 5F 7E 4B 35 24 28 expected: 00 ED A7 8A 95 06 30 DB 0A 5B 82 58 08 03 5C 9A

Packet 20 not retrieved constructed: 48 E7 A7 7A C0 A3 44 68 A6 99 63 A2 C3 36 30 6A expected: 48 E7 A7 8A 95 FF 2D 4F 88 3D BE 84 80 00 48 D8

Packet 18 successfully retrieved Packet 17 successfully retrieved Packet 15 not retrieved constructed: 95 97 67 7A C0 F2 0E AD BB 33 BA AC D6 88 DF 38 expected: 95 97 67 8A 95 AE 67 8A 95 97 67 8A 95 BE A7 8A

Packet 7 not retrieved constructed: FE 84 80 7A 04 5E C9 AD BB FD 1A EF 43 6D F0 B8 expected: FE 84 80 8A 51 02 A0 8A 95 59 C7 C9 00 5B 88 0A

Packet 4 successfully retrieved Packet 3 not retrieved constructed: FE 84 80 7A 04 5E C9 AD BB FD 1A E1 03 6D F0 B8 expected: FE 84 80 8A 51 02 A0 8A 95 59 C7 C7 40 5B 88 0A

Packet 2 not retrieved constructed: FE 84 80 7A 04 5E C9 AD BB FC 5A 98 C3 6D F0 B8 expected: FE 84 80 8A 51 02 A0 8A 95 58 87 BE 80 5B 88 0A

Packet 1 successfully retrieved -- 1693391003 :FRx: 64-16/16, 34/(32+32) Missing Indexes: 1 2 3 4 0 0 5 0 0 0 0 0 0 0 6 0 7 8 0 9 10 11 0 12 0 0 0 13 14 0 15 16 FragNbRx:64 FragNbLost:16 FragNbLastRx:33

-- 1693391003 :dec complete (reconstruct 16 packets) -- 1693391003 :dec DONE. -- 1693391003 :File CRC ERR Check 959524711 | Orig 901076938

Please note that If I change just one missing index , it works. e.g. look at below arrays. only bold index is changed. It was 7 and I made it 8 and it works. Uncoded Fragments (16 in total): 1, 2, 3, 4, 8, 15, 17, 18, 20, 21, 22, 24, 28, 29, 31, 32 Coded Fragments (14 in total): 3, 6, 7, 9, 11, 12, 18, 20, 22, 23, 24, 25, 26, 27

For most of the sequence it works, only fews are not working.

Screenshots coded.txt origin.txt