-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Add LoRa Basics Modem radio drivers and LoRaWAN stack #77495
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
base: main
Are you sure you want to change the base?
Conversation
The following west manifest projects have changed revision in this Pull Request:
⛔ DNM label due to: 1 added project Note: This message is automatically posted and updated by the Manifest GitHub Action. |
Hi, @Salamandar, did you have chance to test this with CONFIG_PM? When I enable it, join requests always fail. still investigating this issue... Any idea what the issue could be? P.S. |
d74b021
to
abbb834
Compare
Hi @Salamandar I’m not sure if this is the best place to discuss build failures, but I wanted to share these with you. If there’s a more appropriate forum or person for this, please let me know. here are errors: when I build your pull request: Probably you know, but anyway: disable wdt: got error: zephyr/modules/lora_basics_modem/app_helpers/smtc_hal_zephyr/smtc_hal_watchdog.c:57: undefined reference to `__device_dts_ord_115' workaround for now.
disabling all region supports: compiling is ok but
Ill share the quick workaround solution shortly |
bcb80a0
to
16fdee2
Compare
4eaab4f
to
232a771
Compare
It is still a work in progress but, indeed, not a draft anymore. I expect a lot of comments, and requests for changes, that's a bit why I named it a "draft". But you're right, that is misleading on the state of the code. |
FYI the compliance checks fail on something where clang-format and Checkpatch disagree, see #83374. |
As a general comment: We try to avoid having multiple implementation for the same thing in the Zephyr tree. This means that the new LoRa Basics Modem will finally have to replace the "old" LoRaMAC-node stack. If it's not feasible to replace the entire stack at once, we can have a transition phase with both options in parallel (implementation selectable via Kconfig). But we should ideally try to use the same user-facing API for both. I suggest to split this PR into several smaller chunks which make it easier to review:
Existing devicetree bindings should be reused (and changed/extended, if required). Do you think we can (mostly) re-use the existing APIs in |
Semtech appears to have written an out-of-tree LBM Zephyr driver themselves. It would probably be a good idea to compare these two implementations. |
@wietsedv well this PR is from Semtech, so basically the same code (or a subset of it, at least) :) |
This module provides: * The cmake files for LoRa Basics Modem * The "HAL" described here: https://github.com/Lora-net/SWL2001/blob/master/lbm_lib/PORTING_GUIDE.md * Reimplementations of the logging functions in smtc_modem_hal_dbg_trace.h Signed-off-by: Félix Piédallu <felix@piedallu.me>
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 <felix@piedallu.me>
Those shields are sold by Semtech and are arduino compatible. Signed-off-by: Félix Piédallu <felix@piedallu.me>
This stack is based on the lora_basics_modem external module. It provides configuration for LBM as well as a standalone "main" LBM thread that needs to be manually started. Signed-off-by: Félix Piédallu <felix@piedallu.me>
232a771
to
c006947
Compare
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
I am planning to start looking at this in the near future. |
@JordanYates FYI: Unfortunately, Semtech decided not to continue funding the upstreaming process of the LoRa Basics Modem stack to Zephyr and leave it to the community. Before you spend much time into reviewing the PR, we should check with @Salamandar if he will be able to continue working on this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for Semtech transceivers by adding a new external module from the LoRa Basics Modem repository, duplicated LoRa transceiver drivers, and a LoRaWAN subsystem built on top of the LBM stack.
- Added Salamandar as a maintainer and updated file globs for new drivers and bindings.
- Introduced a new West project for lora_basics_modem support.
Files not reviewed (19)
- boards/shields/semtech_lr11xxmb1xxs/Kconfig.shield: Language not supported
- boards/shields/semtech_lr11xxmb1xxs/doc/index.rst: Language not supported
- boards/shields/semtech_lr11xxmb1xxs/semtech_lr1110mb1xxs.overlay: Language not supported
- boards/shields/semtech_lr11xxmb1xxs/semtech_lr1120mb1xxs.overlay: Language not supported
- boards/shields/semtech_lr11xxmb1xxs/semtech_lr1121mb1xxs.overlay: Language not supported
- boards/shields/semtech_lr11xxmb1xxs/semtech_lr11xxmb1xxs_common.dtsi: Language not supported
- boards/shields/semtech_sx126xmb2xxs/Kconfig.shield: Language not supported
- boards/shields/semtech_sx126xmb2xxs/doc/index.rst: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1261mb1bas.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1261mb1cas.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1261mb2bas.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1262mb1cas.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1262mb1cbs.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1262mb1das.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1262mb1pas.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1262mb2cas.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx1268mb1gas.overlay: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx126xmb1xxs_common.dtsi: Language not supported
- boards/shields/semtech_sx126xmb2xxs/semtech_sx126xmb2xxs_common.dtsi: Language not supported
Comments suppressed due to low confidence (1)
MAINTAINERS.yml:2677
- The glob pattern 'semtech_sx12*' may be ambiguous given the reference to SX126x transceivers in the PR description. Please verify if this pattern should be updated to 'semtech_sx126*' to accurately match the target board files.
- boards/shields/semtech_sx12*/
As I just stumbled upon the shortcomings of the
|
It is not supported in this PR, but I have it working to some extent with LBM, which will be part of my initial transition PR.
Not with the current Zephyr LoRa API. There is nothing stopping us from extending the API to support this, although I am a bit confused since the RAL abstraction only takes a
|
The LoRa sync words are complicated. It's not simply that nodes can communicate if the sync words match. Instead, a transmission only reliably works if certain conditions between the sender and receiver syncword match. That's why there are different syncwords between SX1272 (2-byte) and SX126x (4-byte) for the same network. The chosen values also have an effect on the likelyhood of a successful transmission (it's not just a deterministic criterion). Further, not all sync words are valid at all. Unfortunately all that is undocumented territory. The probably best analysis is found in this blog post: https://blog.classycode.com/lora-sync-word-compatibility-between-sx127x-and-sx126x-460324d1787a TL;DR: |
I just stumbled upon a derivation function for the sync word in RadioLib: https://github.com/jgromes/RadioLib/blob/c570b44dc35f3d2cddf326926b17b1ea91e32328/src/modules/SX128x/SX128x.cpp#L1020
This means the sync word is just 2 bytes and then another 2 bytes of control bits are mixed in, which are simply |
The equation you came across looks quite similar to the conversion in LoRa Basics Modem to convert the |
Indeed, but there they just read the sync word from the modem ( If there only would be documentation... |
This pull request adds support for the Semtech transceivers with the "radio drivers", and for the LoRaWAN stack, both provided by the LoRa Basics Modem project (https://github.com/Lora-net/SWL2001)
This PR adds:
compatible
with-new
, but what's the guideline on that ?module
.lora_lbm
and subsyslorawan_lbm
, to differentiate from the loramac-node implementations.app_helpers
code inmodules/lora_basics_modem
for portability purpose, but this should be cleaned up.EDIT: I splitted this PR in half : this PR contains only code that was written with zephyr in mind. The samples that still need porting are in https://github.com/salamandar/zephyr/tree/lbm_samples