Skip to content
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

Draft: Add LoRa Basics Modem radio drivers and LoRaWAN stack #77495

Open
wants to merge 14 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
15 changes: 15 additions & 0 deletions MAINTAINERS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,7 @@ LoRa and LoRaWAN:
- Mani-Sadhasivam
- martinjaeger
- mniestroj
- Salamandar
files:
- drivers/lora/
- include/zephyr/drivers/lora.h
Expand All @@ -2470,6 +2471,11 @@ LoRa and LoRaWAN:
- subsys/lorawan/
- samples/subsys/lorawan/
- doc/connectivity/lora_lorawan/index.rst

- drivers/lora_lbm/
- include/zephyr/lorawan_lbm/
- samples/drivers/lora_lbm/
- subsys/lorawan_lbm/
labels:
- "area: LoRa"
tests:
Expand Down Expand Up @@ -4694,6 +4700,15 @@ West:
labels:
- "area: LoRa"

"West project: lora_basics_modem":
status: maintained
maintainers:
- Salamandar
files:
- modules/lora_basics_modem/
labels:
- "area: LoRa"

"West project: lvgl":
status: maintained
maintainers:
Expand Down
11 changes: 11 additions & 0 deletions boards/shields/semtech_lr11xxmb1xxs/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024 Semtech Corporation
# SPDX-License-Identifier: Apache-2.0

config SHIELD_SEMTECH_LR1110MB1xxS
def_bool $(shields_list_contains,semtech_lr1110mb1xxs)

config SHIELD_SEMTECH_LR1120MB1xxS
def_bool $(shields_list_contains,semtech_lr1120mb1xxs)

config SHIELD_SEMTECH_LR1121MB1xxS
def_bool $(shields_list_contains,semtech_lr1121mb1xxs)
97 changes: 97 additions & 0 deletions boards/shields/semtech_lr11xxmb1xxs/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
.. semtech_lr11xxmb1xxs:

Semtech LR11xxMB1xxS LoRa Shields
#################################

Overview
********

Semtech provides a series of Arduino compatible shields based on their LoRa
transceivers LR1110, LR1120, and LR1121.
Those shields are mostly similar and include a LIS2DE12 3-axis i2c accelerometer
from STMicroelectronics.

More information about the shield can be found at the `mbed LR1110MB1xxS
website`_.

Pins Assignment of the Semtech LR1110MB1xxS LoRa Shield
=======================================================

+-------------+---------------------+
| Shield Pin | Function |
+=============+=====================+
| A0 | LR1110 NRESET |
+-------------+---------------------+
| A1 | 32kHz Osc out |
+-------------+---------------------+
| A2 | LR111x / LR1110 |
+-------------+---------------------+
| A3 | LNA Control |
+-------------+---------------------+
| A4 | LED TX |
+-------------+---------------------+
| A5 | LED RX |
+-------------+---------------------+
| D2 | To Display Shield |
+-------------+---------------------+
| D3 | LR1110 DIO0 (BUSY) |
+-------------+---------------------+
| D4 | LED Sniffing |
+-------------+---------------------+
| D5 | LR1110 DIO9 |
+-------------+---------------------+
| D7 | LR1110 SPI NSS |
+-------------+---------------------+
| D8 | MEMS Accel INT1 |
+-------------+---------------------+
| D9 | Display D/C |
+-------------+---------------------+
| D10 | Display CS |
+-------------+---------------------+
| D11 | LR1110 SPI MOSI |
+-------------+---------------------+
| D12 | LR1110 SPI MISO |
+-------------+---------------------+
| D13 | LR1110 SPI SCK |
+-------------+---------------------+
| D14 | MEMS+EEPROM i2c SDA |
+-------------+---------------------+
| D15 | MEMS+EEPROM i2c SCL |
+-------------+---------------------+

LR1110 and LR1120 based shields use a TCXO and LR1121 based shields use a crystal.

Requirements
************

This shield can only be used with a board which provides a configuration for
Arduino connectors and defines node aliases for SPI and GPIO interfaces (see
:ref:`shields` for more details).

