2 Replies Latest reply on May 12, 2015 8:42 AM by user_14586677

    GPIO interrupt doesn't seem to work, but why?

    tim.ker

       Hallo

         

      I'm trying to get a falling edge pin interrupt working following this tutorial:

         

      http://www.cypress.com/?docID=50769 (from page 9).

         

      in an init function in my code is configure and enable interrupts:

         

      [code]

         

              /* falling edge interrupt*/

         

      PRT0IC0 |= 0x10;

         

      PRT0IC1 &= ~0x10;

         

       

         

      /* Enable P0_4 interrupts */

         

      PRT0IE |= 0x10;

         

       

         

      /* Enable GPIO interrupts */

         

      M8C_EnableIntMask(INT_MSK0, INT_MSK0_GPIO);

         

       

         

      /* Enable Global interrupts */

         

      M8C_EnableGInt;

         

      [/code]

         

      And in the same file, the ISR is implemented:

         

      void GPIO_ISR(void)

         

      {

         

      if((PRT0DR & 0x10) == 0)

         

      {

         

      setPeripheralIOPin(led_backlight_enable); // this function works

         

      }

         

      }

         

      In the .h file of that file i added the proposed pragma:

         

      [code]

         

      #pragma interrupt_handler GPIO_ISR

         

      [/code]

         

       

         

      And as proposed in the tutorial i added the ISR jump to the boot.tpl and PSoCGPIOINT.asm file (tried both).

         

      PSoCGPIOINT:

         

      [/ode]

         

      PSoC_GPIO_ISR:

         

       

         

         ;@PSoC_UserCode_BODY@ (Do not change this line.)

         

         ;---------------------------------------------------

         

         ; Insert your custom code below this banner

         

         ;---------------------------------------------------

         

      ljmp _GPIO_ISR

         

         ;---------------------------------------------------

         

         ; Insert your custom code above this banner

         

         ;---------------------------------------------------

         

         ;@PSoC_UserCode_END@ (Do not change this line.)

         

       

         

         reti

         

      [/code]

         

       

         

      boot.tpl:

         

      [code]

         

       org   1Ch                      ;GPIO Interrupt Vector

         

          `@INTERRUPT_7`

         

      ljmp _GPIO_ISR

         

          reti

         

      [/code]

         

       

         

      As far as i'm concerned i've done everything named in the tutorial. But obviously i failed at some point as it isn't working. When i make P0.4 low (high by default), the led backlight pin doesn't become high.

         

      P0.4 is defined as high Z in the chip editor with falling edge interrupt selected.

         

       

         

      Does anyone of you know why?

         

      Hope you can help me,

         

      Thanks in advance

         

      timberleek.