Skip to content

Commit 91c99f3

Browse files
committed
drivers, dts: Add drivers for Semtech LoRa transceivers LR11xx, SX126x
Those drivers are actually device tree bindings, and HAL/BSP as described in https://github.com/Lora-net/SWL2001/blob/master/lbm_lib/PORTING_GUIDE.md Signed-off-by: Félix Piédallu <[email protected]>
1 parent 561c615 commit 91c99f3

26 files changed

+3024
-0
lines changed

drivers/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
12
# SPDX-License-Identifier: Apache-2.0
23

34
# FIXME: SHADOW_VARS: Remove this once we have enabled -Wshadow globally.
@@ -58,6 +59,7 @@ add_subdirectory_ifdef(CONFIG_KSCAN kscan)
5859
add_subdirectory_ifdef(CONFIG_LED led)
5960
add_subdirectory_ifdef(CONFIG_LED_STRIP led_strip)
6061
add_subdirectory_ifdef(CONFIG_LORA lora)
62+
add_subdirectory_ifdef(CONFIG_LORA_BASICS_MODEM_DRIVERS lora_lbm)
6163
add_subdirectory_ifdef(CONFIG_MBOX mbox)
6264
add_subdirectory_ifdef(CONFIG_MDIO mdio)
6365
add_subdirectory_ifdef(CONFIG_MEMC memc)

drivers/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ source "drivers/kscan/Kconfig"
5353
source "drivers/led/Kconfig"
5454
source "drivers/led_strip/Kconfig"
5555
source "drivers/lora/Kconfig"
56+
source "drivers/lora_lbm/Kconfig"
5657
source "drivers/mbox/Kconfig"
5758
source "drivers/mdio/Kconfig"
5859
source "drivers/memc/Kconfig"

drivers/lora_lbm/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright (c) 2024 Semtech Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_library()
5+
6+
# Disable all warnings for Semtech code.
7+
#
8+
# Zephyr is compiled with a lot more warnings enabled then the basics modem.
9+
# Since we copy the Basics Modem directly with no modifications, the warnings clog up
10+
# the build output in our applications.
11+
# zephyr_library_compile_options(-w)
12+
13+
if(CONFIG_SEMTECH_LR11XX)
14+
# Library flag that disables some warnings
15+
zephyr_library_compile_definitions(LR11XX_DISABLE_WARNINGS)
16+
17+
zephyr_library_sources(lr11xx/lr11xx_board.c lr11xx/lr11xx_hal.c)
18+
19+
zephyr_library_sources_ifdef(CONFIG_LORA_BASICS_MODEM_DRIVERS_RAL_RALF
20+
lr11xx/lr11xx_ral_bsp.c lr11xx/lr11xx_ral_bsp_calibration.c
21+
)
22+
endif()
23+
24+
if(CONFIG_SEMTECH_SX126X)
25+
zephyr_library_sources(sx126x/sx126x_hal.c sx126x/sx126x_board.c)
26+
27+
zephyr_library_sources_ifdef(CONFIG_LORA_BASICS_MODEM_DRIVERS_RAL_RALF
28+
sx126x/sx126x_ral_bsp.c
29+
)
30+
endif()