Programming
***********

Set ``-DSHIELD=semtech_lr1110mb1xxs`` when you invoke ``west build``. For
example:

.. zephyr-app-commands::
:zephyr-app: samples/subsys/lorawan/class_a
:board: nucleo_l073rz
:shield: semtech_lr1110mb1xxs
:goals: build

References
**********

.. target-notes::

.. _mbed LR1110MB1xxS website:
https://os.mbed.com/components/LR1110MB1xxS/


License
*******

This document Copyright (c) 2024 Semtech Corporation

SPDX-License-Identifier: Apache-2.0
13 changes: 13 additions & 0 deletions boards/shields/semtech_lr11xxmb1xxs/semtech_lr1110mb1xxs.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2024 Semtech Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "semtech_lr11xxmb1xxs_common.dtsi"

lora_semtech_lr1110mb1xxs: &lora_semtech_lr11xxmb1xxs {
compatible = "semtech,lr1110";

tcxo-wakeup-time = <8>;
};
13 changes: 13 additions & 0 deletions boards/shields/semtech_lr11xxmb1xxs/semtech_lr1120mb1xxs.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2024 Semtech Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "semtech_lr11xxmb1xxs_common.dtsi"

lora_semtech_lr1120mb1xxs: &lora_semtech_lr11xxmb1xxs {
compatible = "semtech,lr1120";

tcxo-wakeup-time = <8>;
};
13 changes: 13 additions & 0 deletions boards/shields/semtech_lr11xxmb1xxs/semtech_lr1121mb1xxs.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2024 Semtech Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "semtech_lr11xxmb1xxs_common.dtsi"

lora_semtech_lr1121mb1xxs: &lora_semtech_lr11xxmb1xxs {
compatible = "semtech,lr1121";

/* LR1121 shields all have XTAL */
};
169 changes: 169 additions & 0 deletions boards/shields/semtech_lr11xxmb1xxs/semtech_lr11xxmb1xxs_common.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/*
* Copyright (c) 2024 Semtech Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/lora_lbm/lr11xx.h>

/ {
chosen {
zephyr,lora-transceiver = &lora_semtech_lr11xxmb1xxs;
};
aliases {
lora-transceiver = &lora_semtech_lr11xxmb1xxs;
};
};


&arduino_spi {
status = "okay";

cs-gpios = <&arduino_header 13 GPIO_ACTIVE_LOW>;

lora_semtech_lr11xxmb1xxs: lora@0 {
reg = <0>;
spi-max-frequency = <DT_FREQ_M(4)>;

reset-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>;

busy-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>;

event-gpios = <&arduino_header 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;

lf-tx-path = <LR11XX_TX_PATH_LF_LP_HP>;

lf-clk = <LR11XX_LFCLK_XTAL>;
reg-mode = <LR11XX_REG_MODE_DCDC>;

rf-sw-enable = <(LR11XX_DIO5 | LR11XX_DIO6 | LR11XX_DIO7)>;
rf-sw-rx-mode = <LR11XX_DIO5>;
rf-sw-tx-mode = <(LR11XX_DIO5 | LR11XX_DIO6)>;
rf-sw-tx-hp-mode = <LR11XX_DIO6>;
rf-sw-gnss-mode = <LR11XX_DIO7>;

tcxo-voltage = <LR11XX_TCXO_SUPPLY_1_8V>;
/* Default to XTAL board */
tcxo-wakeup-time = <0>;

