Skip to content

lora: Add SX1272/SX1276 unified driver and LoRaWAN MAC layer#1102

Open
ddtdanilo wants to merge 2 commits intomicropython:masterfrom
ddtdanilo:add-pycom-lora
Open

lora: Add SX1272/SX1276 unified driver and LoRaWAN MAC layer#1102
ddtdanilo wants to merge 2 commits intomicropython:masterfrom
ddtdanilo:add-pycom-lora

Conversation

@ddtdanilo
Copy link
Copy Markdown

Summary

Add two new LoRa packages for Pycom board support:

lora-sx127x-pycom

Unified SX1272/SX1276 LoRa radio driver. The existing lora-sx127x package only supports SX1276 (version register 0x12); this driver also handles SX1272 (version 0x22) with its different register layouts for bandwidth encoding, coding rate bits, CRC location, and RSSI calculation offsets.

lora-lorawan

LoRaWAN 1.0.x MAC layer with:

  • OTAA and ABP activation modes
  • Class A device operation (TX → RX1 → RX2)
  • AES-128-CMAC (RFC 4493) and CTR mode crypto built on ucryptolib
  • MIC calculation, payload encryption, and session key derivation

Both packages are used by the Pycom LoPy (SX1272) and LoPy4 (SX1276) board definitions in micropython/micropython#19026.

Testing

  • All files pass ruff check and ruff format
  • LoRaWAN crypto verified against RFC 4493 test vectors
  • Hardware tests available in the main MicroPython PR

Add a LoRa radio driver that handles both SX1272 and SX1276
transceivers. The existing lora-sx127x package only supports
SX1276 (version register 0x12); this driver also handles SX1272
(version 0x22) with its different register layouts for bandwidth,
coding rate, CRC, and RSSI calculation.

Used by Pycom LoPy (SX1272) and LoPy4 (SX1276) boards as defined
in micropython/micropython#19026.

Signed-off-by: Danilo D <danilodt@gmail.com>
Add LoRaWAN Class A device operation with OTAA and ABP activation.
Includes AES-128-CMAC/CTR crypto primitives built on ucryptolib for
MIC calculation, payload encryption, and session key derivation per
the LoRaWAN 1.0.x specification.

Used by Pycom LoPy/LoPy4 boards as defined in
micropython/micropython#19026.

Signed-off-by: Danilo D <danilodt@gmail.com>
Copy link
Copy Markdown
Contributor

@projectgus projectgus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really exciting, thanks @ddtdanilo! Had always hoped the LoRa micropython-lib support would be enough for someone to build a LoRaWAN driver.

Do you mind moving the lorawan support into its own PR, please? There's a lot of new code here, and it will be easier to review and merge these independently.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants