-
Notifications
You must be signed in to change notification settings - Fork 0
home
Software for the DPP2 LoRa Comboard (STM32L4 MCU + SX126x radio) based on the Dual Processor Platform (DPP) architecture developed by the Computer Engineering Group (TEC) at ETH Zurich.
The flora software consists of the following components:
-
Flora Library: The
flora-lib
(C code) is a library of software components shared by multiple projects (flora apps). It contains radio drivers, protocol implementations, utilities, etc. -
Flora Apps: Projects based on the
flora-lib
. See list below for details. -
SX1262 Python Library: The
sx1262
Python library implements a model of the SX1262 radio chip. For example it allows to calculate the time-on-air (ToA) for LoRa or FSK transmissions.
App | Description | Status |
---|---|---|
Hello World | Simple hello world/blinky application that uses the flora-lib and is compatible with the baseboard. | stable |
eLWB | Event-triggered Low-Power Wireless Bus implementation | stable |
LWB | A simplified version of the Low-Power Wireless Bus. | initial version |
Linktest | Point-to-point link test for running on FlockLab 2 (measures packet reception ratio, RSSI, and CRC errors). | stable |
NOTE: The Status information is indicative only and in no way provides any guarantees regarding the state of the software. All software must be considered experimental, since in most cases no exhaustive testing has been performed.
- Select one of the flora apps (see list above)
-
Clone project (including submodules):
git clone --recursive <git url>
- Open the project in the STM32CubeIDE: File > Open Projects from File System
- Create auto-generated files with STM32CubeIDE
- In STM32CubeIDE, open the project's
.ioc
file by double clicking (this may take a moment) - Generate the auto-generated code: Project > Generate Code
(or click the "Device Configuration Tool Code Generation" (button with yellow cog wheel)) - Wait until the code generation has finished (check status in lower right corner of the IDE window!)
- In STM32CubeIDE, open the project's
- Make sure that all configuration parameters in the project's config file
Inc/app_config.h
are set according to your needs. -
Compile the code by selecting:
Project > Build Project -
Flash the code by selecting (NOTE: this step requires a JLink debug probe connected to the sx126x (dpp2lora) comboard):
Run > Debug
- Some of the flora apps provide scripts to run tests on the FlockLab 2 testbed.
- Shell script: e.g.
run_flocklab_test.sh
- Python script (uses the flocklab-tools): e.g.
run_flocklab_test.py
- Shell script: e.g.
- All projects are created and edited using the STM32CubeIDE (combination of former Atollic TrueStudio and STM32CubeMX)
- Based on eclipse
- Main config of IDE project is stored in
.cproject
file - Config of architecture (GPIOs etc.) are stored in
.ioc
file.
-
Application configuration is stored in
app_config.h
(no further includes allowed in this file).- Source files should only include
main.h
, which itself includesapp_config.h
.
- Source files should only include
-
Drivers and Middlewares: All files in the
Middlewares
andDrivers
directory in the root of each flora app project must not be modified manually as they are auto-generated by STM32CubeIDE. -
User Code Sections: All files which include sections starting with
USER CODE BEGIN
and end withUSER CODE END
must only be modified inside these user code sections. The rest of the code is auto-generated by the STM32CubeIDE and will be overwritten once the settings in STM32CubeIDE are modified and the code is generated again. -
ioc File: The
.ioc
config file must be modified only by using the STM32CubeIDE software!
- DEVKIT: Development Kit (Nucleo L476RG + SX126xDVK1xAS)
- COMBOARD: DPP2 LoRa communication board (e.g. used on FlockLab 2 testbed, together with the DPP2 DevBoard, or together with the BaseBoard)
- USART1: Serial communication over USB
- SysTick: FreeRTOS
- TIM1: SYS (HAL Delay)
- TIM2: System Time (incl. timing of radio)
- TIM15: (spare timer)
- TIM16: PWM of breathing status LED
- LPTIM1: Time-triggered wake-up from low-power mode
- SPI1: BOLT
- SPI2: SX1262 Radio
- We use FreeRTOS provided by STM32CubeIDE
- FreeRTOS settings are configured in STM32CubeIDE in the
.ioc
file and by automatically generating the files inside STM32CubeIDE. -
FreeRTOS tasks are NOT created and managed by STM32CubeIDE in the
.ioc
file. They are manually created in the "USER CODE" sections inside the genrated files. Each task should live in its own.c
file in theSrc
directory of the flora app.
STM32L433 Pin | DPP Pin | DPP Mode | DevBoard | FlockLab 2 Pin | FlockLab 2 Mode | BaseBoard | Comment |
---|---|---|---|---|---|---|---|
PH3 (BOOT0) | COM_GPIO1 | I/O | DEBUG 7 | LED1 | trace | DPP_Colibri_WAKE | Connected to SX1262 RFDIO1 on FlockLab (MCU input) |
PB3 (SWO) | COM_GPIO2 | I/O | DEBUG 8 | LED2 | trace | Colibri_EN | |
PA13 (SWDIO) | COM_PROG2 | I/O | DEBUG 9 | LED3 | trace | MCU GPIO output | |
PA3 | COM_TREQ | ? | INT1 | trace | MCU GPIO output | ||
PA14 (SWCLK) | COM_PROG | ? | INT2 | trace | MCU GPIO output | ||
PA0 | COM_IND | ? | SIG1 | actuate | MCU GPIO input | ||
PA4 | APP_IND | ? | SIG2 | actuate | MCU GPIO input |
NOTES:
- On FlockLab 2
- Tracing pins
INT2
andLED3
are shared with the SWD debug interface and can therefore not be used when forwarding the debug session. - Tracing pin
LED2
is shared with the SWO pin and must be configured in SWO mode if data tracing is enabled. - Tracing pin
LED1
is connected to theRFDIO1
pin of the SX1262 radio. As a consequence,PA15
must be configured as an input pin on FlockLab.
- Tracing pins
- Also see FlockLab 2 Pin Mapping
Flora modulations as defined in radio_constants.c
:
Index | Modulation | Physical Bitrate | Range |
---|---|---|---|
0 | LoRa SF12 | 293 bit/s | long-range |
1 | LoRa SF11 | 537 bit/s | ... |
2 | LoRa SF10 | 977 bit/s | ... |
3 | LoRa SF9 | 1758 bit/s | ... |
4 | LoRa SF8 | 3125 bit/s | ... |
5 | LoRa SF7 | 5469 bit/s | ... |
6 | LoRa SF6 | 9375 bit/s | ... |
7 | LoRa SF5 | 15625 bit/s | ... |
8 | FSK 125k | 125 kbit/s | ... |
9 | FSK 200k | 200 kbit/s | ... |
10 | FSK 250k | 250 kbit/s | short-range |
Calculation of the time-on-air (ToA) of a packet is not straight-forward since the duration depends on many parameters and conditions. Options to determine the ToA:
- Formula for calculating the ToA of LoRa packets is given in the SX1262 datasheet.
-
flora-lib
(C code) provides the following methods:-
gloria_get_toa()
: uses current modulation setting of gloria_interface, output in us -
gloria_get_toa_sl()
: uses provided modulation index, output in us -
radio_get_toa()
: uses provided modulation index, output in us -
radio_get_toa_hs()
: uses provided modulation index, output hs_timer ticks -
radio_get_toa_arb()
: arbitrary radio config, output in us
-
-
sx1262
(Python library):- for flora modulations according to
radio_constants.c
: useflora_toa(modIdx, phyPlLen)
- for arbitrary radio settings: use the
LoraConfig
andFskConfig
classes
- for flora modulations according to
Relations:
-
slot_time
=slotOverhead
+toa(mod, msgSize)
-
reconstructed_marker
=last_sync_ts
-txSync
-slot_index
*slot_time
-floodInitOverhead(mod)
-
current_tx_marker
=reconstructed_marker
+floodInitOverhead(mod)
+slot_index
*slot_time
Problem: Power consumption is too high if put radio to sleep and MCU to STOP2 (around 800 uA instead of around 5 uA)
Solution: Make sure that the interrupt status flag of GPIO EXTI interrupt (PC13, RF_DIO1) is cleared before entering STOP2:
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_13);
Problem: MCU wakes up immediately after entering STANDBY or SHUTDOWN mode when a message was sent with the radio before entering STANDBY or SHUTDOWN mode.
Solution: Clear interrupt status flags of all WAKEUP lines:
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
-
RadioSetRxConfig()
behavior- flora-lib: RadioSetRxConfig expects double-sided bandwidth (DSB)
- Reference implementation: RadioSetRxConfig expects single-sided bandwidth (SSB)
- also see issue 928
DPP2 DevBoard needs a hardware fix to enable RTT / SWO print debug output (wire between SWO pin from COM JTAG and COM_GPIO2 pin from DEBUG header). In addition SWO_ENABLE
needs to be set to 1
in app_config.h
. In addition, in the SWO settings in the STM32CubeIDE, port 0 needs to be selected/checked!
- In
Project Properties > C/C++ Build > Settings > Build Steps > Post-build Steps
add the following command
arm-none-eabi-objcopy -O binary <project name>.elf <project name>.bin
- If used in terminal,
binutils-arm-none-eabi
package needs to be installed
- In
Project Properties > C/C++ Build > Settings > Build Steps > Post-build Steps
add the following command
arm-none-eabi-objcopy -O ihex <project name>.elf <project name>.hex
- If used in terminal,
binutils-arm-none-eabi
package needs to be installed
- Install Segger "J-Link Software and Documentation Pack" (link)
- Use the
JRunExe
./JRunExe' -device STM32L433CC -if SWD -speed 4000 <image name>.elf
- NOTE: Using the
JLinkExe
tool was not successful so far (except on FlockLab2 with hex file) because erase command always fails
- flocklab-tools Python package
Example:
from flocklab import Flocklab
fl = Flocklab()
value = fl.readSymbolValue(elfPath, symbName, signed=False)
fl.writeSymbolValue(elfPathPatched, symbName, symbReplace, signed=False)
Guides in DPP wiki contain further infos about:
- Access serial output (UART) of the DPP2 ComBoard (on DevBoard)
- A guide to low-power modes
The name Flora is a combination of flock and LoRa.
See License file.
Please contact us if you have feedback, proposals, bug reports, etc.
Reto Da Forno
Technical Staff
Roman Trüb
PhD Student
- Roman Trüb: PhD student
- Reto Da Forno: Technical staff
- Markus Wegmann: Master thesis FS2018
- Michael Keller: Semester thesis FS2018, Master thesis HS2018
- Andreas Biri: PhD student
- Tobias Gatschet: Master thesis HS2019
- Tobias Kuonen: Master thesis HS2020
Component | License | Location in repo | Contained in repo |
---|---|---|---|
cJSON | MIT License | /flora-lib/cli/cJSON |
yes |
SX126x Radio Drivers (by Semtech) | BSD-3-Clause | /flora-lib/radio/semtech |
yes |
STM32CubeIDE generated code | Ultimate Liberty License SLA0044/SLA0048 or BSD 3-Clause |
/<app>/Drivers , /<app>/Startup , /<app>/Src , and /<app>/Inc
|
partially (only files in Src and Inc ) |
FreeRTOS | MIT license | /<app>/Middlewares |
no |