LoRaWAN / Riot-OS Setup
Setting up a LoRaWAN application with Riot-OS on a STM32 LoRa and Sigfox Discovery Kit
- Operating system: Ubuntu 18.04 bionic amd64
- Packages: git
Install the following packages
sudo apt-get update sudo apt-get install git openocd gcc-multilib build-essential python-serial libudev-dev moserial
Install the toolchain
Move it to your home directory.
Uninstall old packages
sudo apt remove binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi
Unzip the downloaded file
tar -xjvf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2
Add the toolchain to your path
export PATH=$PATH:/home/(your user)/gcc-arm-none-eabi-7-2018-q2-update/bin/
git clone https://github.com/RIOT-OS/RIOT.git myRIOT
Build and run "Hello World" on the STM32 LoRa and Sigfox kit.
Set the rights for your username to be able to flash the application on the board.
sudo usermod -a -G dialout <username>
Then reboot your computer.
Attach the antenna to the board - never use it without the antenna! Connect the board to your computer via micro USB cable.
Start up moSerial and connect it with the board.
Build and flash the application.
cd myRIOT/examples/hello-world make BOARD=b-l072z-lrwan1 make BOARD=b-l072z-lrwan1 flash
If you do not use a serial terminal like moserial or terraterm use term
make BOARD=b-l072z-lrwan1 term
You may also set the BOARD in the Makefile of the application.
Create an application at the TTN (The Things Network).
Register at https://www.thethingsnetwork.org/ and login. Click on your user name and select "Console", and then click on "Applications" and then on "add application".
After filling in the name and description for your application click on "Add Application" (bottom right).
Register the board for your application by clicking on "Register device".
Enter a unique ID for your device and generate a device EUI. Then click on "Register".
The Device Overview shows all keys you need for your code.
Now you can copy each key and paste it in your Makefile (cf. Step 6).
Build and run LoRaWAN Riot application.
Now edit the Makefile: insert device EUI, application EUI, and application key.
Build the applictation and flash it to the board.
make BOARD=b-l072z-lrwan1 make BOARD=b-l072z-lrwan1 flash term
Goto to your TTN account and click on "Data" - there you can see the incoming data.
If you get "Join procedure failed" output and all your EUIs in the makefile are correct, then press the RESET button (black) on your board.