Hi, I am facing issue with I2C interface with TM4C1231E^PM. Kindly verify my program and advise
TM4C1231E6PM PA6 SDA and PA7 SCL connected with RTC DS1307.
program written same as given in application example. please suggest
what exactly problem with software.
our code as follows.
/ i2c init
SysCtlPeripheralReset(SYSCTL_PERIPH_I2C1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable port PA7 for I2C1 I2C1SDA
//
GPIOPinConfigure(GPIO_PA7_I2C1SDA);
GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);
//
// Enable port PA6 for I2C1 I2C1SCL
//
GPIOPinConfigure(GPIO_PA6_I2C1SCL);
GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
I2CMasterInitExpClk(I2C1_BASE, SysCtlClockGet(), false); // data rate 100kbps
I2CMasterEnable(I2C1_BASE); // master enable
I2CMasterSlaveAddrSet(I2C1_BASE,0xD0,false); // a write
while(I2CMasterBusBusy(I2C1_BASE));
I2CMasterDataPut(I2C1_BASE,00); // write address(MSB) for the starting location
I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_START); //start a burst write operation
while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy
I2CMasterDataPut(I2C1_BASE,0x00); // write address(MSB) for the starting location
I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy
I2CMasterDataPut(I2C1_BASE,0x07); // write address(MSB) for the starting location
I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_SINGLE_SEND); //start a burst write operation
while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy
I2CMasterDataPut(I2C1_BASE,0x90); // write address(MSB) for the starting location
I2CMasterControl(I2C1_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
while(I2CMasterBusy(I2C1_BASE)); //check if the operation is over; 1 = busy
Regards Atul Bhakay