Hello everyone. I'm making pir sensor that sends data by lora modul. Is there any posibility to use interrupt in di0 pin connected to arduino uno pin 2? I know how to put it to sleep and wake up by interrupt make by switch. I'd like to wake up arduino when this module gets packet.
do you have a a link to your module?
which library are you using?
(you need to double check how they configure REG_DIO_MAPPING_1)
I'm using LoRa library. How can I check it?
I tried to click on "LoRa library" but it was not a link....
this is the link to lora library.
Most all LoRa libraries default to DIO0 going high on receipt of a packet.
Do bear in mind that the LoRa module will consume around 12-15mA when its listening for a packet.
And do remember the LoRa device is 3.3V logic so needs logic level conversion on its I\O pins when connected to a 5V UNO.
if you look for REG_DIO_MAPPING_1 in the code, you'll see that they mess around with it so that DIO0 means either TxDone or RxDone for triggering their interruption when in async mode
for example in LoRaClass::endPacket(bool async)
if ((async) && (_onTxDone))
writeRegister(REG_DIO_MAPPING_1, 0x40); // DIO0 => TXDONE
--> they write 0x40 (--> in binary 0100 0000) into the REG_DIO_MAPPING_1 register.
In this register each pair of bits represent a specific mapping for one DIO and bits 7-6 are defining what DIO0 will be mapped to
according to this mapping table:
So 01 in bits 7-6 means DIO0 will be showing the TxDone
flag, which the library has set interrupt for .
In receive mode (I think they are In Rx single mode) and they write 0x00 into the register (cf LoRaClass::receive()
)
writeRegister(REG_DIO_MAPPING_1, 0x00); // DIO0 => RXDONE
So DIO0 will copy the RXDone
signal which will raise the interrupt but they don't seem to use 01
for Dio3Mapping which would let you see on DIO3 the ValidHeader
flag.
so long story short, it's probably OK in receive mode to listen to DIO0 and it should raise when the Rx is done (after the facts) but would require testing as they change the settings depending on their needs.
Thanks for all answers
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.