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

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 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:

   

   

        /* 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;

   

   

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:

   

   

#pragma interrupt_handler GPIO_ISR

   

   

 

   

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

   

   

 

   

boot.tpl:

   

   

 org   1Ch                      ;GPIO Interrupt Vector

   

    `@INTERRUPT_7`

   

ljmp _GPIO_ISR

   

    reti

   

   

 

   

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.

0 Likes
2 Replies
Anonymous
Not applicable

 apologies for the makeup of the post. 

   

I assumed

 tags would do the trick. unfortunately, i don't see any edit possibility. is this correct?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

 Take a look at this for GPIO ISR setup -

   

 

   

www.cypress.com/

   

 

   

Insofar as the post issue, the forum software has many issues. Possibly

   

next time paste it as a word paste, maybe that will retain formatting.

   

 

   

If you do Read Modify Writes on  GPIO don't forget to use shadow registers -

   

  

   

http://www.cypress.com/?rID=2900    AN2094 - PSoC® 1 - Getting Started with GPIO

   

 

   

https://www.youtube.com/watch?v=tei6q5M3C0g       Shadow Registers

   

 

   

http://www.cypress.com/?rID=39497     Shadow Registers

   

 

   

 

   

Regards,. Dana.

0 Likes