mr-glt / sx127x_lora

A platform-agnostic driver for Semtech SX1276/77/78/79 based boards.
Apache License 2.0
43 stars 39 forks source link

Fix inverted Irq logic in `transmit_payload`. #2

Closed Janno closed 4 years ago

Janno commented 4 years ago

The sx127x data sheet contains the following sentence in section "4.1.2.4. Interrupts in LoRa Mode":

In the register RegIrqFlags, a ‘1’ indicates a given IRQ has been trigged and then the IRQ must be clear by writing a ‘1’.

This seems to indicate that transmit_payload should wait for a value of 1 and also write a value of 1, instead of 0 and 0, respectively.


I am marking this as a draft PR because I feel that overwriting the entire register might be problematic. I see other places in the code that write only specific bitmasks. Is that the right way to do it? Do 0 bits just not reset the interrupt?

Janno commented 4 years ago

I should add that I discovered this issue because my prototype kept getting stuck after sending one message. With this change, it happily sends as many messages as I ask it to.

Janno commented 4 years ago

Link to data sheet for quick reference: https://cdn-shop.adafruit.com/product-files/3179/sx1276_77_78_79.pdf The section in question is at the bottom of page 35.