Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Pin IRQs not supported yet?

    Scheduled Pinned Locked Moved LoPy
    5 Posts 2 Posters 1.6k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kurt
      last edited by kurt

      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
      
      L 1 Reply Last reply Reply Quote 0
      • L Offline
        LoneTech @kurt
        last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • K Offline
          kurt
          last edited by kurt

          @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.

          L 1 Reply Last reply Reply Quote 0
          • L Offline
            LoneTech @kurt
            last edited by

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

            1 Reply Last reply Reply Quote 0
            • K Offline
              kurt
              last edited by

              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.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post

              Pycom on Twitter

              Pycom