Hi,
I'm working on an application that needs to have 2 input channels that trigger different HWIs, so I thought I'd use GPIOs. I set one GPIO (GP4[10]) to be linked to the HWI4 and the other GPIO (GP5[11]) to be linked to the HWI8. I set both in the TCF file to be handled by their respective ISR functions and proceed to set the PINMUX and the direction of the pins in the GPIO varaibles.
But I've run into a problem, where if I set one of the pins then the other stops working and vice-versa. I'll post the important parts of the code here and hopefully you guys can shed some light onto this situation because I've found myself lost.
Thanks in advance,
INTC Configuration:
IntcRegs->INTMUX1 &= ~(INTMUX1_INT4);
IntcRegs->INTMUX1 |= (BANK4_INT << 0);
IntcRegs->INTMUX2 &= ~(INTMUX2_INT8);
IntcRegs->INTMUX2 |= (BANK5_INT << 0);
IER |= (1 << 4);
IER |= (1 << 8);
PINMUX Configuration:
SysRegs->PINMUX8 |= GP5_10;
SysRegs->PINMUX12 |= GP4_0;
GPIO Configuration:
// Clear Rising and Falling Triggers
Gpio0Regs->BANK[2].CLR_FAL_TRIG = 0xFFFFFFFF; // Clear Falling Triggers
Gpio0Regs->BANK[2].CLR_RIS_TRIG = 0xFFFFFFFF; // Clear Rising Triggers
// Set GPIO GP5[10]
Gpio0Regs->BANK[2].DIR |= (1 << 26); // Direction (Input)
Gpio0Regs->BINTEN |= (1 << 5); // Enable Bank Interrupts
Gpio0Regs->BANK[2].SET_RIS_TRIG = (1 << 26); // Set Interrupt on Rising
// Set GPIO GP4[0]
Gpio0Regs->BANK[2].DIR |= (1 << 0); // Direction (Input)
Gpio0Regs->BINTEN |= (1 << 4); // Enable Bank Interrupts
Gpio0Regs->BANK[2].SET_FAL_TRIG = (1 << 0); // Set Interrupt on Falling
Explanation:
Ok, so... the macros are all good (I've double-checked). The problem actually happens in the GPIO configuration, Only the first one that I set works. If i first set the GPIO for the Bank 5 interruption then that's the one that works and vice-versa.
I do really appreciate any kind of help you can provide me.
Regards,
~ Aquiles Lacruz