8000 ESP8266 Pin IRQ regression · Issue #5714 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
ESP8266 Pin IRQ regression #5714
Closed
@peterhinch

Description

@peterhinch

This device driver for IR remotes formerly worked on ESP8266. It now crashes with no changes to code. The problem is related to hard Pin IRQ's and the following code sample demonstrates it.

from machine import Pin
from time import sleep
import gc

pin = Pin(13, Pin.IN)
count = 0
def cb_pin(_):
    global count
    count += 1

ei = pin.irq(handler = cb_pin, trigger = (Pin.IRQ_FALLING | Pin.IRQ_RISING), hard = True)
# ei = pin.irq(handler = cb_pin, trigger = Pin.IRQ_FALLING, hard = True)

while True:
    sleep(1)
    print(count)
    gc.collect()

To test the pin is fed with a burst of 14 pulses of Manchester encoded data repeating every 104ms. Pulses are 889μs or 1778μs wide, the burst lasting 24.9ms. A crash with reboot occurs usually within a few seconds.

A crash also occurs if the commented-out code is used, ensuring that the minimum time between triggers is a leisurely 1.8ms. The crash takes longer to trigger.

Testing was with firmware built from source acquired today.
[EDIT]
I simplified the test by feeding the pin with a 20Hz square wave. The crash occurs after counting about 200 edges.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0