Pin IRQs not supported yet?



  • I guess, from the missing example on triggering an interrupt for a Pin, that this is not supported yet, right?
    That is what happens when I try anyway:

    MicroPython a78d0fa on 2016-10-21; LoPy with ESP32
    Type "help()" for more information.
    >>> from machine import Pin
    >>> def pincb(pin):
    ...     print(pin.id())
    ...
    ...
    ...
    >>> pin_int = Pin('G17', mode=Pin.IN, pull=Pin.PULL_UP)
    >>> pin_int.irq(trigger=Pin.IRQ_RISING, handler=pincb)
    <irq>
    >>> P10
    Guru Meditation Error of type LoadStoreError occurred on core   0. Exception was unhandled.
    Register dump:
    PC      :  401260d0  PS      :  00060830  A0      :  8011ef2e  A1      :  3ffdc420  
    A2      :  00000000  A3      :  00000000  A4      :  3ffd24dc  A5      :  3ffd24dc  
    A6      :  3ffd24dc  A7      :  3ffd24dc  A8      :  00000000  A9      :  00000000  
    A10     :  3ffd24dc  A11     :  3ffd24dc  A12     :  00000000  A13     :  3f402ee7  
    A14     :  3ffdbd1c  A15     :  3ffdbce4  SAR     :  00000014  EXCCAUSE:  00000003  
    EXCVADDR:  3f402f08  LBEG    :  00000000  LEND    :  00000000  LCOUNT  :  00000000  
    Rebooting...
    ets Jun  8 2016 00:22:57
    


  • Ah, this piece of information was missing. The version with the print P10 was from the wipy - the loopy is either less powerful, or not yet optimized.



  • @kurt Yes, because my interrupt handler did a simpler task. I merely toggled another output pin (with an LED attached).



  • @LoneTech Do you say, you succeeded and it did not crash? My version is
    release='0.9.1.b1', version='a78d0fa on 2016-10-21' - same as yours. Yes, I did read the stuff about writing IRQ handlers. Thanks for the link anyway.



  • @kurt I've succeeded using Pin IRQs with firmware 0.9.1.b1 (as, evidently, did you; it did print P10). However, you mustn't call things that allocate or deallocate on the heap within the interrupt handler, and preferably not anything time consuming like serial I/O. See MicroPython's documentation on writing interrupt handlers.


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.