Implementation of LoRaWAN end node example project for MAMWLE module using source code generated by STM32CubeMX (firmware package ver 1.2 for STM32WL family).
The example is set for sending a 1-byte payload on port 2 every 10 seconds. The 1-byte payload starts from 0 and goes up to 255 and is incremented by one at each packet transmission.
All the settings can be found within the .ioc file. LoRaWAN configuration can be customized from within STM32CubeMX software using the parameters located in "Pinout & Configuration" tab / "Middleware" category / LORAWAN.
It is possible for the user to edit the STM32CubeMX project settings and regenerate the source code: the customization is done in a way that makes them unaffected by code regeneration. The default LoRaWAN keys are not set, the user has to configure them as required by the network in use.
-
Open the included .ioc file with STM32CubeMX, set the options as needed and generate code to an empty folder.
-
Generated code will not compile because BSP files are missing. Add the BSP folder inside "project_root/Drivers", this folder includes the following files:
-
stm32wlxx_nucleo.h: dummy file for fixing reference by STM32CubeMX genetared code and avoid compile error.
-
stm32wlxx_nucleo_errno.h: copied as-is from ST's project "LoRaWAN_End_Node" for NUCLEO-WL55JC.
-
stm32wlxx_nucleo_radio.c: copied as-is from ST's project "LoRaWAN_End_Node" for NUCLEO-WL55JC.
-
stm32wlxx_nucleo_radio.h: copied as-is from ST's project "LoRaWAN_End_Node" for NUCLEO-WL55JC.
These files won't be deleted by a new code generation with STM32CubeMX.
-
-
Open the project with STM32CubeIDE and inside project's properties go to "C/C++ Build" / "Build" / "MCU GCC Compiler" / "Include paths" and, for each build configuration, add the row "../Drivers/BSP" for including the new BSP folder.
-
Add code to lora_app.c for printing join status and sending example data packets: payload is 1 byte long, starts from 0 and is incremented at each transmission. This code is added under user code sections and is preserved in case code is generated again with STM32CubeMX.
- STM32CubeMX version 6.6.1
- STM32CubeWL Firmware Package V1.2.0
- STM32CubeIDE version 1.10.1
