I have a working code in Arduino Framework that uses RAK4631 Core, RAK12500 GPS and RAK1904 Accelerometer. My code it’s based in Lorawan Low Power Examples from Beegee Tokyo.
In some critical scenery, my code get into a while(true) condition that sends periodically the gps position assuming that the Wisbox was stole.
The problem it’s that if go into this critical scenery when i’m not connected to lorawan, i can’t to make a new connection to Chirpstack using lmh_join because the callbacks and Lorawan Functions doesn’t works inside the while(true) scenery. Chirpstack creates a new dev address but my Wisblock never recieve it because it’s busy in my while(true) condition.
When a run lmh_join outside the while(true), the new connection to Chirpstack works flawlessly.
¿it’s there any way to make a connection in my while(true) scenery?
¿maybe running something like that after the lmh_join?
// Give the semaphore, so the loop task will continue
xSemaphoreGiveFromISR(taskEvent, pdFALSE);
The problem is that if you block the MCU in a while loop, it cannot process the Join Accept messages, even if it receives them.
Do you have at least a delay(100) in your while loop to allow other tasks to run?
The LoRaWAN stack events are handled in a separate FreeRTOS task, so you have to allow it to run.