tx-power-cfg-lf-lp =
// power, pa_duty_cycle, pa_hp_sel
< (-15) 0x00 0x00>, // Expected output power = -17dBm
< (-14) 0x00 0x00>, // Expected output power = -16dBm
< (-13) 0x00 0x00>, // Expected output power = -15dBm
< (-12) 0x00 0x00>, // Expected output power = -14dBm
< (-11) 0x00 0x00>, // Expected output power = -13dBm
< (-9) 0x00 0x00>, // Expected output power = -12dBm
< (-8) 0x00 0x00>, // Expected output power = -11dBm
< (-7) 0x00 0x00>, // Expected output power = -10dBm
< (-6) 0x00 0x00>, // Expected output power = -9dBm
< (-5) 0x00 0x00>, // Expected output power = -8dBm
< (-4) 0x00 0x00>, // Expected output power = -7dBm
< (-3) 0x00 0x00>, // Expected output power = -6dBm
< (-2) 0x00 0x00>, // Expected output power = -5dBm
< (-1) 0x00 0x00>, // Expected output power = -4dBm
< ( 0) 0x00 0x00>, // Expected output power = -3dBm
< ( 1) 0x00 0x00>, // Expected output power = -2dBm
< ( 2) 0x00 0x00>, // Expected output power = -1dBm
< ( 3) 0x00 0x00>, // Expected output power = 0dBm
< ( 3) 0x01 0x00>, // Expected output power = 1dBm
< ( 4) 0x01 0x00>, // Expected output power = 2dBm
< ( 7) 0x00 0x00>, // Expected output power = 3dBm
< ( 8) 0x00 0x00>, // Expected output power = 4dBm
< ( 9) 0x00 0x00>, // Expected output power = 5dBm
< ( 10) 0x00 0x00>, // Expected output power = 6dBm
< ( 12) 0x00 0x00>, // Expected output power = 7dBm
< ( 13) 0x00 0x00>, // Expected output power = 8dBm
< ( 14) 0x00 0x00>, // Expected output power = 9dBm
< ( 13) 0x01 0x00>, // Expected output power = 10dBm
< ( 13) 0x02 0x00>, // Expected output power = 11dBm
< ( 14) 0x02 0x00>, // Expected output power = 12dBm
< ( 14) 0x03 0x00>, // Expected output power = 13dBm
< ( 14) 0x04 0x00>, // Expected output power = 14dBm
< ( 14) 0x07 0x00>; // Expected output power = 15dBm

tx-power-cfg-lf-hp =
// power, pa_duty_cycle, pa_hp_sel
< ( 9) 0x00 0x00>, // Expected output power = -9dBm
< ( 10) 0x00 0x00>, // Expected output power = -8dBm
< ( 11) 0x00 0x00>, // Expected output power = -7dBm
< ( 12) 0x00 0x00>, // Expected output power = -6dBm
< ( 13) 0x00 0x00>, // Expected output power = -5dBm
< ( 13) 0x01 0x00>, // Expected output power = -4dBm
< ( 13) 0x02 0x00>, // Expected output power = -3dBm
< ( 17) 0x02 0x00>, // Expected output power = -2dBm
< ( 14) 0x04 0x00>, // Expected output power = -1dBm
< ( 12) 0x00 0x01>, // Expected output power = 0dBm
< ( 13) 0x00 0x01>, // Expected output power = 1dBm
< ( 13) 0x01 0x01>, // Expected output power = 2dBm
< ( 13) 0x02 0x01>, // Expected output power = 3dBm
< ( 15) 0x00 0x02>, // Expected output power = 4dBm
< ( 15) 0x04 0x01>, // Expected output power = 5dBm
< ( 14) 0x02 0x02>, // Expected output power = 6dBm
< ( 14) 0x01 0x03>, // Expected output power = 7dBm
< ( 17) 0x04 0x02>, // Expected output power = 8dBm
< ( 22) 0x00 0x01>, // Expected output power = 9dBm
< ( 22) 0x01 0x01>, // Expected output power = 10dBm
< ( 22) 0x02 0x01>, // Expected output power = 11dBm
< ( 22) 0x03 0x01>, // Expected output power = 12dBm
< ( 22) 0x00 0x03>, // Expected output power = 13dBm
< ( 22) 0x01 0x03>, // Expected output power = 14dBm
< ( 22) 0x04 0x02>, // Expected output power = 15dBm
< ( 22) 0x01 0x04>, // Expected output power = 16dBm
< ( 22) 0x02 0x04>, // Expected output power = 17dBm
< ( 22) 0x01 0x06>, // Expected output power = 18dBm
< ( 22) 0x03 0x05>, // Expected output power = 19dBm
< ( 22) 0x03 0x07>, // Expected output power = 20dBm
< ( 22) 0x04 0x06>, // Expected output power = 21dBm
< ( 22) 0x04 0x07>; // Expected output power = 22dBm

