Repository navigation
sx126x: remove machine dependency, fix bugs, add features and tests - #954
deadprogram wants to merge 8 commits into
Conversation
|
Hardware test results on a LoRa-E5 board, flashed with ST-Link. examples/sx126x/lora_rxtx Tested against a PyBadge with a LoRa FeatherWing running examples/sx127x/lora_rxtx built from this branch. Both use 868.1 MHz, SF9, BW 125 kHz, CR 4/7, private sync word.
Each board received examples/sx126x/lora_continuous Runs without panics or hangs. Timing matches the example. RF output in continuous modes was not measured. Not tested on hardware: CAD, packet status, instant RSSI, random number, Rx duty cycle. |
|
Hardware test of the new features on a LoRa-E5, with a PyBadge and LoRa FeatherWing sending
Two commits were added from this testing.
Note on the symbol timeout. With 8 or 16 symbols, Not tested: |
f1ece1c to
e1a1f07
Compare
|
Hardware test of 29ea5df on a LoRa-E5, with a PyBadge and LoRa FeatherWing running This applies the same interrupt fix as ba5472e in #953. Interrupt during SPI
Both packets were handled while SPI was busy, with no hang. Old and new driver with the same test program
Other features after 29ea5df
API change: events reach |
29ea5df to
b9c771a
Compare
|
The commits were squashed, so the hashes in my earlier comments changed. The code at the tip is the same. |
Use pin.Output, pin.Input and pin.InterruptFunc for the radio control pins. The STM32WL radio control now takes an RFSwitch, with helpers for the Nucleo WL55JC1, GNSE and LoRa-E5 boards. Add SetResetPin since the reset pin could never be set before.
…uffer read SetCrc(false) now disables CRC. GetDeviceErrors and GetLoraStats no longer lose the high byte. Use the 863 MHz image calibration values from the datasheet. Rx now reads the packet from the offset reported by GetRxBufferStatus.
Keep the SPI buffers inside Device, write buffer data straight into the Tx buffer and use arrays for command parameters. Tx now rejects packets longer than 255 bytes instead of growing the buffer.
Add Cad, SetCad and SetCadParams for channel activity detection, with HandleInterrupt now sending CAD done events. Add GetPacketStatus, GetRssiInst, ResetStats, RandomU32, SetRxDutyCycle, SetDio2AsRfSwitchCtrl, SetDio3AsTcxoCtrl and SetLoraSymbNumTimeout.
Test the driver against a fake radio that emulates the SPI commands, including Tx, Rx, CAD, register access, RF switch helpers and that the main operations do not allocate.
… and Rx duty cycle
HandleInterrupt used SPI from the interrupt. If it ran during another SPI transfer, the bus could lock up. The interrupt now only signals, and Tx, Rx and Cad read the IRQ status. On STM32WL the radio interrupt is disabled until the status is cleared. PollEvent waits for events after SetRx, SetRxDutyCycle or SetCad.
b9c771a to
c6c5c98
Compare
This PR improves the sx126x driver. It is stacked on #953.
Changes:
machinepackage.NewRadioControltakes pin interfaces, and the STM32WL radio control takes anRFSwitchfunction. Helpers are included for the Nucleo-WL55JC, GNSE and LoRa-E5 boardsSetCrcoff, the device error and stats decoding, the 863 MHz image calibration values, and the Rx buffer readSetupInterruptserror fromSetRadioControllerAPI change:
NewRadioControlnow takes pin interfaces, or anRFSwitchon STM32WL.Tested with
make unit-testand the smoke tests.