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.

TMS320 and GPIO connected to Interrupt



Hi, I am doing a program that want to reveal the falling edge of the GPIO59, I have disabled the Pullup of GPIO59 and I use an external switch for  switch the voltage between 0V and 3V.

The program never entry into the interrupt routine and I don't understand why.

Here is the code:

#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File

// external function prototypes
extern void InitSysCtrl(void);
extern void InitPieCtrl(void);
extern void InitPieVectTable(void);

interrupt void xint3_isr(void);

void main(void)
{
// Initialize System Control: PLL, WatchDog, enable Peripheral Clocks
InitSysCtrl();
// Clear all interrupts and initialize PIE vector table, disable CPU interrupts
DINT;
// Initialize PIE control registers to their default state
// The default state is all PIE interrupts disabled and flags are cleared
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags
IER = 0x0000;
IFR = 0x0000;
// Initialize the PIE vector table with pointers to the shell Interrupt Service Routines (ISR)
// This will populate the entire table, even if the interrupt is not used in this example
InitPieVectTable();
// Interrupts that are used in this example are re-mapped to ISR functions found within this file.
EALLOW;
PieVectTable.XINT3 = &xint3_isr;
EDIS;

// Enable Xint3 in the PIE: Group 12 interrupt 1
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block
PieCtrlRegs.PIEIER12.bit.INTx1= 1; // Enable PIE Group 12 INTx1
IER |= M_INT12; // Enable CPU int12
EINT; // Enable Global Interrupts

// GPIO58 is Inputs
EALLOW;
GpioCtrlRegs.GPBMUX2.bit.GPIO58 = 0; // GPIO58
GpioCtrlRegs.GPBPUD.bit.GPIO58 = 1; // Pull up disabled
GpioCtrlRegs.GPBDIR.bit.GPIO58 = 0; // Input
GpioCtrlRegs.GPBQSEL2.bit.GPIO58 = 2; // 6 samples
GpioCtrlRegs.GPBCTRL.bit.QUALPRD2 = 0xFF; // Maximum sampling period GPIO58
EDIS;
// GPIO59 is Output
EALLOW;
GpioCtrlRegs.GPBMUX2.bit.GPIO59 = 0; // GPIO59
GpioCtrlRegs.GPBPUD.bit.GPIO59 = 0; // Pull up
GpioCtrlRegs.GPBDIR.bit.GPIO59 = 1; // Output
EDIS;

// GPIO58 is XINT3, Configure XINT3
EALLOW;
GpioIntRegs.GPIOXINT3SEL.bit.GPIOSEL = 0x12;// Choice GPIO58 for Xint3
EDIS;
XIntruptRegs.XINT3CR.bit.POLARITY = 2; // Falling edge interrupt
XIntruptRegs.XINT3CR.bit.ENABLE = 1; // Enable XINT3
while(1)
{
}
}
//========================================================================
interrupt void xint3_isr(void)
{
GpioDataRegs.GPBTOGGLE.bit.GPIO59 = 1;
// Acknowledge this interrupt to get more from group 12
PieCtrlRegs.PIEACK.all = PIEACK_GROUP12;
}