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
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
To build NumBLE Porting Layer on #NuttX OS we need to enable: 1️⃣ POSIX Timers & Message Queues 2️⃣ Clock Monotonic 3️⃣ Work Queues 4️⃣ SIGEV_THHREAD
#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
#NuttX OS doesn't handle the Join Response from #LoRaWAN Gateway ... Let's fix this
Run Log: https://gist.github.com/lupyuen/a8e834e7b4267345f01b6629fb7f5e33