I'm using the DK-TM4C129X Connected Development Kit board. There's a TMP100 I2C sensor on board, connected to I2C6 on the chip. I've been trying to communicate with it via the TM4C129X to no avail. I've been able to talk to it using a Bus Pirate v3.6 and also with an Arduino (the connection to the chip has jumpers, which I was able to splice into). So I'm %100 confident that I've got the correct I2C addresses, commands, etc.
Here's my I2C initialization function:
void I2Csetup(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);
GPIOPinTypeI2CSCL(GPIO_PORTG_BASE, GPIO_PIN_4);
GPIOPinTypeI2C(GPIO_PORTG_BASE, GPIO_PIN_5);
GPIOPinConfigure(GPIO_PG4_I2C3SCL);
GPIOPinConfigure(GPIO_PG5_I2C3SDA);
I2CMasterInitExpClk(I2C3_BASE, mstrClk, false); // set up I2C for master, at 100KHz
}
Does this seem correct? Later on I call a function to write to the TMP100, and it looks like this (this is just one part of the switch):
volatile int16_t returndata;
switch(oper) {
case 0:
// get temp value from bq27510 (0x06)
I2CMasterSlaveAddrSet(I2C3_BASE, WRITEADDR, false);
I2CMasterDataPut(I2C3_BASE, 0x06);
I2CMasterControl(I2C3_BASE, I2C_MASTER_CMD_SINGLE_SEND);
while(I2CMasterBusy(I2C3_BASE));
I2CMasterSlaveAddrSet(I2C3_BASE, READADDR, true);
I2CMasterControl(I2C3_BASE, I2C_MASTER_CMD_SINGLE_RECEIVE);
while(I2CMasterBusy(I2C3_BASE));
returndata = I2CMasterDataGet(I2C3_BASE);
return returndata;
This never seems to return anything useful, and when scoping the SDA and SCL pins, it seems like the chip isn't responding. If anyone is curious I can take pictures or video of what the scope is seeing. I'm quite experienced with I2C. I've gotten SPI working with this chip a few times now, and usually I find I2C easier to set up.
If there are any glaring errors, I would appreciate the feedback! By the way, WRITEADDR is defined as 0xAA, READADDR is 0xAB which is correct. I'm not sure why the function doesn't stall at the I2CMasterControl statement, as it seems the chip isn't getting any response. However, I guess if it clocks out nothing it just assumes it's 0x00... but if it doesn't get an ACK, shouldn't that return an error?
Anyway, I'm clearly doing something wrong. All help appreciated!