Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 6 months ago.
LMiC bug
Hello everyone!
I am currently testing the LMiC App (code LoRaWAN-lmic-app from Semtech) with the NUCLEO-L073RZ board and the SX1276MB1MAS shield.
I noticed that the program occasionally get stuck so I decided to add some debug lines to figure it out. The program is always stuck between the sending of a frame and the check of the last RX window.
Here is the modified piece of code for debugging:
//======================================== Data frames // Fwd decl. static bit_t processDnData(void); static void processRx2DnDataDelay (xref2osjob_t osjob) { pc_lmic.printf("?\r\n"); processDnData(); } static void processRx2DnData (xref2osjob_t osjob) { pc_lmic.printf("? "); if( LMIC.dataLen == 0 ) { LMIC.txrxFlags = 0; // nothing in 1st/2nd DN slot // Delay callback processing to avoid up TX while gateway is txing our missed frame! // Since DNW2 uses SF12 by default we wait 3 secs. pc_lmic.printf("RX2 delayed"); os_setTimedCallback(&LMIC.osjob, (os_getTime() + DNW2_SAFETY_ZONE + rndDelay(2)), processRx2DnDataDelay); return; } processDnData(); } static void setupRx2DnData (xref2osjob_t osjob) { pc_lmic.printf("RX2"); LMIC.osjob.func = FUNC_ADDR(processRx2DnData); setupRx2(); } static void processRx1DnData (xref2osjob_t osjob) { pc_lmic.printf("? "); if( LMIC.dataLen == 0 || !processDnData() ) schedRx2(DELAY_DNW2_osticks, FUNC_ADDR(setupRx2DnData)); } static void setupRx1DnData (xref2osjob_t osjob) { pc_lmic.printf("RX1"); setupRx1(FUNC_ADDR(processRx1DnData)); } static void updataDone (xref2osjob_t osjob) { pc_lmic.printf("[LMIC] Check RX windows... "); txDone(DELAY_DNW1_osticks, FUNC_ADDR(setupRx1DnData)); } // ========================================
Here is the result:
[MAIN] Preparing TX frame... [MAIN] PORT = 0000000F [MAIN] DATA SIZE = 00000008 [MAIN] FRAME = 01 00 04 00 03 FF A9 24 [LMIC] Looking for another suitable channel... Done! (TX on channel 2 in 84.2 s) [LMIC] Frame sent with DR0 (SeqNoUp = 00000005) [LMIC] Check RX windows... RX1? RX2? RX2 delayed? [LMIC] Looking for another suitable channel... Done! (TX on channel 0 in 140.9 s) [LMIC] Frame sent with DR0 (SeqNoUp = 00000005) [LMIC] Check RX windows... RX1? RX2? RX2 delayed? [LMIC] Looking for another suitable channel... Done! (TX on channel 1 in 140.1 s) [LMIC] Frame sent with DR0 (SeqNoUp = 00000005) [LMIC] Check RX windows... RX1? RX2? RX2 delayed? [LMIC] Looking for another suitable channel... Done! (TX on channel 2 in 139.9 s) [LMIC] Frame sent with DR0 (SeqNoUp = 00000005) [LMIC] Check RX windows... RX1? RX2? RX2 delayed? [LMIC] Looking for another suitable channel... Done! (TX on channel 0 in 140.5 s) [LMIC] Frame sent with DR0 (SeqNoUp = 00000005) [LMIC] Check RX windows... RX1? RX2? RX2 delayed? [LMIC] Looking for another suitable channel... Done! (TX on channel 1 in 139.5 s) [LMIC ] Frame sent with DR0 (SeqNoUp = 00000005) [LMIC] Check RX windows... RX1 // Program stuck
The problem is consequently in the setupRx1() function, which apparently does not call the processRx2DnData job. I noticed that the data processing job was treated separately for the RX2 window and I tried to use the same process for RX1 but this time the programm got stuck by RX2. Then I tried to apply the RX1 process to RX2 but without success...
I would like to know if any of you had this problem and fixed it or if someone could see where the error could be.
Thank you!