LoRaWAN end node built from scratch using STM32CubeIDE/CubeMX for the LoRa-E5 WLE5x
UPDATE 9 May 2023: you are invited to test the FW1.3 branch, which is the result of letting STM32CubeIDE update to V1.3 FW. I haven't tested it yet but I expect it will work. If you do test it, please let me know and I'll merge it to master.
UPDATE 14 July 2022: I reviewed the V1.2FM merge, enabled LoRaWAN 1.0.4 support (including NV storage of devNonce) and tested in Class A, turning the red LED on and off. I apologize for the flurry of updates in master; future updates will be done properly in a branch.
NOTE: I did a quick merge of STM32WLxx V1.2 firmware support. Basic testing shows it works correctly but please let me know if you encounter any issues.
If you're looking for an RAK3172 version of this, have a look at https://github.com/danak6jq/RAK3172
Note: the project defaults to disabling SWD/probe pins and enabling low-power mode. For development with an ST/Link, I recommend enabling the debugger and disabling low-power mode.
If you haven't used STM32CubeIDE before, I suggest doing a couple of smaller projects using ST Nucleo boards to familiarize yourself.
-
Please read Erase Factory AT Firmware section first, you need to retrieve and save the Device EUI, then erase the Factory AT Firmware before we program with SDK
-
Install V1.7.0 or later STM32CubeIDE(to compilation and debug) and STM32CubeProgrammer(to program STM32 devices). Launch STM32CubeIDE and install V1.1.0 of STM32Cube MCU Package for STM32WL series(SDK)
-
LoRaWAN Gateway connected to LoRaWAN Network Server(e.g. TTN; I am using a local gateway and local ChirpStack server)
-
Prepare an USB TypeC cable and a ST-LINK. Connect the TypeC cable to the TypeC port for power and serial communication, connect the ST-LINK to the SWD pins like this (recommend connecting Vcc and nRST as well):
- Before erasing the Seeed factory AT firmware, get the Device EUI. Connect a USB-C cable to the LoRa-E5, and send AT command AT+ID=DevEui to get your Device EUI:
- Do not lose this Device EUI; it is unique for each LoRaWAN device. If you manage to lose the Device EUI, you are able to retrieve it by scanning the QR code on the LoRa-E5 chip using a generic QR code scanner.
- Clone this repo onto a system with STM32CubeIDE, v1.7.0 or later. Using "Open Projects From Filesystem"
- Locate and open the top-level directory of the cloned repo:
-
Modify your Device EUI, Application EUI, Application KEY and your LoRawan Region
-
Use Cube to reconfigure the project to your LoRaWAN commissioning parameters:
and
- Save the IOC file and generate code when prompted:
- Note that generating code overwrites many files; in particular, if you've selected Hybrid Mode to operate a in a sub-band, you need to check and correct the channel mask after generating code - example here is for US915 Sub-band 2:
- Build project and program it into the LoRa-E5
- Use "Start a new project from an existing configuration file" and select "Seeed-LoRa-E5.ioc" in the repo
- This creates a new "End client framework" project with no user code (such as contained in the repo code) included. You'll want to refer to the repo code and ST documentation for using their LoRaWAN stack.