LoRa-E5-mini
Project LoRa E5 | |
---|---|
Arduino on the LoRa-E5-mini devboard | |
Status | In progress |
Contact | bertrik |
Last Update | 2021-10-17 |
The plan
This page is about the LoRa-E5 module and getting it to work as a LoRaWAN node with Arduino and the BasicMac stack.
- replace the original "AT" firmware with Arduino based firmware
- use the BasicMac library for LoRaWAN
- use platformio as the build system
- create some basic examples for use as a LoRaWAN node on TheThingsNetwork
Interesting post about this module: https://www.disk91.com/2021/technology/lora/lora-e5-the-seeed-studio-stm32-wl-module/
What currently works:
- can run an Arduino program, compiling from the Arduino IDE
- blinking the LED works
- output over serial works (as software serial for now)
TODO, yet to figure out:
- make PB6/PB7 work as hardware serial port with Arduino
- figure out which UART is used with Arduino on STM32
- make pin alternate function mapping work
- just enable the define HAL_UART_MODULE_ENABLED (where!?), see https://github.com/stm32duino/Arduino_Core_STM32/blob/main/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/PeripheralPins.c#L136
- get communication going using the internal "subghz" SPI port
- do I need to enable the APB3 clock domain?
- get a simple transfer going that proves that meaningful data is exchanged (e.g. default sync word magic number)
- get basicmac stack working with the "subghz" SPI port (it appears all communication is done using just "SPI")
- get compilation and upload working with platformio
Hardware
The hardware is the LoRa-E5 mini from seeed studio, contains the STM32WLE5JC:
- LoRa E5 Seeed studio module (just the chip): https://www.seeedstudio.com/LoRa-E5-Wireless-Module-p-4745.html
- LoRa E5 Seeed studio LoRa-E5 mini dev board: https://www.seeedstudio.com/LoRa-E5-mini-STM32WLE5JC-p-4869.html
- LoRa E5 Seeed studio wiki page: https://wiki.seeedstudio.com/LoRa-E5_STM32WLE5JC_Module/
- FCC information about the module: https://fccid.io/Z4T-LORA-E5/
Overview of pins used on this board (not completely standard): https://wiki.seeedstudio.com/LoRa_E5_mini/#22-gpio-configuration-overview
LoRa modem
It appears the LoRa functionality is exposed through an internal SPI bus, called SUBGHZSPI in the datasheet.
Also, there are some pins to control the radio path.
Software
Initial experimental firmware can be found at: https://github.com/bertrik/lora-e5
- blinky example, the most basic of all sketches which makes a LED blink demonstration of successful download of an Arduino program
- helloworld example, sends a text over the serial port
These examples still uses the Arduino IDE, with a 'generic' STM32WLE5JCI.
There appears to be support for various kinds of WL55 boards in the stm32duino project: https://github.com/stm32duino/Arduino_Core_STM32/blob/main/boards.txt
Support for a generic WLE5JCI board here in the stm32duino archive: https://github.com/stm32duino/Arduino_Core_STM32/blob/main/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/boards_entry.txt#L62
How to add a new variant (board): https://github.com/stm32duino/wiki/wiki/Add-a-new-variant-(board)
Development environment
- Install Arduino IDE, from https://www.arduino.cc/en/software
- Add a board URL: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
- Under menu Tools/Board/Boards manager, search for STM32 and install 'STM32 MCU based boards'
- Under menu Tools/Board/STM32 boards, choose 'Generic STM32WL series', then 'Generic STM32WL series'
- Under menu Tools/Board part number, choose Generic WLE5JCIx'
- Install STM Cube for the upload tools, they are called en.stm32cubeprg-lin_v2-8-0_v2.8.0.zip
- Run STM Cube to remove read protection (and erase the device)
Load the .ino file. Compile with ctrl-R. Upload with ctrl-U.
Experimental development environment
This uses my own fork, which will include support for the Seeed LoRa E5 mini.
- Install Arduino IDE, from https://www.arduino.cc/en/software
- clone my archive into ~/.arduino15/
- cd ~/Arduino/hardware
- mkdir -f stm32
- cd stm32
- git clone https://github.com/bertrik/Arduino_Core_STM32
- Under menu Tools/Board/STM32 boards .... (sketchbook), choose 'Generic STM32WL series', then 'Generic STM32WL series'
- Under menu Tools/Board part number, choose 'Seeed Studios LoRa E5 mini'
- Install STM Cube for the upload tools, they are called en.stm32cubeprg-lin_v2-8-0_v2.8.0.zip
- Run STM Cube to remove read protection (and erase the device)
Load the .ino file. Compile with ctrl-R. Upload with ctrl-U.
Programming over SWD
Connect an ST-LINKv2 as follows:
- SWDIO to PA13
- SWCLK to PA14
- GND to GND
Getting it to work
Got a flashing LED sketch to work:
- install Arduino IDE, e.g. 1.8.16
- install the STM32 support
- add through menu File / Preferences / Additional board manager URLs
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
- under menu Tools / Board / Board manager, search for stm32 and install the board package
- select the right board:
- WLE5JCIx
- upgrade the firmware of my stlink2 (tool from ST), currently at V2J38S7
- run the cubestm environment to use the stlink2 to disable the firmware protection
- flash a simple blinky sketch to the board
Serial port does not work yet, it is connected to PB6/PB7. I need to configure an alternative setting for the pins, don't know exactly how to do that on Arduino:
- https://www.stm32duino.com/viewtopic.php?t=714
- https://forum.arduino.cc/t/pb6-and-pb7-as-serial-problem/546184
Node configuration in TheThingsNetwork
The information on the website of Seeed studios is outdated. It refers to the "v2" version of TheThingsNetwork, which is being phased out. It is already impossible to add new nodes on TTNv2, since it was set to read-only.
Nodes should be configured for TheThingsNetwork v3 instead.