Other Parts Discussed in Thread: FDC1004
Hi,
i have configured I2CA for Capacitor Sensor (FdC1004) , it is working(i used TI sample code).
i configured the same for for I2CB also, it is not working.
i enabled the 8.3 interrupt and ctrlbregs also.
while debugging code , it is not executing interrupt(not invoking interrupt).
please provide the information about 91 and 92 pins.
I am not getting , what is the peripheral value while passing arguments in GPIO_SetupPinMux function.
please help me in that.
for more information please fallow the below code
/*****************************************************************************/
void I2CGPIOIntilization(void)
{
//I2C interface
// For this example, only init the pins for the SCI-A port.
// These functions are found in the F2837xD_Gpio.c file.
GPIO_SetupPinMux(32, GPIO_MUX_CPU1, 1);
GPIO_SetupPinMux(33, GPIO_MUX_CPU1, 1);
GPIO_SetupPinMux(91, GPIO_MUX_CPU1, 2);
GPIO_SetupPinMux(92, GPIO_MUX_CPU1, 2);
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.I2CA_INT = &i2c_int1a_isr;
PieVectTable.I2CB_INT = &i2c_int1b_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
// Step 4. Initialize the Device Peripherals:
I2CA_Init();
I2CB_Init();
// Enable I2C __interrupt 1 in the PIE: Group 8 __interrupt 1
PieCtrlRegs.PIEIER8.bit.INTx1 = 1;
PieCtrlRegs.PIEIER8.bit.INTx3 = 1;//Enable the I2C B interrupt
// Enable CPU INT8 which is connected to PIE group 8
IER |= M_INT8;
EINT;
//Intilise FDC1004 Configure register
}
__interrupt void i2c_int1b_isr(void) // I2C-B
{
Uint16 IntSource, i;
// Read __interrupt source
IntSource = I2cbRegs.I2CISRC.all;
// Interrupt source = stop condition detected
if(IntSource == I2C_SCD_ISRC)
{
// If completed message was writing data, reset msg to inactive state
if (CurrentMsgPtr->MsgStatus == I2C_MSGSTAT_WRITE_BUSY)
{
CurrentMsgPtr->MsgStatus = I2C_MSGSTAT_INACTIVE;
}
else
{
// If a message receives a NACK during the address setup portion of the
// EEPROM read, the code further below included in the register access ready
// __interrupt source code will generate a stop condition. After the stop
// condition is received (here), set the message status to try again.
// User may want to limit the number of retries before generating an error.
if(CurrentMsgPtr->MsgStatus == I2C_MSGSTAT_SEND_NOSTOP_BUSY)
{
CurrentMsgPtr->MsgStatus = I2C_MSGSTAT_SEND_NOSTOP;
}
// If completed message was reading EEPROM data, reset msg to inactive state
// and read data from FIFO.
else if (CurrentMsgPtr->MsgStatus == I2C_MSGSTAT_READ_BUSY)
{
CurrentMsgPtr->MsgStatus = I2C_MSGSTAT_INACTIVE;
for(i=0; i < I2C_NUMBYTES_READ; i++)
{
CurrentMsgPtr->MsgBuffer[i] = I2cbRegs.I2CDRR.all;
}
}
}
} // end of stop condition detected
// Interrupt source = Register Access Ready
// This __interrupt is used to determine when the EEPROM address setup portion of the
// read data communication is complete. Since no stop bit is commanded, this flag
// tells us when the message has been sent instead of the SCD flag. If a NACK is
// received, clear the NACK bit and command a stop. Otherwise, move on to the read
// data portion of the communication.
else if(IntSource == I2C_ARDY_ISRC)
{
if(I2cbRegs.I2CSTR.bit.NACK == 1)
{
I2cbRegs.I2CMDR.bit.STP = 1;
I2cbRegs.I2CSTR.all = I2C_CLR_NACK_BIT;
}
else if(CurrentMsgPtr->MsgStatus == I2C_MSGSTAT_SEND_NOSTOP_BUSY)
{
CurrentMsgPtr->MsgStatus = I2C_MSGSTAT_RESTART;
}
} // end of register access ready
else
{
// Generate some error due to invalid __interrupt source
asm(" ESTOP0");
}
// Enable future I2C (PIE Group 8) __interrupts
PieCtrlRegs.PIEACK.all = PIEACK_GROUP8;
}