I am working on a project to program LoRa-E5 with Arduino instead of STM32CubeIDE. I hope this will be helpful to those who are interested.
As a way to program LoRa-E5 directly, the Wiki shows an example of using STM32CubeIDE. While this method is very sophisticated, it is far too complicated for me. I have found that by using some nice libraries, RadioLib, STM32LowPower, STM32RTC, I can write sketches in my familiar ArduinoIDE. I have tried and posted some basic functionality as shown in the link below.
‘Programming LoRa-E5 with Arduino, Grove-LoRa-E5 sleep current 0.7uA’
‘Programming LoRa-E5 with Arduino, LoRa-E5 mini Battery Voltage Read’
‘Programming LoRa-E5 with Arduino, Comparison of LoRa-E5 and LoRa-E5-LE transmit currents’
I started an experiment to investigate the possible communication distance for point-to-point communication, which was my goal. First, I made a sketch of a point-to-point communication using a LoRa-E5 mini as Master and a LoRa-E5-LE mini as Slave.
The rules for my region are: transmit power less than 20 mW, bandwidth less than 200 kHz, antenna gain less than 3 dBi, and total transmission time per hour less than 360 seconds. The main LoRa parameters I set are freq=922.6MHz, power=13dBm, bw=125kHz, sf=12, cr=5, and send a 12-byte packet.
The sequence of operation is
- Master waits for a packet from Slave
- Slave sends a 12-byte packet (Slave’s UID, transmission time, battery voltage) and waits for a response from Master.
- Master receives the packet, checks the Slave’s UID and sends a 12-byte packet (Master’s UID, RSSI, SNR, dummy data) in response.
- Slave receives the packet, checks Master’s UID, then sleeps for 10 seconds in shutdown mode and wakes up with the RTC.
The device UID is used to check if the received packet is from the intended communication partner. By including Master’s RSSI and SNR in the response packet from Master, Slave can check the strength of its own signal. The activation method is to first activate Master to put it in a receive state, then activate Slave to start communication.
This is the sketch used for the experiment.
P2P_MasterSlave.zip (34.3 KB)
**** For reference ****
When compiled with ArduinoIDE2, the hex file is created in the folder below. Select and write the file with STA32CubeProgrammer.
In case of Windows
C:\Users\username\AppData\Local\Temp\arduino\sketches\32 digit HEX string\sketchname.ino.hex
In case of Linux
/tmp/arduino/sketches/32 digit HEX string/sketchname.ino.hex
IDE : ArduinoIDE 2.2.1
BSP : STM32 boards groups by STMicroelectronics 2.7.1
Borad select STM Boards groups / LoRa boars
Board part number LoRa-E5 mini (from Tools submenu 'Board part number')
Programmer : STM32CubeProgrammer
Uploader : ST-Link V2
Library : RadioLib 6.4.2 https://github.com/jgromes/RadioLib
STM32LowPower 1.2.5 https://github.com/stm32duino/STM32LowPower
STM32RTC 1.4.0 https://github.com/stm32duino/STM32RTC
So far, results of 3.5 km have been obtained, and further experiments are planned.
I hope this will be helpful to those who are interested.