I've been trying, with no success, to use a code for i2c that worked in stellaris and tm4c123 launchpad in the new tm4c129 launchpad. I just changed the pin ports configs
i've been searching and it seems that the i2c fuctions in TivaWare are now diferent for the tm4c129. Is there any documentation highlighting this diferences somewhere for better reading?
My code is the folowing for setup
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
I2CMasterInitExpClk(I2C0_BASE, F_CPU, ulI2CSpeed);
and i have this fuction for sending:
while(I2CMasterBusy(ulI2CBase)) {}
//
// Tell the master module what address it will place on the bus when
// writing to the slave.
//
I2CMasterSlaveAddrSet(ulI2CBase, ucSlaveAdress, 0);
//
// Place the command to be sent in the data register.
//
I2CMasterDataPut(ulI2CBase, ucReg);
//
// Initiate send of data from the master.
//
I2CMasterControl(ulI2CBase, I2C_MASTER_CMD_BURST_SEND_START);
//
// Wait until master module is done transferring.
//
while(I2CMasterBusy(ulI2CBase)) {}
//
// Check for errors.
//
if( I2CMasterErr(ulI2CBase) != I2C_MASTER_ERR_NONE)
{
return 0;
}
//
// Place the value to be sent in the data register.
//
I2CMasterDataPut(ulI2CBase, ucValue);
//
// Initiate send of data from the master.
//
I2CMasterControl(ulI2CBase, I2C_MASTER_CMD_BURST_SEND_CONT);
//
// Wait until master module is done transferring.
//
while(I2CMasterBusy(ulI2CBase)) {}
//
// Check for errors.
//
if( I2CMasterErr(ulI2CBase) != I2C_MASTER_ERR_NONE)
{
return 0;
}
//
// Initiate send of data from the master.
//
I2CMasterControl(ulI2CBase, I2C_MASTER_CMD_BURST_SEND_FINISH);
//
// Wait until master module is done transferring.
//
while(I2CMasterBusy(ulI2CBase)) {}
//
// Check for errors.
//
if( I2CMasterErr(ulI2CBase) != I2C_MASTER_ERR_NONE)
{
return 0;
}
//
// Return 1 if there is no error.
//
return 1;