2 Replies Latest reply on Apr 14, 2016 1:58 PM by Cooper132

    Atom interrupt via MCU gpio

    Cooper132

      Hi,

       

      is it somehow possible to trigger an (mraa) interrupt on the Atom processor by toggling a GPIO pin on the MCU?

      Basically passing through an interrupt from one pin to another.

      Also this would at least give some more communication options between the Atom and the MCU.

       

      My current project sets up an ISR on the MCU on one gpio pin, and the passthrough on another:

      gpio_setup(14, 0);
      gpio_register_interrupt(14, 0, imu_irq);
      gpio_setup(46, 1);
      

       

      In the ISR I check for a certain type of interrupt status (via I2C) and toggle the output gpio high if it occurs:

      int imu_irq(int req) {
        ...
        uint8_t is = getIntStatus();
        if(hasWOMInt(is))
          gpio_write(46, 1);
        else
          gpio_write(46, 0);
        ...
      }
      

       

      On the Atom i register an interrupt on the second pin:

      wom_interrupt = new mraa::Gpio(32); // GP46
      wom_interrupt->dir(mraa::DIR_IN);
      wom_interrupt->isr(mraa::EDGE_BOTH, wom_isr, NULL);
      

       

      But this interrupt is never called (checked by a simple debug output at the start of it).

      However if I just do polling on the pin I see it changes from 0 to 1 when it should and back to 0 right after.

       

      Am I missing something? Or is this just not possible?

       

      Regards,

      Cooper

        • 1. Re: Atom interrupt via MCU gpio
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello Cooper132,
           
          I'm not sure I completely understood how you want to trigger the ISR. How exactly would you like to activate the interrupt? If what you'd like to do is to set, let's say, pin 6 on the mraa side to receive an interrupt and the mcu part to send the trigger signal, then no, this can't be done, the pins can either be accessed from the Atom CPU or from the Quark MCU but not from both on the same time.
           
          If instead what you'd like to do is to use, let's say, pin 3 on the MCU for the trigger and pin 6 on the CPU for the interrupt, then you can wire them together and you will be able to trigger an interrupt.
           
          As I mentioned, I'm not sure I'm following how you're setting up the interrupt, please correct me if I'm wrong. What you are currently doing is setting up an interrupt on the MCU on pin 14 and when that interrupt is triggered you check for either turn on or off pin 46. On the CPU side you set an interrupt on pin 32 (MCU pin 46) and wait for it to be triggered from the MCU interrupt, am I right? If so, then this wouldn’t work because of the reason I mentioned above, the MCU and the CPU can't interact with the same pin at the same time.
           
          Peter.

          • 2. Re: Atom interrupt via MCU gpio
            Cooper132

            Hi Peter,

             

            yes, you understand correctly , this is what I wanted to do.

            Alas, I will just use the ttymcu0 to send a string, as rewiring our custom board is currently more of a hassle than it would be useful for this case.

             

            Anyway, thanks for the quick reply!

             

            Cooper