A proper way of doing read callback receive with Arduino LoRa

Arduino LoRa is a great library that brings LoRa support (SX1276/SX1277/SX1278/SX1279) to Arduino world. I'm using it in my Crossbow LRS project (still not stable enough for flight, work in progress). Until now, the biggest problem with this library I've found is that examples suggests that heavy protocol processing inside interrupt callback is fine.

Unfortunately, it is not. It can lead to unexpected processing delays, create conflicts with other interrupts, bus clashes and other hard to debug things. This is why, the better way is to do packet reading (and processing) inside main loop and use read callback only to set a flag. Like this:

Only please remember to set all variables modified in ISR routine as volatile.

One thought to “A proper way of doing read callback receive with Arduino LoRa”

  1. Interesting stuff to be aware of.

    One question. With LoRa-library (Sandeep Mistry) we can enable CRC (Lora.enableCRC). Do you have any idea if checking on correct CRC is done before there will be issued an interrupt?
    So – in other words – do we get an interrupt for all packets being received or only for the good ones, i.e. the packets passing the CRC-check?

    Thnx for this stuff.


Leave a Reply to Jop Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.