4 Replies Latest reply on Jul 7, 2015 8:42 AM by MSvaal

    Edison MCU interrupt performance

    MSvaal

      Copying this from another thread because it's really another question.

       

      As noted in this thread, https://communities.intel.com/thread/76169 , MCU GPIO interrupts registered as rising or falling seem to trigger on both edges, regardless of the mode selection. This works fine for me, as it's the type of behavior I wanted in the first place.

       

      I have attached the code I am using. The external device is a 90 ppr quadrature encoder, so I am reading edges of two signals offset in phase by about 90 degrees. The ISRs are getting hit on both rising and falling edges.

       

      It seems that this very simple program I am running is suffering from terrible interrupt performance. When I limit the number of interrupts to ~20-30 per second, everything works as expected, but when I generate edges that should result in 100+ interrupts per second, may are dropped/missed. I was hoping to track the encoder position at 500+ edges per second. I thought the 100 MHz MCU would have no trouble with this, but am I mistaken? Is there a more efficient way to handle this task?

       

      Thanks,

      Matt

        • 1. Re: Edison MCU interrupt performance
          Intel_Peter

          Hello Msvaal,

           

          Have you tried using a different GPIO, do you have the same results?

          How are you measuring the signal of your external device? Are you sure the output of it is the one you expect?

           

          Peter.

          • 2. Re: Edison MCU interrupt performance
            MSvaal

            Peter,

            I have tried attaching interrupts to digital pins 2,4 and 7,8 (Edison Arduino board). The results are the same. Are some GPIOs faster than others?

             

            I have verified the output of the external device with an oscilloscope; it produces clean 5V edge transitions.

             

            Thanks,

            Matt

            • 3. Re: Edison MCU interrupt performance
              Intel_Peter

              We tested to have one hundred interrupts per second without any issue. This means that there is a 10 ms window between interrupts to perform whatever you need to do. If you use print statements, they might take time and they may impact the desired amount of interrupts per second. Are you giving commands to the Edison between every interrupt?

               

              Also, when it comes to toggle a pin (On/Off) on the Arduino Expansion board using the MCU SDK, the DIG3 and DIG5 pins show better performance than the rest. I'd suggest you to try these two pins and let us know if that works for you.

               

              Peter.

              • 4. Re: Edison MCU interrupt performance
                MSvaal

                Peter,

                Thanks for your assistance. My experimentation seems consistent with your findings that a 100 Hz interrupt rate can be handled without issue. I have an extremely lightweight ISR attached to both interrupt pins, with only handful of instructions.

                 

                Unfortunately, as I am trying to use the MCU to handle interrupts at a much faster rate ( 3 kHz +), this performance is not good enough. As a workaround for my current project, I am using an Arduino Uno R3 with an ATmega16U2 running at 16 MHz to handle the two interrupt lines from my encoder. With an ISR written in assembler, it has no trouble keeping up with the high interrupt frequency. The Arduino is then sending data to the Edison over UART at a lower rate (~20bytes @50 Hz).

                 

                I was hoping to use the MCU to perform this function, and the internal UART between the Atom and MCU to transer data, but from what you are saying it seems that the MCU is not up to the task.

                 

                Matt