This is a follow-up question to a previous one:
To review: we are trying to use I2C3 off of connector X16 (pins 8 & 11) of an Iris carrier board fitted with an iMX6 Solo module. Thank you for your explanation of the I2C numbering in the previous response.
Your response also suggested the use of the Toradex libraries to configure I2C. So we’re trying that, but with little success so far.
What we’re seeing on the 'scope is exactly the same as when we configured things with the GPIO tool: When I do an I2C read, X16 pin 8 (SCL) and pin 11 (SDA) drop to ground for about 1/4 second, and there is no recognizable I2C signal apparent.
Here is our I2C init code. I have removed most error checking for brevity but each of the library functions succeeds when stepping through with the debugger:
private void InitI2C()
{
Boolean result;
String i2cName = "I2C3";
i2cHandle = i2c.I2c_Init(i2cName);
// Create uIo for SCL pin mapping to SODIMM 88
gpio.uIo i2cSclPin = new gpio.uIo();
i2cSclPin.ColibriPin.tp = (UInt16)gpio.tIoType.ioColibriPin;
i2cSclPin.ColibriPin.nr = 88;
// Create uIo for DSA pin mapping to SODIMM 92
gpio.uIo i2cSdaPin = new gpio.uIo();
i2cSdaPin.ColibriPin.tp = (UInt16)gpio.tIoType.ioColibriPin;
i2cSdaPin.ColibriPin.nr = 92;
// Configure the new I2C pins.
IntPtr gpioHandle = gpio.Gpio_Init("SOFTWARE\\Toradex\\gpio");
result = gpio.Gpio_SetConfigString(gpioHandle, i2cSclPin, null, "altfn=6", TdxCommon.ParamStorageType.StoreVolatile);
result = gpio.Gpio_SetConfigString(gpioHandle, i2cSdaPin, null, "altfn=1", TdxCommon.ParamStorageType.StoreVolatile);
result = i2c.I2c_SetConfigInt(i2cHandle, "ioScl", i2cSclPin.GenericDefinition, TdxCommon.ParamStorageType.StoreVolatile);
result = i2c.I2c_SetConfigInt(i2cHandle, "ioSda", i2cSdaPin.GenericDefinition, TdxCommon.ParamStorageType.StoreVolatile);
if (!i2c.I2c_Open(i2cHandle))
{
Debug.WriteLine("Error: I2C Open");
}
i2c.I2c_SetConfigInt(i2cHandle, "BitRateHz", 100000, TdxCommon.ParamStorageType.StoreVolatile);
i2c.I2c_SetConfigInt(i2cHandle, "SlaveAddrSize", 7, TdxCommon.ParamStorageType.StoreVolatile);
i2c.I2c_SetConfigInt(i2cHandle, "RegisterAddrSize", 8, TdxCommon.ParamStorageType.StoreVolatile);
Debug.WriteLine(i2cName + " opened successfully.");
}
I suspect I’m missing something basic but I’m unable to figure it out.
Any help would be appreciated.