Hello!
From the datasheet:
I2C is a two-wire addressable serial interface. The G400 can act as an I2C bus master only with 7-bit slave
addresses. It can connect to one or more slave devices over the same connection with a maximum clock of 400
kHz. The I2C bus interface requires pull up resistors to be added on both the SCL and SDA pins, usually 2.2 kΩ.
It is possible to simulate an independent I2C bus on any two GPIO pins with the appropriate resistors though the
software I2C class, but performance will be lower.
It indicates you can have another independent I2C bus on any two GPIO pins through the I2C class, however, I
don’t see how to designate using the SCL & SDA pins via software.
For example, I have this code:
I2CDevice.Configuration i2cCfg = new I2CDevice.Configuration(0x6B, 100);
I2CDevice i2cConnection = new I2CDevice(i2cCfg);
I2CDevice.I2CTransaction[] xActions = new I2CDevice.I2CTransaction[2];
byte[] regNum = new byte[1] { 2 }; //write
byte[] regVal = new byte[1];
xActions[0] = I2CDevice.CreateWriteTransaction(regNum);
xActions[1] = I2CDevice.CreateReadTransaction(regVal);
int i = i2cConnection.Execute(xActions, 1000);
when I read it is always 0, but then again, how would the library know to use PA7 & PA8 instead of PA30, PA31?
I want to create an I2C bus using PA7 as I2C SDA & PA8 as I2C SCL.
I see no way set these gpio as the ones to use for this I2C bus.
The default is PA30 & PA31 which are being used by the touch screen.
I’m sure it is something easy but I don’t seem to be able to figure it out…
thanks for your help.