Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

receiving with interrupt callback not working

See original GitHub issue


I have set the dio_0 pin number in and changed the code in examples/ as following:

def receive(lora):
    print('LoRa Receiver Callback')
    def cb(payload):

But it didn’t work - couldn’t receive any data. It only worked with while True loop as shown in the original example.

Did I miss something? Pls help!

It’s an AI-Thinker Ra-02 LoRa module with ESP32. The MicroPython firmware is V1.13 stable.

I used the sx127x driver in the master branch, and the readme title is uPyLora.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:20

github_iconTop GitHub Comments

dukeduck1984commented, May 4, 2021

You need to change the if statement inside the handle_on_receive to: if irq_flags & IRQ_RX_DONE_MASK == IRQ_RX_DONE_MASK:, then it will work.

So it should look like:

            if irq_flags & IRQ_RX_DONE_MASK == IRQ_RX_DONE_MASK:
                if self._on_receive_cb:
                    print('msg coming in')
                    payload = self.read_payload()
dukeduck1984commented, Sep 28, 2021

Hi @Bujtar ,

As Peter pointed out in his post, you can use ThreadSafeFlag, as per the example shown here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

STM32 UART interrupt with callback not working
When I run debug, I am not able to receive UART messages. Here's the main and the callback function parts of the program:...
Read more >
SPI Receive interrupt callback not being called - ST Community
I am using it to receive data from an ADC chip over SPI. The ADC chip has a data ready output which should...
Read more >
Not able to call a function inside the gpio interrupt callback ...
I am facing an issue in my program where i am typing to call a function inside the gpio interrupt callback function. i...
Read more >
UART receive interrupt stops triggering after several hours of ...
My UART callback function works without any issue. But after several hours, UART receive interrupt stops working and UART cannot receive ...
Read more >
dsPIC33EP32GP502 CAN Received Interrupt not working ...
CAN1 Receive callback function */ void CAN1_RxBuffer(void) { CAN1_Receive(&rx_msg); // CAN1 Receive buffer application code if ((rx_msg.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found