Other Parts Discussed in Thread: ADS112C04
Hi Team,
I am using the following code for implementing i2c communication with ADS112C04 using micro TMS280049 as master. I wrote the code for sanity check within the configuration registers. All my commands got acknowledged by the slave device, but it doesn`t giving back the data which I am asking for. Following is the code and I am attaching the scope shots which I obtained at generation of each START signal marked as (1),(2),(3) and (4) in the code.
#include"F28x_Project.h"
void main(void)
{
// Intiate system controls, GPIO pins, interrupt
InitSysCtrl();
InitGpio();
EALLOW;
GpioCtrlRegs.GPAGMUX2.bit.GPIO26 = 2; // I2CA_SDA
GpioCtrlRegs.GPAMUX2.bit.GPIO26 = 3;
GpioCtrlRegs.GPAQSEL2.bit.GPIO26 = 3; // Input qualification : Asynchronous
GpioCtrlRegs.GPAPUD.bit.GPIO26 = 0; // Pull up enable
GpioCtrlRegs.GPAGMUX2.bit.GPIO27 = 2; // I2CA_SCL
GpioCtrlRegs.GPAMUX2.bit.GPIO27 = 3;
GpioCtrlRegs.GPAQSEL2.bit.GPIO27 = 3; // Input qualification : Asynchronous
GpioCtrlRegs.GPAPUD.bit.GPIO27 = 0; // Pull up enable
GpioCtrlRegs.GPBGMUX2.bit.GPIO56 = 0; // IRQ_1
GpioCtrlRegs.GPBMUX2.bit.GPIO56 = 0;
GpioCtrlRegs.GPBGMUX1.bit.GPIO34 = 0; // ADC_RST
GpioCtrlRegs.GPBGMUX1.bit.GPIO34 = 0;
GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // Direction as output
EDIS;
GpioDataRegs.GPBCLEAR.bit.GPIO34 = 1; // ADC held at reset state
I2caRegs.I2CMDR.bit.IRS = 0; // I2C is disabled
I2caRegs.I2CPSC.bit.IPSC = 9; // System clock divider value
I2caRegs.I2CCLKL = 45; // Low time divider
I2caRegs.I2CCLKH = 45; // High time divider
I2caRegs.I2CMDR.bit.BC = 0; // 8 bits per data byte
I2caRegs.I2CFFTX.bit.I2CFFEN = 1; // FIFO mode enabled
I2caRegs.I2CFFTX.bit.TXFFIL = 10; // Transmit FIFO interrupt level
I2caRegs.I2CFFTX.bit.TXFFRST = 1; // Enable transmit FIFO operation
I2caRegs.I2CFFRX.bit.RXFFRST = 1; // Enable receive FIFO operation
I2caRegs.I2CFFRX.bit.RXFFIL = 10; // Receive FIFO interrupt level
I2caRegs.I2CMDR.bit.IRS = 1; // I2C is enabled
GpioDataRegs.GPBSET.bit.GPIO34 = 1; // ADC released from reset state
I2caRegs.I2CSAR.bit.SAR = 0x40; // Slave address register
I2caRegs.I2CCNT = 1; // Data count
I2caRegs.I2CMDR.bit.MST = 1; // Master mode
I2caRegs.I2CMDR.bit.TRX = 1; // Transmitter mode
I2caRegs.I2CMDR.bit.FREE = 1; // I2C runs in free mode
I2caRegs.I2CMDR.bit.STP = 1; // Generate stop signal
I2caRegs.I2CDXR.bit.DATA = 0x06; // RESET command
I2caRegs.I2CMDR.bit.STT = 1; // Generate start signal (1)
while(I2caRegs.I2CSTR.bit.XRDY == 0 )
{
}
I2caRegs.I2CCNT = 2; // Data count
I2caRegs.I2CMDR.bit.MST = 1; // Master mode
I2caRegs.I2CDXR.bit.DATA = 0x44; // WREG command and Configuration register 1 address
I2caRegs.I2CDXR.bit.DATA = 0x02; // CR 1 data
I2caRegs.I2CMDR.bit.STP = 1; // Generate stop signal
I2caRegs.I2CMDR.bit.STT = 1; // Generate start signal (2)
while(I2caRegs.I2CSTR.bit.XRDY == 0 )
{
}
I2caRegs.I2CCNT = 1; // Data count
I2caRegs.I2CMDR.bit.MST = 1; // Master mode
I2caRegs.I2CDXR.bit.DATA = 0x24; // RREG command and CR 1 address
I2caRegs.I2CMDR.bit.STT = 1; // Generate start signal (3)
I2caRegs.I2CMDR.bit.TRX = 0; // Receiver mode
I2caRegs.I2CMDR.bit.STT = 1; // Repeated start signal (4)
I2caRegs.I2CMDR.bit.STP = 1; // Generate stop signal
for(;;)
{
}
}

(1)

(2)

(3)

(4)
As we can see in figure (4) I am receiving a NACK but no data back from slave. It should be 0x02 which is the same value I wrote on configuration register 1 but it 0x00 instead.
Please help me to identify what might be gone wrong here.
Thank you
Vineeth