I am developing code on the TM4C123 processor using the launchpad with resistors removed that would interfere with I2C operations.
Code Composer Studio Version: 5.5.0.00077, TivaWare_C_Series-2.0.1.11577.
My project uses both I2C0 and I2C1 and is working fine with external pull-up resistors. Here are my questions.
1. Using the sensor library (preferred as it is the basis of my working project), can I detect a NAK event from my external devices?
2. The library appears to preset the clock to 400Khz. Can I set that to 100Khz?
3. Can I set weak pull-ups on the I2C0 and I2C1 port pins (see setup code below)? I need to use these functions without external pull-ups if possible. Even if this can be achieved, the value may be insufficient to meet timing specs but it would help to know if I can enable weak pull-ups on the pins or not.
Here is the IO Init code for the I2C modules:
#ifdef USE_I2C0
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
//
// SCL0 - Enable pin PB2 for I2C0 I2C0SCL
//
GPIOPinConfigure(GPIO_PB2_I2C0SCL);
GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
//
// SDA0 - Enable pin PB3 for I2C0 I2C0SDA
//
GPIOPinConfigure(GPIO_PB3_I2C0SDA);
GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
#endif
#ifdef USE_I2C1
SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
//
// SCL1 - Enable pin PA6 for I2C1 I2C1SCL
//
GPIOPinConfigure(GPIO_PA6_I2C1SCL);
GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
//
// SDA1 - Enable pin PA7 for I2C1 I2C1SDA
//
GPIOPinConfigure(GPIO_PA7_I2C1SDA);
GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);
#endif