Skip to content

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

Merged
merged 47 commits into from
Apr 16, 2020
Merged

Add Semtech Lora radio drivers #12741

merged 47 commits into from
Apr 16, 2020

Conversation

kivaisan
Copy link
Contributor

@kivaisan kivaisan commented Apr 1, 2020

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

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[X] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Tests run with our internal Lora test suite


Reviewers

@ARMmbed/mbed-os-wan @kjbracey-arm


Antti Kauppila and others added 30 commits December 4, 2017 09:47
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.
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.
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.
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 3, 2020

The license guide was also written by them so there might be some area to move around. As they contain SPDX, should be OK.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 5, 2020

CI started

@mergify mergify bot added needs: work and removed needs: CI labels Apr 5, 2020
@mbed-ci
Copy link

mbed-ci commented Apr 5, 2020

Test run: FAILED

Summary: 2 of 3 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

Kimmo Vaisanen added 2 commits April 6, 2020 08:26
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.
@mergify mergify bot dismissed AnttiKauppila’s stale review April 6, 2020 08:49

Pull request has been modified.

@kivaisan
Copy link
Contributor Author

kivaisan commented Apr 6, 2020

Fixed build issues:

  • Source is enabled only if SPI is enabled
  • Drivers moved to own COMPONENT_SXXXXX -directories. Driver needs to be selected using "target.components_add" -configuration (e.g. "target.components_add": ["SX126X"]).

@mbed-ci
Copy link

mbed-ci commented Apr 7, 2020

Test run: FAILED

Summary: 2 of 3 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM-lts
  • jenkins-ci/mbed-os-ci_build-GCC_ARM-lts

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 7, 2020

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

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 9, 2020

CI started

@mergify mergify bot added needs: work and removed needs: CI labels Apr 9, 2020
@mbed-ci
Copy link

mbed-ci commented Apr 9, 2020

Test run: FAILED

Summary: 2 of 3 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@kivaisan
Copy link
Contributor Author

Build failures do not seem to relate this PR.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 16, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented Apr 16, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 3
Build artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants