-
Notifications
You must be signed in to change notification settings - Fork 3k
Add Semtech Lora radio drivers #12741
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
Conversation
rf_ctrls is a data structure that holds all control pins for a certain LoRa Radio. Same data structure was being used in both SX1272 and SX1276 drivers. As we are heading towards putting both drivers in the same repo and as the plan is to use them togather, i.e., both header files could be included we need to move this data structure to a common location so that the name does not collide. In addition to that we have tried to reduce namespace pollution caused by the driver header files.
Removing namespace pollution & rf ctrls refactor
For some unknown reason (may be a rebase issue) Mbed config name for the drivers was not spell correctly inside the source macro definition. Alongwith that the SX1276 driver was missing a class terminator.
Buffer Size and missing terminator for SX127 class
In respose to the radio event callback change from c style callbacks to Mbed callbacks, we need to remove NULL checks from the driver code as the callbacks itself are not pointers anymore. However, thanks to template magic, we can check if callback is assigned or not. If its not not assigned, it is default constructed to NULL which we can check by boolean operator.
[IOTCELL-284] Removing NULL checks from Callbacks
xDot module does not have external antenna control pins nor DIO5 pin connected.
For example muRata modules do not have DIO4 and DIO5 pins connected. If these pins are not connected, driver should not try to set up interrupt handlers for those.
LoRaRadio is now moved to feature/lorawan from feature/netsocket.
Also reformatted constructor params list to more readable format
NXP Hal provides a write API on DigitalOut::write() that asserts if pin is NC and we try to perform an operation on it. This behaviour is not consistent among various Hals in Mbed-OS. However, we now check the pin ourselves in the driver just like 1276.
preamble_detected and sync_word_detected are uint8_t integer type variables so those should not be compared to (boolean) true/false values. Fixed to use 1 and 0 values instead.
Fix IAR compiler warnings
Since variant detection is using ant_switch pin, it is now only used if that pin has been connected. Otherwise generic variant code is used.
Some variables were still defind as static in sources but as drivers are now C++ classes, these variables should be members of the class.
DEVICE_SPI flag is no longer needed as our CI only builds mbed-os-example-lorawan to targets which really have lora hw.
mbed-trace no longer requires COMMON_PAL.
Fixes issue #20
Both in FSK and LoRa mode, we do not rely on software timers anymore. This makes our timing precise and enables us to consume less power. It also gives us flexibility which we need for future deep sleep venture as Mbed OS timeout class may lock the sleep manager if not using low power timers.
We shouldn't use double precision as most of te embedded processors may not support it.
We are deprecating receive(uint32_t) API in favour of receive(void) API because we are ditching software timeout timers in the driver for RX chain.
Rx timeout in symbols cannot become more than 255 as the preamble length is fixed. For diagonostics purposes we add an MBED_ASSERT.
In case of catastrophic bus failure at radio end, we shouldn't reset the chip as it will cause the chip to hang and then burst out interrupts in a fury resulting in an ISR queue overflow. rather than that we gracefully accept the failure and set the radio to sleep and set the state to idle. In addition to that we inform the upper layers about the failure. A little touch up to the FHSS case, was actually a leftover from the previous PR. We don't use FHSS mode, that was why we didn't catch in the testing.
The license guide was also written by them so there might be some area to move around. As they contain SPDX, should be OK. |
CI started |
Test run: FAILEDSummary: 2 of 3 test jobs failed Failed test jobs:
|
These drivers uses SPI to communicate with radio so SPI must be present when compiling these.
To enable building only when driver is enabled with components_add -setting in json configuration.
Pull request has been modified.
Fixed build issues:
|
Test run: FAILEDSummary: 2 of 3 test jobs failed Failed test jobs:
|
Please ignore lts jobs here , not valid for this PR. We will restart testing and fix lts status here later once 5.15 jobs are in |
CI started |
Test run: FAILEDSummary: 2 of 3 test jobs failed Failed test jobs:
|
Build failures do not seem to relate this PR. |
CI restarted |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
Summary of changes
Add Semtech Lora radio drivers for SX1272, SX1276 and SX126x radios.
Added as subtree from original repository: https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers
Impact of changes
Enable using Lora with no additional repositories, all of them part of Mbed OS.
Migration actions required
None
Documentation
Pull request type
Test results
Tests run with our internal Lora test suite
Reviewers
@ARMmbed/mbed-os-wan @kjbracey-arm