Skip to content

LoRa: Initial integration of LoRa Basics Modem for LoRa API & SX126x and SX127x #89241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions MAINTAINERS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5274,6 +5274,15 @@ West:
labels:
- "area: Storage"

"West project: lora-basics-modem":
status: maintained
maintainers:
- JordanYates
files:
- modules/lora-basics-modem/
labels:
- "area: LoRa"

"West project: loramac-node":
status: maintained
maintainers:
Expand Down
13 changes: 13 additions & 0 deletions doc/connectivity/lora_lorawan/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,25 @@ to the internet through a gateway.
The Zephyr implementation is based on Semtech's `LoRaMac-node library`_, which
is included as a Zephyr module.

.. note::

``LoRaMac-node`` has been deprecated by Semtech in favor of
`LoRa Basics Modem`_. Porting the Zephyr API's to use
``LoRa Basics Modem`` as the backend is in progress.

Currently, only the base LoRa API is supported for the SX1261, SX1262,
SX1272 and SX1276 chipsets through
:kconfig:option:`CONFIG_LORA_MODULE_BACKEND_LORA_BASICS_MODEM`.


The LoRaWAN specification is published by the `LoRa Alliance`_.

.. _`Semtech Corporation`: https://www.semtech.com/

.. _`LoRaMac-node library`: https://github.com/Lora-net/LoRaMac-node

.. _`LoRa Basics Modem`: https://github.com/Lora-net/SWL2001

.. _`LoRa Alliance`: https://lora-alliance.org/

Configuration Options
Expand Down
23 changes: 3 additions & 20 deletions drivers/lora/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

# LoRa drivers depend on the include directories exposed by the loramac-node
# library. Hence, if it exists then the source files are added to that otherwise
# a library with same name is created.
if(TARGET loramac-node)
set(ZEPHYR_CURRENT_LIBRARY loramac-node)
else()
zephyr_library_named(loramac-node)
endif()
zephyr_sources_ifdef(CONFIG_LORA_SHELL shell.c)

zephyr_library_sources_ifdef(CONFIG_LORA_SHELL shell.c)
zephyr_library_sources_ifdef(CONFIG_HAS_SEMTECH_RADIO_DRIVERS hal_common.c)
zephyr_library_sources_ifdef(CONFIG_HAS_SEMTECH_RADIO_DRIVERS sx12xx_common.c)
zephyr_library_sources_ifdef(CONFIG_LORA_SX127X sx127x.c)

if (CONFIG_LORA_SX126X OR CONFIG_LORA_STM32WL_SUBGHZ_RADIO)
zephyr_library_sources(sx126x.c)
endif()

zephyr_library_sources_ifdef(CONFIG_LORA_SX126X sx126x_standalone.c)
zephyr_library_sources_ifdef(CONFIG_LORA_STM32WL_SUBGHZ_RADIO sx126x_stm32wl.c)
zephyr_library_sources_ifdef(CONFIG_LORA_RYLRXXX rylrxxx.c)
add_subdirectory_ifdef(CONFIG_LORA_MODULE_BACKEND_LORAMAC_NODE loramac_node)
add_subdirectory_ifdef(CONFIG_LORA_MODULE_BACKEND_LORA_BASICS_MODEM lora_basics_modem)
23 changes: 20 additions & 3 deletions drivers/lora/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ menuconfig LORA

if LORA

choice LORA_MODULE_BACKEND
prompt "Low-level LoRa modem integration to use"

config LORA_MODULE_BACKEND_LORAMAC_NODE
bool "loramac-node backend"
depends on ZEPHYR_LORAMAC_NODE_MODULE

config LORA_MODULE_BACKEND_LORA_BASICS_MODEM
bool "LoRa Basic modem backend [EXPERIMENTAL]"
depends on ZEPHYR_LORA_BASICS_MODEM_MODULE
depends on DT_HAS_SEMTECH_SX1262_ENABLED || DT_HAS_SEMTECH_SX1261_ENABLED || DT_HAS_SEMTECH_SX1272_ENABLED || DT_HAS_SEMTECH_SX1276_ENABLED
select USE_LORA_BASICS_MODEM_DRIVERS
help
Experimental support for implementing the LoRa API using the LoRa Basics Modem module.

endchoice

module = LORA
module-str = lora
source "subsys/logging/Kconfig.template.log_config"
Expand All @@ -31,8 +48,8 @@ config LORA_INIT_PRIORITY
help
System initialization priority for LoRa drivers.

source "drivers/lora/Kconfig.sx12xx"

source "drivers/lora/Kconfig.rylrxxx"
rsource "Kconfig.sx12xx"
rsource "Kconfig.rylrxxx"
rsource "lora_basics_modem/Kconfig"

endif # LORA
15 changes: 15 additions & 0 deletions drivers/lora/lora_basics_modem/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0

# LoRa drivers depend on the include directories exposed by the lora_basics_modem
# library. Hence, if it exists then the source files are added to that otherwise
# a library with same name is created.
if(TARGET lora_basics_modem)
set(ZEPHYR_CURRENT_LIBRARY lora_basics_modem)
else()
zephyr_library_named(lora_basics_modem)
endif()

zephyr_library_sources(lbm_common.c)
zephyr_library_sources_ifdef(CONFIG_LORA_SX126X lbm_sx126x.c)
zephyr_library_sources_ifdef(CONFIG_LORA_SX127X lbm_sx127x.c)
zephyr_library_sources_ifdef(CONFIG_LORA_RYLRXXX ../rylrxxx.c)
16 changes: 16 additions & 0 deletions drivers/lora/lora_basics_modem/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2025 Embeint Inc
#
# SPDX-License-Identifier: Apache-2.0
#

if LORA_MODULE_BACKEND_LORA_BASICS_MODEM

config LORA_BASICS_MODEM_ASYNC_RX_MAX_PAYLOAD
int "Maximum size payload that can be received by async RX"
default 256
help
A buffer of this size is allocated on the system workqueue stack when
running the async RX handler.

endif
Loading
Loading