Skip to content

Getting Error: Overrun while receiving data on ESP32 #12

@icheered

Description

@icheered

Following the example code on an ESP32 I get an "Error: overrun" every time I receive data but I don't know what causes this or how to prevent this error from happening. I am receiving data correctly confirmed using an oscilloscope. This issue happens using both NEC_16 and NEC_8.

Receiver code

import time

import machine
import gc
from ir_rx.nec import NEC_16
from ir_rx.print_error import print_error

def callback(data, addr, ctrl):
    print("Callback is called")
    if data < 0:  # NEC protocol sends repeat codes.
        print("Repeat code.")
    else:
        print("Data {:02x} Addr {:04x}".format(data, addr))


def test():
    ir = NEC_16(machine.Pin(32, machine.Pin.IN), callback)
    ir.error_function(print_error)
    try:
        i = 0
        while True:
            i += 1
            print("Running: " + str(i))
            time.sleep(5)
            gc.collect()
    except KeyboardInterrupt:
        ir.close()

test()

Transmitter code for completeness (Works as expected as confirmed using oscilloscope).

import machine
from ir_tx.nec import NEC

button = 0
buttonPin = machine.Pin(26, machine.Pin.IN)

transmitter = NEC(machine.Pin(12, machine.Pin.OUT))

while 1:
    if buttonPin.value() and not button:
        button = 1
        print("Button went low")

    elif not buttonPin.value() and button:
        button = 0
        print("Button went high " + str(i))
        i += 1
        transmitter.transmit(1, i)

What exactly is causing this issue? And how can I prevent it from happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions