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

    What is this: Unhandled exception in interrupt handler TypeError: 'str' object is not callable

    Scheduled Pinned Locked Moved WiPy 2&3
    wipyinterrupttimer.alarm
    4 Posts 2 Posters 1.5k 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.
    • C Offline
      constantinos
      last edited by

      It occures when an interrupt is triggered after a Timer.Alarm invoked for the first time.
      The code running inside the ISR handler is something like P += 1.

      Any help is appreciated.
      Constantinos

      1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh
        last edited by

        Do you have more insight to your code, especially the statement where yoe set up the timer alarm and the interrupt handler itself?

        C 1 Reply Last reply Reply Quote 0
        • C Offline
          constantinos @robert-hh
          last edited by

          @robert-hh Maybe I found the problem. I was initializing the callback handler for the Pin inside a class. The call back method was a class method. I realized that callback handlers must be single functions.

          1 Reply Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh
            last edited by

            No, the callback handler can be inside a class. But then the handler must have self as first additional argument. Example (ESP8266 one, but principle should work) with ISR fucntion sample.

            class acquire:
            
                def __init__(self):
                    self.adc_read = machine.ADC(0).read
                    self.data = array.array("L", [0] * _BUFFERSIZE)
                    self.index_put = 0
            
                def sample(self, x):
                    self.data[self.index_put] = self.adc_read()
                    self.index_put = (self.index_put + 1) % _BUFFERSIZE
                    self.irq_busy = False
            
            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