The LoRa Developer Forum is now in read-only mode and new content will not be added. If you require technical support related to LoRa, please contact our experts here. For sales enquiries, please contact us here.

FORUM

Is there a tutorial for SX127X Interrupts?

the sum total of information I have found, pertaining to SX127X Interrupts:

setDioIrqParams(MASK, DIO0_MASK, DIO1_MASK, DIO2_MASK) (SX127X library)

setDioIrqParams(MASK, DIO0_MASK, DIO1_MASK, DIO2_MASK) (SX126X and SX128X libraries)

Sets up the how the device responds to internal events. This function is written for the SX127X to match the style used by the SX126X and SX128X devices. MASK is applied to the IRQ settings for DIO0, DIO1 and DIO2 (SX127X) and DIO1, DIO2 and DIO3 (SX126X and SX128X), its normally set to IRQ_RADIO_ALL (0xFFFF). Whilst the SX127X only has an 8 bit IRQ register the library has extended the function to provide additional IRQ detections that are used for the SX126X and SX127X.

In the case of the SX127X, the function maps the internal interrupts to the DIO0, DIO1 and DIO2 pins according to this table;

IRQ_RADIO_NONE 0x00
IRQ_CAD_ACTIVITY_DETECTED 0x01 //active on DIO1
IRQ_FSHS_CHANGE_CHANNEL 0x02 //active on DIO2
IRQ_CAD_DONE 0x04 //active on DIO0
IRQ_TX_DONE 0x08 //active on DIO0
IRQ_HEADER_VALID 0x10 //read from IRQ register only
IRQ_CRC_ERROR 0x20 //read from IRQ register only
IRQ_RX_DONE 0x40 //active on DIO0
IRQ_RADIO_ALL 0xFFFF

IRQ_TX_TIMEOUT 0x0100 //so that readIrqstatus can return additional detections
IRQ_RX_TIMEOUT 0x0200 //so that readIrqstatus can return additional detections
IRQ_NO_PACKET_CRC 0x0400 //so that readIrqstatus can return additional detections

The SX126X library has this table;

IRQ_RADIO_NONE 0x0000
IRQ_TX_DONE 0x0001
IRQ_RX_DONE 0x0002
IRQ_PREAMBLE_DETECTED 0x0004
IRQ_SYNCWORD_VALID 0x0008
IRQ_HEADER_VALID 0x0010
IRQ_HEADER_ERROR 0x0020
IRQ_CRC_ERROR 0x0040
IRQ_CAD_DONE 0x0080

IRQ_CAD_ACTIVITY_DETECTED 0x0100
IRQ_RX_TX_TIMEOUT 0x0200
IRQ_TX_TIMEOUT 0x0200
IRQ_RX_TIMEOUT 0x0200
IRQ_RADIO_ALL 0xFFFF

And the SX128X has this one;

IRQ_RADIO_NONE 0x0000
IRQ_TX_DONE 0x0001
IRQ_RX_DONE 0x0002
IRQ_SYNCWORD_VALID 0x0004
IRQ_SYNCWORD_ERROR 0x0008
IRQ_HEADER_VALID 0x0010
IRQ_HEADER_ERROR 0x0020
IRQ_CRC_ERROR 0x0040
IRQ_RANGING_SLAVE_RESPONSE_DONE 0x0080

IRQ_RANGING_SLAVE_REQUEST_DISCARDED 0x0100
IRQ_RANGING_MASTER_RESULT_VALID 0x0200
IRQ_RANGING_MASTER_RESULT_TIMEOUT 0x0400
IRQ_RANGING_SLAVE_REQUEST_VALID 0x0800
IRQ_CAD_DONE 0x1000
IRQ_CAD_ACTIVITY_DETECTED 0x2000
IRQ_RX_TX_TIMEOUT 0x4000
IRQ_TX_TIMEOUT 0x4000
IRQ_RX_TIMEOUT 0x4000
IRQ_PREAMBLE_DETECTED 0x8000
IRQ_RADIO_ALL 0xFFFF

is there a tutorial that explains how to use interrupts in more detail?

Dear,

You can find all the information on the SX127x datasheet. For example for the SX127x the tables 40 and 41 summarize those IRQ for FSK and LoRa, and detailed explanations can be found in the relevant chapter.