STM32-WL is the new ST family supporting LoRa and LoRaWAN in, not a single chip but a single die. I did not yet written on it (busy busy busy) but this technology is really interesting as it resulting on a simplified architecture with less chip in your circuit and at the end a lower power consumption, a lower footprint and a lower cost.
LoRa-E5 from Seeed studio is a module containing a STM32-WL circuit and the associated RF circuitry to simplify design based on such chip. Its public price is $9.9 for the module alone and you can also find different boards using it. This price is in the maker market but a bit high for a such system for mass production. This module contains the stronger STM32WL family chip, chip price is 3.71€ / 1000 on mouser. But the module includes all the circuitry around and facilitate your design.
The module is mainly maker market and comes with software to be immediately used by end-user within an Arduino or equivalent environment. It can also be re-flashed for being used with your own software in it. The cortex M4 in is is stronger than most of the Arduino platform.
Let’s see what this chip is and how to use it.
As usual, I want to precise that Seeed Studio send me the chips for free to give them a test. I have no other obligation and I’m free to tell if I like it of not. But you may know that if I talk about that precise module in the STM32-WL large module family it is because I’ve been received them for free.
LoRa E5 characteristics
This module is based on STM32WLE5JC all-in-one chip from ST Microelectronics. This is the chip with the largest onboard memory and flash:
This chip has a 32bits Arm Cortex M4 CPU running at 48Mhz with 256K Flash and 64K RAM with only 32K retained in stand-by mode. I/O are 5V tolerant.
The module is composed by different sub-element around the STM32WLE5JC:
The E5 module conception is clean, most of the decoupling circuits are inside the module, limiting the need for external components.
Seeed is proposing different boards with the LoRa E5 depending on your need:
- The module as a standalone component you can use for your own PCB ($9.9)
- The LoRa-E5 mini board with a module you can control with a computer over USB or you can program at low level to make it a standalone board. This is more for experts (low level programming) or to add LoRaWan to a raspberry Pi or a computer for experimentation. It costs $19,90
- The LoRa-E5 grove module, is a little bit less expensive than the mini ($16.90) and no not have USB connectivity but serial connectivity over a grove connector if you have a UART grove connector on your device. (WioTerminal as an example is not compatible or you have to add the Battery Chassis). This version onboard an antenna composed by a simple net. You need to un-solder it for using a real antenna. But that one can work correctly in many cases.
- The LoRa-E5 development kit is much more powerful for making a single board application but you still need to go Low Level with that board. Basically it would had been better in my point of view to have an Arduino compatible chip on that board to control the LoRa E5 module and let the user to simply user the LoRa E5 as a module. Having multiple MCU is not optimized but it makes it more user-friendly. This is what we seen with Arduino MkrWan 1200 and MKrWan 1300 and it is efficient. As the LoRa E5 handle all the LoRaWan stack, the user of a simple atmega Arduino fits well in a such situation. So This board do not have an Arduino MCU on it at it makes it interesting if you go Low Level, so you can do the same as with the mini but this one has more connectors so you can use it w/o soldering. The price is $24,90.
Programming the LoRa-E5
As mentioned previously, the module is ready to be used with AT commands sent over a serial port. this is the way I’ll test it in this blog post. These commands can be sent by any device having an UART port, so it is the easiest way to use it.
You can also program it with the ST Microelectronic SDK, but this is more complex. I have in my backlog to add the STM32WL chips in my IT-SDK project. This will simplify the low-level programming. I’ll update my blog post once it’ll be done. Currently I’m a bit busy.
Let’s use the LoRa-E5
I’m going to use it from my computer using the LoRa E5 mini board. There is no specific setting to make. You need a serial tool like putty or Serial. Then you just connect to the device at 9600bps. You can get a first response by typing AT. The list of available AT commands are accessible from Seeed.
The way it responds is a bit unusual: the command is not proceeded after sending a CR (Return) character but as soon as a valid command is received and a certain wait. So basically if you try to type the commands in an interactive way you won’t be able to send a command like AT+ID as AT command will be executed before you sent the “+” char. So you need to transfer the commands as string, in one shot and not char by char.
This is a command timeout mode you can disable it by sending command AT+UART=TIMEOUT,0. After disabling the auto-timeout mode, you need to send a LF (CR+LF gives a better display) when return.
LoRaWAN is a complex protocol with many parameters depending on regional location, there is a large number of settings you can change with the AT commands. It sounds complex when reading the AT commands documentation but basically for a standard use, there is not so much of them you need to know.
Setup your device credentials
The configuration is stored in the modem eeprom so once it is configured you do not need to do it again. You can eventually have a serial configuration on your master device passing the data to the LoRa-E5 and not be obliged to store it (securely) in your main system.
To setup our device we need to define a radio zone, credentials (dev eui, app eui, app key) and select a communication speed:
AT+DR=EU868 # set the zone, can be U915... +DR: EU868 AT+ID=DevEUI,0B68BADE43C2FADE # set the DevEUI AT+ID=AppEUI,81263C32387B3144 # set the AppEUI AT+KEY=APPKEY,216BBEF3ADBBE2DXXXXXXXXXXXXXXXX AT+MODE=LWOTAA # set OTAA join mode AT+DR=DR3 # change speed for SF9 BW125
The credentials are obtained from your network operator, TheThingsNetwork, Helium…
The device configuration is not totally completed for real as only the standard channels are configured. So you only have 3 of the 8 possible channel enabled. So it’s better to also configure all the channels. These one vary depends on your operator. For Helium and TTN they are the following:
# channel configuration for Europe AT+CH=3,867.1,DR0,DR5 AT+CH=4,867.3,DR0,DR5 AT+CH=5,867.5,DR0,DR5 AT+CH=6,867.7,DR0,DR5 AT+CH=7,867.9,DR0,DR5
After these settings made your device is ready to join.
AT+JOIN +JOIN: Start +JOIN: NORMAL +JOIN: Network joined +JOIN: NetID 326548 DevAddr 48:00:00:42 +JOIN: Done # in case of problem during join you get +JOIN: Start +JOIN: NORMAL +JOIN: Join failed +JOIN: Done
Once joined we can fire a first message:
AT+MSGHEX=01020304 # send payload 0x01,0x02,0x03,0x04 / 4B +MSGHEX: Start +MSGHEX: Done or to send plain text AT+MSG=01020304 # send payload "01020304" / 8 chars +MSG: Start +MSG: Done
The responses from the module are not the more easy to proceed with an external MCU, it’s always something I won’t understand… how can we create a human based protocol to be read by a machine … It is costly in terms of development and source of many errors.
I think (if not yet existing) a library for Arduino could hide all of this to make it simpler to be used.
The LoRa-E5 module is on of the many STM32WL module available on the market. This one can be easily buy by makers on Seeed Studio, it is a plus. The price is correct for a module including the LoRaWAN stack and operating world wide. It can’t be compared to modules like RFM95 as RFM95 is just a radio chip, it does not provide the LoRaWan stack. LoRa-E5 can be used with tiny MCU like an Arduino Nano, Seeeduino, ESP32… The grove version is to prefer for such use.
If you are really good in C development, you can go to the CubeMx environment and the ST-Micro SDK, but you need to know it takes to get started in this environment to make something working correctly with other than the horrible code provided as part of sample code.
I’m not sure if this device can do Sigfox, so consider not before verifying.