Other Parts Discussed in Thread: PCA9534
I have a driver written for the I2C module that appears to be sending the correct data to a PCA9534 port expander but I am having difficulty getting the I2C interrupts working. Below is my init function so please let me know what I'd doing wrong.
void I2CA_Init(void)
{
I2CBusReset(); // I/O control of I2C lines to force a bus reset (11 clocks followed by a stop condition)
I2caRegs.I2CMDR.bit.IRS = 0; // Reset the I2C module
I2caRegs.I2CPSC.all = 127; // Prescaler - This is set high so the data speed will be low and can be seen on my scope
InitI2CGpio();
I2caRegs.I2CCLKL = 10; // NOTE: must be non zero
I2caRegs.I2CCLKH = 5; // NOTE: must be non zero
I2caRegs.I2CIER.bit.ARDY = 1; //enable basic I2C-interrupt - access ready
I2caRegs.I2CIER.bit.NACK = 1; //enables I2C NACK interrupt: communication error handling
I2caRegs.I2CIER.bit.SCD = 1; //enables stop condition interrupt
I2caRegs.I2CFFTX.all = 0; //I2C Transmit FIFO Register
I2caRegs.I2CFFTX.bit.TXFFIL = 0; //set the transmit interrupt level (bit field TXFFIL) to zero
I2caRegs.I2CFFTX.bit.I2CFFEN = 1; //Enable the FIFOs
I2caRegs.I2CFFTX.bit.TXFFRST = 1; //Enable the FIFO-transmit support
I2caRegs.I2CFFRX.all = 0; //I2C Receive FIFO Register
I2caRegs.I2CFFRX.bit.RXFFIL = 2; //default value for now, value will change depending on what is requested.
I2caRegs.I2CFFRX.bit.RXFFRST = 1; //Enable the FIFO-receiver support
I2caRegs.I2CFFRX.bit.RXFFIENA = 0; //disable thi FIFO RXinterrupt
I2caRegs.I2CMDR.bit.BC=0; // 8 bit data
I2caRegs.I2CMDR.bit.RM=0; // non repeat mode
I2caRegs.I2CMDR.bit.FDF=0;
DINT;
EALLOW;
PieVectTable.I2CINT1A = &i2c_basic_isr; // set the isr routine
PieCtrlRegs.PIEIER8.bit.INTx1 =1; // enable the interrupt
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // enable PIE
PieCtrlRegs.PIEACK.bit.ACK8=1; // clear the ACK bit
IER |= M_INT8; // enable group 8 interrupts
I2caRegs.I2CFFTX.bit.TXFFINTCLR = 1; // clear any pending interrupt
EDIS;
EINT;
I2caRegs.I2CMDR.bit.IRS = 1; //Take I2C out of reset
return;
}
The issue is that I'm never entering my ISR. Any ideas?