This repository aims to make LoRa Basics Modem available in Zephyr. It wraps the existing SWL2001 repository from Semtech.
At term, this repository might be merged into the upstream Zephyr project.
This is an experimental release of demo projects of LBM on Zephyr, tested on LR11xxMB1LxKS shields
You can use this module either as your "west manifest project", or include it in
another project. In that case you need to add import: true
to the caller configuration, as this:
projects:
- name: lbm_zephyr
path: modules/lbm_zephyr
remote: lora-net
repo-path: lbm_zephyr
revision: main
import: true
You need a recent Linux distribution (Python >= 3.10, CMake >= 3.20.5).
You need to install the Zephyr SDK (compiler and flashing tools) and west (the build system tool).
Please follow instructions at https://docs.zephyrproject.org/latest/develop/getting_started/index.html. You will only need to follow this step only once for all your Zephyr projects.
If it's not installed in your system, you need to load the Zephyr SDK environment each time you open a new terminal:
source ~/zephyrproject/.venv/bin/activate
This repository only contains specific LBM port code and the samples. We also need to download Zephyr itself, LBM, and associated HAL modules.
You need to create an empty directory, let's name it lbm_zephyr_workspace
, and clone the current repository inside it.
mkdir lbm_zephyr_workspace
cd lbm_zephyr_workspace
git clone git@github.com:lora-net/LBM_Zephyr.git lbm_zephyr
The SWL2001
repository will be automatically downloaded, you don't need to clone it yourself.
Then, initialize West (the build tool): Multiple repositories will be automatically downloaded inside the workspace directory.
west init -l lbm_zephyr
west update
It will take 3-10 minutes to run depending on your network connection.
You will need to run this step for every project you download.
If major updates to lbm_zephyr
are provided, you might need to run west update
again.
Samples are in the lbm_zephyr/samples
directory, split in two classes:
- lora_drivers: Samples only using the low level LoRa drivers
- ping_pong : Flash this sample to two boards to see them talk.
- ping_shell : Same as ping_pong, but manually, using the Zephyr shell ! run
lorademo ping
in one board to ping the other flashed board.
- lora_basics_modem: Samples leveraging the LBM stack to communicate with LoRaWAN networks.
- app_demo_periodical_uplink: This sample joins a network and periodically sends packets.
You can also send a packet manually by pressing the button (on nRF52840dk it's BUTTON 1).
Please configure your device EUIs/App keys in
src/example_options.h
- app_lbm_hw_modem: used for continuous integration tests. It expects serial communication on an UART port.
Read
src/hw_modem/cmd_parser.c
for explanations.
- app_demo_periodical_uplink: This sample joins a network and periodically sends packets.
You can also send a packet manually by pressing the button (on nRF52840dk it's BUTTON 1).
Please configure your device EUIs/App keys in
You need to inform Zephyr which board and shield you want to use. Shields are in the lbm_zephyr/boards/shields/*
directories as .overlay
files.
They describe which transceiver model you are using. For example, semtech_lr1110mb1xxs
.
Go into a sample's directory, then run:
west build --board nrf52840dk/nrf52840 -- -DSHIELD=semtech_lr1110mb1xxs
# or
west build --board nucleo_l476rg --build-dir build_nucleo -- -DSHIELD=semtech_lr1110mb1xxs
It will build your project in the build
subdirectory (can be configured by --build-dir
).
You can pass --pristine
to ensure the build directory is clean.
The boards are expected to have a lora0
node label. The shield semtech_lr1110mb1xxs
provides it.
You might want to customize the LoRa transceiver configuration by adding a file in the boards
subdirectory or via app.overlay
.
For example, to set a TCXO instead of the default XTAL:
&lora_semtech_lr11xxmb1xis {
tcxo-wakeup-time = <7>;
};
west flash
# or
west flash --build-dir build_nucleo
For the nRF52840-DK board, you don't need to close open serial ports during flash.
You can use minicom, picocom, tio,…
tio /dev/serial/by-id/usb-SEGGER_J-Link_*-if00