Other Parts Discussed in Thread: TMP100
Hello,
I'm using TI's EVM for TIVA: TM4C129X
The board contains TI's TMP 100 which is an I2C Temp. sensor.
Based on the master_slave_loopback.c code example I coded the attached file.
But it seems the TMP100 is not sending a reply.
Also. upon init compltion, the clock of the SCL should be set to '0' but it remains '1'
Can you help ?
int main(void)
{
//
// Set the clocking to run directly from the external crystal/oscillator.
// TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
// crystal on your board.
//
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// The I2C6 peripheral must be enabled before use.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C6);
//
// For this example I2C6 is used with PortB[7:6]. The actual port and
// pins used may be different on your part, consult the data sheet for
// more information. GPIO port B needs to be enabled so these pins can
// be used.
// TODO: change this to whichever GPIO port you are using.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
//
// Configure the pin muxing for I2C6 functions on port B2 and B3.
// This step is not necessary if your part does not support pin muxing.
// TODO: change this to select the port/pin you are using.
//
GPIOPinConfigure(GPIO_PB6_I2C6SCL);
GPIOPinConfigure(GPIO_PB7_I2C6SDA);
//
// Select the I2C function for these pins. This function will also
// configure the GPIO pins pins for I2C operation, setting them to
// open-drain operation with weak pull-ups. Consult the data sheet
// to see which functions are allocated per pin.
// TODO: change this to select the port/pin you are using.
//
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_6 | GPIO_PIN_7);
//
// Enable and initialize the I2C6 master module. Use the system clock for
// the I2C6 module. The last parameter sets the I2C data transfer rate.
// If false the data rate is set to 100kbps and if true the data rate will
// be set to 400kbps. For this example we will use a data rate of 100kbps.
//
I2CMasterInitExpClk(I2C6_BASE, SysCtlClockGet(), false);
//
// Place the data to be sent in the data register
//
I2CMasterDataPut(I2C6_BASE, 0x00);
I2CMasterControl(I2C6_BASE, I2C_MASTER_CMD_SINGLE_SEND);
while (1);
}
Thanks,
Zvika