Other Parts Discussed in Thread: C2000WARE
Hi
Iam using TMS320F28377SPTP_D.
Am trying to integrate external eeprom 24LC256 using I2C.
I could start the i2c communication write slave addresses, page addresses and data to eeprom. But read operation is not working.
When I checked with the waveforms, I could see the write operation from start to write operation of data. But after that stop signal is missing in the waveform.
Below is my init function
void InitI2CA(void)
{
EALLOW;
GpioCtrlRegs.GPBDIR.bit.GPIO32 = 0x0; //SDDA
GpioCtrlRegs.GPBPUD.bit.GPIO32 = 0x0; //enable internal pull up
GpioCtrlRegs.GPBQSEL1.bit.GPIO32 = 0x3; //Asynchronous operation
GpioCtrlRegs.GPBGMUX1.bit.GPIO32 = 0x0;
GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 0x1;
GpioCtrlRegs.GPBDIR.bit.GPIO33 = 0x0; //SCLA
GpioCtrlRegs.GPBPUD.bit.GPIO33 = 0; //enable internal pull up
GpioCtrlRegs.GPBQSEL1.bit.GPIO33 = 0x3; //Asynchronous operation
GpioCtrlRegs.GPBGMUX1.bit.GPIO33 = 0x0;
GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 0x1;
EDIS;
I2caRegs.I2CSAR.all = 0x50; // Slave address - EEPROM
I2caRegs.I2CPSC.all = 19; // Prescaler, I2C module clock 10MHz
I2caRegs.I2CCLKL = 10; // NOTE: must be non zero --SCL 400KHz
I2caRegs.I2CCLKH = 5; // NOTE: must be non zero
I2caRegs.I2CFFTX.all = 0x6000; // Enable FIFO mode and TXFIFO
I2caRegs.I2CFFRX.all = 0x2000; // Enable RXFIFO, clear RXFFINT,
I2caRegs.I2CMDR.all = 0x0020; // Take I2C out of reset
}
Below is my write function
void I2C_WriteData_1(char DeviceAddr, char AccessAddr, char data)//char data
{
if(DeviceAddr == EEPROM_DEVICE)
{
I2caRegs.I2CSAR.all = DeviceAddr; //Slave address
// I2caRegs.I2CCNT = 1;
I2caRegs.I2CDXR.all = (AccessAddr >> 8); // Address high
I2caRegs.I2CDXR.all = (AccessAddr & 0xFF); // Address low
I2cbRegs.I2CMDR.all &= 0x0000;
I2caRegs.I2CMDR.all |= 0x2620; //Send start as master transmitter
I2caRegs.I2CDXR.all = data;
I2caRegs.I2CMDR.all |= 0x0800; //Stop i2c
while (I2caRegs.I2CMDR.bit.STP == 1);
}
}


