Fixing the missing references for #LoRaWAN on Apache #NuttX OS
https://docs.google.com/spreadsheets/d/12EFS72JFjjuK-2yWQVYrImkUjyEA_iGlnsEu1d42r68/edit#gid=0
#LoRaWAN on #NuttX OS: Let's stub out the functions for Non-Volatile Memory and Real Time Clock ... And watch what happens 🌋
https://github.com/lupyuen/LoRaMac-node-nuttx/blob/master/src/nuttx.c
#LoRaWAN builds OK on #NuttX OS! 🎉 ... Will it run? 🤔
https://github.com/lupyuen/incubator-nuttx/tree/lorawan
https://github.com/lupyuen/incubator-nuttx-apps/tree/lorawan
#LoRaWAN on #NuttX OS sends a Join Request to the LoRaWAN Gateway ... But the values are incorrect though 🤔
Run Log: https://gist.github.com/lupyuen/b91c1f88645eedb813cfffa2bdf7d7a0
LoRa Frequency and Sync Word are OK ... Let's fix the Device EUI and Join EUI for #LoRaWAN on #NuttX OS
Run Log: https://gist.github.com/lupyuen/b91c1f88645eedb813cfffa2bdf7d7a0
#LoRaWAN Gateway receives the Join Request from #NuttX OS ... And accepts the Join Request! 🎉
Run Log: https://gist.github.com/lupyuen/a8e834e7b4267345f01b6629fb7f5e33
#NuttX OS doesn't handle the Join Response from #LoRaWAN Gateway ... Let's fix this
Run Log: https://gist.github.com/lupyuen/a8e834e7b4267345f01b6629fb7f5e33
Our #NuttX App was waiting for the #LoRaWAN Join Request to be transmitted before receiving the Join Response ... But because we're polling SX1262, we missed the Join Response ... Let's fix this with the multithreading functions from NimBLE Porting Layer
Log: https://gist.github.com/lupyuen/d3d9db37a40d7560fc211408db04a81b
#LoRaWAN runs neater on Apache #NuttX OS ... After implementing Timers and Multithreading with NimBLE Porting Layer ... No more polling and sleep()!
https://gist.github.com/lupyuen/cad58115be4cabe8a8a49c0e498f1c95
Here's how we check the SX1262 Busy Pin on #NuttX OS ... By reading the GPIO Input
https://github.com/lupyuen/lora-sx1262/blob/lorawan/src/sx126x-nuttx.c#L184-L199
SX1262 will trigger a GPIO Interrupt on #NuttX OS when it receives a #LoRa Packet ... We wait for the GPIO Interrupt to be Signalled in a Background Thread
https://github.com/lupyuen/lora-sx1262/blob/lorawan/src/sx126x-nuttx.c#L742-L778
We handle GPIO Interrupts (SX1262 DIO1) in a #NuttX Background Thread ... Awaiting the Signal for GPIO Interrupt
https://github.com/lupyuen/lora-sx1262/blob/lorawan/src/sx126x-nuttx.c#L835-L861
Our #NuttX Background Thread handles the GPIO Interrupts (SX1262 DIO1) ... By adding to the #LoRaWAN Event Queue
https://github.com/lupyuen/lora-sx1262/blob/lorawan/src/sx126x-nuttx.c#L863-L892
Our #NuttX App resends the same Nonce to the #LoRaWAN Gateway ... Which (silently) rejects the Join Request due to Duplicate Nonce ... Let's fix our Random Number Generator
https://gist.github.com/lupyuen/b38434c3d27500444382bb4a066691e5
#LoRaWAN gets the Nonce from the Secure Element's Random Number Generator ... Let's simulate the Secure Element on Apache #NuttX OS
https://github.com/lupyuen/LoRaMac-node-nuttx/blob/master/src/mac/LoRaMacCrypto.c#L980-L996
Here's how we generate #LoRaWAN Nonces on #NuttX OS ... With Strong Random Numbers thanks to Entropy Pool
https://github.com/lupyuen/LoRaMac-node-nuttx/blob/master/src/nuttx.c#L136-L153
Our #NuttX App now sends Random #LoRaWAN Nonces to the LoRaWAN Gateway ... And are happily accepted by the gateway! 🎉
Log: https://gist.github.com/lupyuen/8f012856b9eb6b9a762160afd83df7f8
Our #NuttX App was too busy to receive the #LoRaWAN Join Response ... Let's disable the logging
Log: https://gist.github.com/lupyuen/8f012856b9eb6b9a762160afd83df7f8
After disabling logging, our #NuttX App successfully joins the #LoRaWAN Network! 🎉 Now we transmit some Data Packets over LoRaWAN
Log: https://gist.github.com/lupyuen/0d301216bbf937147778bb57ab0ccf89
Our #LoRaWAN Gateway receives Data Packets from #NuttX OS! 🎉 The Message Payload is empty ... Let's figure out why 🤔
Log: https://gist.github.com/lupyuen/0d301216bbf937147778bb57ab0ccf89
Our #NuttX App sent an empty #LoRaWAN Message because our message is too long for LoRaWAN Data Rate 2 (max 11 bytes) ... Let's increase the Data Rate to 3
https://gist.github.com/lupyuen/5fc07695a6c4bb48b5e4d10eb05ca9bf
Here's how we increase the #LoRaWAN Data Rate to 3 in our #NuttX App
https://github.com/lupyuen/lorawan_test/blob/main/lorawan_test_main.c#L57-L70
#LoRaWAN Data Rate has been increased to 3 ... Max Message Size is now 53 bytes for our #NuttX App
https://gist.github.com/lupyuen/83be5da091273bb39bad6e77cc91b68d
#LoRaWAN Gateway now receives the correct Data Packet from our #NuttX App! 🎉
https://gist.github.com/lupyuen/83be5da091273bb39bad6e77cc91b68d
Here's how we send a #LoRaWAN Data Packet on #NuttX OS ... And validate the Packet Size before sending
https://github.com/lupyuen/lorawan_test/blob/main/lorawan_test_main.c#L311-L339
@lupyuen The payload isn't empty. The value is null
Here's our #LoRaWAN Event Loop for #NuttX OS ... Implemented with NimBLE Porting Library ... No more polling!
https://github.com/lupyuen/incubator-nuttx-apps/blob/lorawan/examples/lorawan_test/lorawan_test_main.c#L814-L857