drivers/lora_lbm/Kconfig

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# LoRa Basics Modem drivers configuration options
2+
#
3+
# Copyright (c) 2024 Semtech Corporation
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# NOTE: Might be renamed LORA_DRIVERS for upstreaming
7+
8+
menuconfig LORA_BASICS_MODEM_DRIVERS
9+
bool "LoRa drivers from the new LoRa Basics Modem stack [EXPERIMENTAL]"
10+
select POLL
11+
select EXPERIMENTAL
12+
select ZEPHYR_LORA_BASICS_MODEM_MODULE
13+
depends on !LORA
14+
help
15+
Include LoRa drivers from the new LoRa Basics Modem stack in the system configuration.
16+
17+
if LORA_BASICS_MODEM_DRIVERS
18+
19+
module = LORA_BASICS_MODEM_DRIVERS
20+
module-str = lora-lbm
21+
source "subsys/logging/Kconfig.template.log_config"
22+
23+
rsource "Kconfig.lr11xx"
24+
rsource "Kconfig.sx12xx"
25+
26+
config LORA_BASICS_MODEM_DRIVERS_INIT_PRIORITY
27+
int "Init priority"
28+
default 50
29+
30+
31+
config LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER
32+
bool
33+
34+
choice
35+
prompt "Event trigger mode"
36+
default LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_GLOBAL_THREAD
37+
help
38+
Specify the type of triggering to be used by the LORA_BASICS_MODEM_DRIVERS driver.
39+
40+
config LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_NONE
41+
bool "No trigger on event"
42+
43+
config LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_GLOBAL_THREAD
44+
bool "Use global thread"
45+
depends on GPIO
46+
select LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER
47+
48+
config LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_OWN_THREAD
49+
bool "Use own thread"
50+
depends on GPIO
51+
select LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER
52+
53+
endchoice
54+
55+
config LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_THREAD_PRIORITY
56+
int "Thread priority"
57+
depends on LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_OWN_THREAD
58+
default 10
59+
help
60+
Priority of thread used by the driver to handle interrupts.
61+
62+
config LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_THREAD_STACK_SIZE
63+
int "Thread stack size"
64+
depends on LORA_BASICS_MODEM_DRIVERS_EVENT_TRIGGER_OWN_THREAD
65+
default 1024
66+
help
67+
Stack size of thread used by the driver to handle interrupts.
68+
69+
config LORA_BASICS_MODEM_DRIVERS_HAL_WAIT_ON_BUSY_TIMEOUT_MSEC
70+
int "Time to wait on BUSY pin in ms before aborting"
71+
default 600000
72+
help
73+
Busy pin wait time in milliseconds. As WiFi and GPS scanning can take
74+
seconds/minutes, the default is set to 10 minutes.
75+
76+
77+
config LORA_BASICS_MODEM_DRIVERS_RAL_RALF
78+
bool "LoRa Radio Abstraction Layer from the new LoRa Basics Modem stack"
79+
default y
80+
help
81+
Include the Radio Abstraction Layer from the new LoRa Basics Modem stack
82+
83+
# TODO: LORA_SHELL
84+
85+
endif # LORA_BASICS_MODEM_DRIVERS

drivers/lora_lbm/Kconfig.lr11xx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 Semtech Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# LoRa transceiver drivers configuration options
5+
6+
config SEMTECH_LR11XX
7+
bool "Semtech LR11xx family LoRa transceiver driver"
8+
default y
9+
depends on DT_HAS_SEMTECH_LR1110_ENABLED || DT_HAS_SEMTECH_LR1120_ENABLED || DT_HAS_SEMTECH_LR1121_ENABLED
10+
select SPI
11+
select GPIO
12+
help
13+
Enable driver for the LR11xx family LoRa transceiver driver
14+
15+
16+
if SEMTECH_LR11XX
17+
18+
config LR11XX_USE_CRC_OVER_SPI
19+
bool "Use CRC over SPI communication"
20+
21+
endif # SEMTECH_LR11XX

drivers/lora_lbm/Kconfig.sx12xx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2024 Semtech Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# LoRa transceiver drivers configuration options
5+
6+
config SEMTECH_SX126X
7+
bool "Semtech SX126x family LoRa transceiver driver"
8+
default y
9+
depends on DT_HAS_SEMTECH_SX1261_NEW_ENABLED || DT_HAS_SEMTECH_SX1262_NEW_ENABLED || DT_HAS_SEMTECH_SX1268_NEW_ENABLED || DT_HAS_ST_STM32WL_SUBGHZ_RADIO_ENABLED
10+
select SPI
11+
select GPIO
12+
help
13+
Enable driver for the SX126x family and stm32wl embedded LoRa transceiver driver

0 commit comments

Comments
 (0)