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.

Not rising stop condition interrupt or flag also not coming in I2C of TMS320C6748?

Hai,

Startware based on i am modified code and started but it is not coming to I2C_ISR routine function.Below code i am using

int main(void)
{
volatile uint16_t i=0,j=0,k;
EVMC6748_init();
// Initialization of Modules
PINMUX_init();
unsigned int num = 0;

ISTP = (unsigned int)intcVectorTable;
uint16_t *src3 = (uint16_t*)0x01800104;
*src3 = 0x0000024; //selecting interrupt 4 in intmux reg for IIC0ISR=36(0x24)
SETBIT(CSR ,0x14000010); //Disable Global Interrupt
SETBIT(IER,0x00000013) ; // enable INT4 as CPU interrupt(4-INT4,1-NMI,0-RST)
SETBIT(CSR ,0x14000003); //Global Interrupt enable
count = 0;
dataToSlave[0] = 0x06;
dataToSlave[1] = 0x3f;
i2c_init();
I2caRegs.ICMDR.bit.STP = 1;

while(flag1);

dataToSlave[0] = 0x02;
for (num = 100; num != 0; num--)
{
count = 0;
dataToSlave[1] = 0x00;

SetupI2CTransmit();

BlinkDelay();

count = 0;
dataToSlave[1] = 0xC0;/*data to OFF LED*/

SetupI2CTransmit();
BlinkDelay();
}

while(1);
}

void i2c_init(void)
{
I2caRegs.ICMDR.all = 0x0000;

I2caRegs.ICPSC.all = 0X02; // Prescaler - need 7-12 Mhz on module clk (90/9 = 10MHz)
I2caRegs.ICCLKL = 0x05; // NOTE: must be non zero
I2caRegs.ICCLKH = 0x05; // NOTE: must be non zero

I2caRegs.ICSAR = 0x42; // Slave address
I2caRegs.ICIMR.all = 0x34; // Enable SCD & ARDY interrupts
I2caRegs.ICCNT = 0x01;
// I2caRegs.ICMDR.bit.STP = 1;
I2caRegs.ICMDR.all = 0x6E20; // Take I2C ICXRDY

}
static void SetupI2CTransmit(void)
{
I2caRegs.ICCNT = 0x02;
I2caRegs.ICMDR.all = 0x6620; // Take I2C out of reset
I2caRegs.ICIMR.all = 0x34; // Enable SCD & ARDY interrupts
 I2caRegs.ICMDR.bit.STT = 1; // Take I2C out of reset
}

interrupt void i2c_isr(void) // I2C-0
{
uint16_t IntSource;
// Read interrupt source
IntSource = I2caRegs.ICIVR.all;
// Interrupt source = stop condition detected
if (IntSource == 0x00000005u)
{
/* Put data to data transmit register of i2c */
I2caRegs.ICDXR = dataToSlave[count++];
}

if (IntSource == I2C_SCD_ISRC)
{
/* Disable transmit data ready register */
I2caRegs.ICIMR.bit.ICXRDY = 0;
flag1 = 0;
}
if (IntSource == 0x00000003u)
{
/* Disable transmit data ready register */
if(I2caRegs.ICSTR.bit.NACK == 1)
{
UART_txString(UART1,"NACK");
I2caRegs.ICMDR.bit.STP = 1;
I2caRegs.ICSTR.all = I2C_CLR_NACK_BIT;
}
else if(CurrentMsgPtr->MsgStatus == I2C_MSGSTAT_SEND_NOSTOP_BUSY)
{
// send_string("Read1");
CurrentMsgPtr->MsgStatus = I2C_MSGSTAT_RESTART;
}
}
}