Repository navigation
sx128x: add LoRa radio interface, ranging, fixes and tests - #955
deadprogram wants to merge 5 commits into
Conversation
9ae1d9f to
78aa4cd
Compare
|
Rebased on the current #954 and added 494a68c. These are the same fixes found while testing #953 and #954 on hardware.
Tested with unit tests only, since I do not have sx128x hardware. The new tests fail before 494a68c and pass after it. The same interrupt design was tested on a PyBadge with an RFM95W and on a LoRa-E5. API change: events reach |
494a68c to
cb07cf5
Compare
|
@jwetzell if you can please take a look at this PR and test since you have this radio, I would be very greatful... 😸 |
|
I can pull them out and give it a try. Is there an example somewhere? |
|
The raw RSSI byte is unsigned and the value is -raw/2 dBm. Converting it to int8 first returned positive values for weak signals.
Keep the SPI buffers inside Device and size them for the largest command. WriteBuffer with 256 bytes and ReadBuffer with 255 bytes grew the old 256 byte buffers.
Device now implements lora.Radio with LoraConfig, Tx and Rx, and adds Cad. These use DIO1 interrupts when SetupInterrupts is called and poll the IRQ status otherwise. HandleInterrupt sends lora.RadioEvent values. Add ranging role, address, calibration and result functions, plus ReadRegisters, GetFirmwareVersion, SetLoRaSyncWord and GetFrequencyError. SetModulationParamsLoRa now also sets the spreading factor dependent registers from the datasheet.
Test the driver against a fake radio that emulates the SPI commands, including LoRa Tx, Rx and CAD with and without interrupts, ranging, register access, RSSI and that the main operations do not allocate.
The sx128x only works at 2.4 GHz, where LoRaWAN uses 0x21 for public networks (SYNC_WORD_PUBLIC_WW_2G4 in Semtech LoRa Basics Modem). 0x34 is the sub-GHz value.
7b93c90 to
991ef1d
Compare
|
Ok @deadprogram the basic_demo from the wireless repo flashed and booted successfully. I don't have a LoRaWAN network to join but I can see the attempts at joining via serial monitoring |
This PR improves the sx128x driver. It is stacked on #954.
Changes:
lora.Radiointerface with Tx, Rx and CAD, using DIO1 interrupts or pollingTested with
make unit-testand the smoke tests.