tx-power-cfg-hf =
// power, pa_duty_cycle, pa_hp_sel
< (-18) 0x04 0x00>, //Expected output power = -18dBm
< (-18) 0x04 0x00>, // Expected output power = -17dBm
< (-17) 0x04 0x00>, // Expected output power = -16dBm
< (-16) 0x04 0x00>, // Expected output power = -15dBm
< (-15) 0x04 0x00>, // Expected output power = -14dBm
< (-14) 0x04 0x00>, // Expected output power = -13dBm
< (-14) 0x04 0x00>, // Expected output power = -12dBm
< (-12) 0x04 0x00>, // Expected output power = -11dBm
< (-10) 0x04 0x00>, // Expected output power = -10dBm
< ( -9) 0x04 0x00>, // Expected output power = -9dBm
< ( -8) 0x04 0x00>, // Expected output power = -8dBm
< ( -7) 0x04 0x00>, // Expected output power = -7dBm
< ( -6) 0x04 0x00>, // Expected output power = -6dBm
< ( -5) 0x04 0x00>, // Expected output power = -5dBm
< ( -4) 0x04 0x00>, // Expected output power = -4dBm
< ( -3) 0x04 0x00>, // Expected output power = -3dBm
< ( -2) 0x03 0x00>, // Expected output power = -2dBm
< ( -1) 0x04 0x00>, // Expected output power = -1dBm
< ( 0) 0x04 0x00>, // Expected output power = 0dBm
< ( 1) 0x00 0x00>, // Expected output power = 1dBm
< ( 2) 0x00 0x00>, // Expected output power = 2dBm
< ( 4) 0x04 0x00>, // Expected output power = 3dBm
< ( 5) 0x04 0x00>, // Expected output power = 4dBm
< ( 6) 0x04 0x00>, // Expected output power = 5dBm
< ( 7) 0x04 0x00>, // Expected output power = 6dBm
< ( 8) 0x04 0x00>, // Expected output power = 7dBm
< ( 9) 0x04 0x00>, // Expected output power = 8dBm
< ( 10) 0x04 0x00>, // Expected output power = 9dBm
< ( 11) 0x04 0x00>, // Expected output power = 10dBm
< ( 12) 0x03 0x00>, // Expected output power = 11dBm
< ( 13) 0x04 0x00>, // Expected output power = 12dBm
< ( 13) 0x00 0x00>; // Expected output power = 13dBm


/* Tune is G4 G5 G6 G7 G8 G9 G10 G11 G12 G13
* G13hp1 G13hp2 G13hp3 G13hp4 G13hp5 G13hp6 G13hp7
*/
rssi-calibration-lf-offset = <0>;
rssi-calibration-lf-tune = <12 12 14 0 1 3 4 4 3 6 6 6 6 6 6 6 6>;

rssi-calibration-mf-offset = <0>;
rssi-calibration-mf-tune = <2 2 2 3 3 4 5 4 4 6 5 5 6 6 6 7 6>;

rssi-calibration-hf-offset = <2030>;
rssi-calibration-hf-tune = <6 7 6 4 3 4 14 12 14 12 12 12 12 8 8 9 9>;

};
};
11 changes: 11 additions & 0 deletions boards/shields/semtech_sx126xmb2xxs/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024 Semtech Corporation
# SPDX-License-Identifier: Apache-2.0

config SHIELD_SEMTECH_SX126xMB2xxS
def_bool $(shields_list_contains,semtech_sx126xmb2xxs)

config SHIELD_SEMTECH_SX126xMB2xxS
def_bool $(shields_list_contains,semtech_sx126xmb2xxs)

config SHIELD_SEMTECH_SX126xMB2xxS
def_bool $(shields_list_contains,semtech_sx126xmb2xxs)
Loading
Loading