Developing firmware for devices that uses LoRaWAN can be a frustrating experience, particularly if you have to integrate a new radio chipset into the framework of your choice; documentation can be so-so, the API might not be completely updated and the BSP porting guide can be a bit brief on the details.
Here are a few of the tricks that helps debugging and troubleshooting the development:
Get your hands on an SDR
A software defined radio combined with the excellent [gqrx] application makes it easy to see if and when the device sends something on the air. The SDR doesn’t have to be expensive; a simple USB dongle like the RTL2832 from Adafruit is enough. If you have a slightly bigger budget you can use the HackRF One from Great Scott Gadgets.
This way you’ll see if the device is actually doing anything on the air or not and at which frequencies it uses.
Once the “does it even send anything?” question is answered you can move on to the next: “is it connecting?”
Get a simple concentrator and gateway
If you can run your own LoRa concentrator, gateway and stack you’ll see if the device is able to communicate with the gateway. The standard packet forwarder will show you what data the gateway receives and sends (albeit in a slightly confusing log format).
There are lots of relatively cheap gateways and concentrators out there. You can build one yourself from a Raspberry Pi and an IC880A board (about €150 for the board and an antenna plus whatever Raspberry Pi you have available) or you can buy a prebuilt one (about $100)
Run your own application and network service
The final step is fortunately quite simple - getting the device to connect to a service but there’s still room for quite a bit of headscratching and debugging if you are unfamiliar with the LoRaWAN stack on your device. If you can run a scaled-down LoRa stack you will be able to debug connectivity issues on the application level like incorrecly configured keys, device EUIs and so on.
It does require a bit of effort to get a stack up and running but it might be worth it if you are stuck. ChirpStack is an excellent alternative. A slightly simpler alternative is to run the (now quite old) Congress service. It’s not actively maintained but still builds on recent Go versions.
…finally: Don’t give up
This is probbaly the best trick there is: Don’t give up. Dig around in the LoRaWAN stack you have, print debugging messages and keep digging until you get to the “oh, it’s that!” moment.