This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28027 troubles with keypad interrupt

Hello!

I have C2000 Piccolo LAUNCHXL-F28027 and 4x4 matrix keypad, so I want to connect keypad to the F28027 using GPIO pins but get problems:

  1. My counter variable increases by several points after one key interruption(e.g. before one interruption = 0, after one interruption = 3).
  2. Sometimes interruptions occurs when I release the key(but I have set "XIntruptRegs.XINT1CR.bit.POLARITY = 2").
  3. Sometimes interruptions occurs when I press keys which don't have interruptions.

Here is the code:



#include "DSP28x_Project.h" // Device Headerfile and Examples Include File void delay_loop(unsigned long i); void Gpio_select(void); interrupt void xint1_isr(void); int counter; void main(void) { counter = 0; InitSysCtrl(); DINT; InitPieCtrl(); IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; PieVectTable.XINT1 = &xint1_isr; EDIS; PieCtrlRegs.PIECTRL.bit.ENPIE = 1; PieCtrlRegs.PIEIER1.bit.INTx4= 1; IER |= M_INT1; EINT; EALLOW; GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0; GpioCtrlRegs.GPAPUD.all = 0; GpioCtrlRegs.GPADIR.bit.GPIO1 = 1; EDIS; EALLOW; GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 0; GpioCtrlRegs.GPAPUD.bit.GPIO2 = 0; GpioCtrlRegs.GPADIR.bit.GPIO2 = 0; GpioCtrlRegs.GPAQSEL1.bit.GPIO2 = 2; GpioCtrlRegs.GPACTRL.bit.QUALPRD2 = 0xFF; EDIS; EALLOW; GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 2; EDIS; XIntruptRegs.XINT1CR.bit.POLARITY = 2; XIntruptRegs.XINT1CR.bit.ENABLE = 1; while(1) { } } interrupt void xint1_isr(void) { PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; counter++; }

How can I fix these problems?