The #LoRaWAN Protocol is explained in this thread: Encryption, Receive Window, Duty Cycle, ...
How shall we implement the #BL602 #LoRaWAN Event Queue for the Medium Access Control Layer? With the NimBLE Porting Layer of course!
https://lupyuen.github.io/articles/lora2#multitask-with-nimble-porting-layer
Curiously, our #BL602 #LoRaWAN Driver includes a Command-Line Interface (bottom) that Transmits and Receives LoRa Packets ... Directly calling the SX1276 Driver 🤔
https://github.com/lupyuen/bl_iot_sdk/blob/lorawan/components/3rdparty/lorawan/src/lora_cli.c
Porting pbuf Packet Buffer Queue from Mynewt OS to #BL602 ... Makes me hungry for Peanut Butter Jelly Sandwich 🤤
https://github.com/lupyuen/bl_iot_sdk/blob/lorawan/components/3rdparty/lorawan/src/pbuf_queue.c
Using this simpler Windows CMD script to build the #BL602 #LoRaWAN Driver ... Quicker for fixing build errors
https://github.com/lupyuen/bl_iot_sdk/blob/lorawan/customer_app/sdk_app_lorawan/run.cmd
Add the "c_cpp_properties.json" file to #VSCode ... So that our #BL602 #LoRaWAN Build Errors are highlighted
https://github.com/lupyuen/bl_iot_sdk/blob/lorawan/.vscode/c_cpp_properties.json
Reference Implementation of Semtech #LoRaWAN Stack is here ... Includes drivers for SX1262 and SX1276
Bought the RAKwireless #LoRaWAN Gateway: #WisGate Developer D4H ... Will benchmark this with #Pine64 LoRa Gateway (Also based on RAKwireless RAK2287)
https://docs.rakwireless.com/Product-Categories/WisGate/RAK7248/Datasheet/
#ChirpStack on RAKwireless #WisGate can generate random Application Keys for #LoRaWAN Over-The-Air Activation (OTAA) ... We shall use keys to activate our #BL602 and #WisBlock devices wirelessly
https://www.thethingsindustries.com/docs/devices/abp-vs-otaa/
Something (or Someone) is transmitting #LoRaWAN Packets every minute ... Signal Strength (RSSI) shows that they're a few hundred metres away
https://gist.github.com/lupyuen/8dacf002196507695a7624ef7f80a34f
Based on earlier #LoRa Coverage Testing (with #BL602 and #WisBlock) ... High chance that our Mystery #LoRaWAN Transmitter is at the nearby Subway Station 🤔
https://lupyuen.github.io/articles/wisblock#analyse-the-lora-coverage
Someday I might walk around with RAKwireless #WisGate to find the Mystery #LoRaWAN Transmitter ... But for now let's test WisGate with WisBlock and BL602!
https://docs.rakwireless.com/Product-Categories/WisGate/RAK7248/Datasheet/
Still fixing #LoRaWAN Driver for #BL602 ... So let's test WisGate with WisBlock first
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/components/3rdparty/lorawan
#LoRaWAN Driver for #BL602 ... One last build error
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/components/3rdparty/lorawan
#LoRaWAN Driver for #BL602 ... Builds and links OK yay! 🎉 Heading out for second dose of Moderna ... And some downtime
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/components/3rdparty/lorawan
Let's test RAKwireless #WisGate with #WisBlock ... With this #Arduino #LoRaWAN program ... Once I get home from vaccination
https://github.com/RAKWireless/WisBlock/tree/master/examples/RAK4630/communications/LoRa/LoRaWAN
#WisBlock #LoRaWAN sample fails to compile ... Let's find out why 🤔 (Hope it's not because of the vaccination)
https://github.com/lupyuen/wisblock-lorawan/blob/master/src/main.cpp
#WisBlock #LoRaWAN sample now builds OK ... After upgrading SX126x Arduino Library to Version 2 ... Released 2 weeks ago!
https://github.com/lupyuen/wisblock-lorawan/blob/master/platformio.ini#L15
We copy the Device EUI and Application Key from #WisGate #ChirpStack to the #WisBlock #LoRaWAN client ... For Over-The-Air Activation (OTAA)
https://github.com/lupyuen/wisblock-lorawan/blob/master/src/main.cpp#L46-L53
#WisBlock joins the #WisGate #LoRaWAN Network ... And gets accepted!
https://github.com/lupyuen/wisblock-lorawan/blob/master/src/main.cpp
What's inside the #LoRaWAN Packet received by #WisGate #ChirpStack? Check the Device Data ... "Hello!"
Inside the #LoRaWAN Join Network Request (Over-The-Air Activation) ... Received by #WisGate #ChirpStack from #WisBlock
#LoRaWAN Receive Windows are explained in the LoRaWAN Specs
https://lora-alliance.org/resource_hub/lorawan-104-specification-package/
Oops Mynewt's #LoRaWAN Carrier Sensing implementation is outdated ... Semtech's LoRaWAN Reference Implementation does NOT require Carrier Sensing outside Japan and South Korea ... So we disable Carrier Sensing and use a random LoRa Frequency Channel
After disabling #LoRaWAN Carrier Sensing ... #BL602 hits an Exception while transmitting the Join Network Request ... Let's lookup these addresses in the RISC-V Disassembly
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
#BL602 is now transmitting the #LoRaWAN Join Network Request ... But doesn't receive any response from our LoRaWAN Gateway (WisGate) ... Let's check the WisGate LoRaWAN Log
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
#WisGate #ChirpStack you're so funny ... I'm nowhere near Chinese Garden, Japanese Garden and Jurong Bird Park 😂
Sadly our #WisGate #LoRaWAN Gateway didn't receive any LoRaWAN Packets transmitted by #BL602 ... Let's look inside the transmitted packets ... And verify the transmission with Airspy SDR
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
Airspy SDR verifies that #BL602 is indeed transmitting the Join #LoRaWAN Network packet ... Maybe it contains garbage 🤔
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
Here's the "Join Network" #LoRaWAN Packet transmitted by #BL602 ... Does this look right? 🤔 Let's compare with WisBlock
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
#LoRaWAN "Join Network" Packet transmitted by #WisBlock ... Looks similar to the one transmitted by BL602 ... Nonce and Message Integrity Code will differ of course
https://github.com/lupyuen/wisblock-lorawan/blob/master/README.md#output-log
#LoRaWAN Packet: #BL602 vs #WisBlock ... Seems BL602 is transmitting at Lower Power than WisBlock ... Let's check the Power Amplifier settings 🤔
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
#BL602 vs #WisBlock: Join #LoRaWAN Network Request ... Let's check the Nonce and Message Integrity Code ... Wonder if we can retransmit the BL602 packet from WisBlock 🤔
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
Let's copy the Join #LoRaWAN Network Request generated by #BL602 ... And retransmit with #WisBlock ... Surprise: the Join Request succeeds! 😲 Which proves the Nonce and Message Integrity Code are OK ... Probably the BL602 Power Amplifier setting is wrong 🤔
https://github.com/lupyuen/bl_iot_sdk/tree/lorawan/customer_app/sdk_app_lorawan#output-log
But wait: Will #LoRaWAN allow replayed "Join Network" Requests? 😲 Nope it doesn't! #WisGate #ChirpStack will reject Replayed Requests because the Nonce needs to be unique ... Here's how we find Nonce Errors in RAKwireless WisGate
Taking a short BL602 break ... To write about everything I've done with #RAKwireless #WisGate
https://docs.rakwireless.com/Product-Categories/WisGate/RAK7244C/Quickstart/
@lupyuen
You rock Prof. If You needed adopting clang or fixing that 1bytedma transfers i got some spare resources.
@lupyuen how on earth do you keep a list of used nonces sensibly?
@lupyuen you could use a bloom filter or similar, but then how would you time them out?
@lupyuen
Pretty capture
When #BL602 hunts for the next #LoRa Frequency Channel to transmit (Spread Spectrum) ... It listens to the airwaves to check whether the channel is in use ... Let's find out whether BL602 is doing Carrier Sensing correctly 🤔
https://github.com/lupyuen/bl_iot_sdk/blob/lorawan/components/3rdparty/lorawan/src/mac/region/RegionAS923.c#L914-L982