Configuring LoraWAN on a test bed

Hi everyone,

We use RIOT and the lorawan stack in a small product for research stuff. Everything looks good for the software, we are tracking last µA leaks in idle mode !

We will start to build more products and we want to make a test bed to do various checks (power supply, inputs, lorawan). Initializing the lora part can be done with the lorawan exemple, but it needs a programming sequence (~15s) , and various commands have to be sent to the device (~5s).

Our idea to speed up the process is to flash the eeprom part with the lorawan configuration and flash directly our application firmware. The binary blob of the lorawan configuration can be generated on the fly using the structure definition in RIOT source code, then merged into the firmware elf. We can contribute to RIOT for this config generator tool.

Actually, the openocd script of RIOT does not support a “flash-eeprom” command, and we are not familiar with it. Does the “flash” command can be used for that ?

Does someone have already done something similar, or can help me on the openocd part ?

Best regards,

William MARTIN

Maybe not precisely what you are looking for, but I've tackled the same problem under a different angle.

At start of main.c you find persist_loramac_state() and restore_loramac_state() that leverage SAML21 flash.

My dev board is a samr34_xpro; booting with BTN_0 pressed, my firmware enters "config mode", which is just a RIOT shell with a few commands (see configuration.c).

Code lacks documentation and is not particularly elegant, but hopefully it is readable enough to be helpful.



Thanks for this proposition, we will keep it as a backup solution.



What you are trying to achieve is indeed useful for deploying at large scale the same application but with different LoRaWAN configurations.

This page [1] seems to provide some answers to what you are trying to achieve: describe the eeprom location and size in the ldscript and generate a .bin containing only the eeprom. This .bin can be flashed at the eeprom start address (on the flash). I guess you are using an ST board so st-flash seems to be enough for flashing when the eeprom is empty.

So I’m not sure you have to merge the configuration in the elf, if you are able to generate a bin, you can flash it independently at the right location.

There is also this PR [2] that uses the persistense to LoRaWAN configurations on eeprom: this is useful when one uses standby sleep mode because the CPU is reset when it wakes up and the content of the RAM is lost.