I2C slave implementation

Has anybody got the TX2 operating as a slave on I2C bus?
I see in the documentation that it is possible.

I’ve got it working ok as master:

int i2cwrite(int writeValue) 
{
  int toReturn = i2c_smbus_write_byte(kI2CFileDescriptor, writeValue);
  if (toReturn < 0) 
  {
    printf(" ************ Write error ************* \n") ;
    toReturn = -1 ;
  }
  return toReturn ;
}

… and can send bounding box coordinates etc to an MCU, but what if the MCU, such as the Infineon TC275, will only work as master?

Thanks!

Try below, the slave addr is 0x64

  1. Add below to tegra18_defconfig.
    CONFIG_I2C_TEGRA_SLAVE=y
    CONFIG_I2C_SLAVE_EEPROM=y
  2. Modify the DT to “tegra210-i2c-slave” like below.

cam_i2c: i2c@3180000 {
#address-cells = <1>;
#size-cells = <0>;
iommus = <&smmu TEGRA_SID_GPCDMA_0>;
compatible = “nvidia,tegra210-i2c-slave”

Thanks Shane - that’s very useful.

Any idea what the i2c_smbus (or such like) code would look like?

I thought of a poss workaround, but it’s pretty nasty …. use an Arduino Due as an intermediator and receive from Jetson on I2C0 as slave and then transmit on I2C1 to TC275, also as slave. There’s got to be a better solution than this?

… I tried the Due and it worked for about 5 seconds before crashing the camera on the Jetson. Changing to SDA1, SCL1 and fresh 4.7k pullups made no difference. Probably some kind of timing issue?

Had a look at using SPI instead and looks like a massive wall of pain, particularly as my L4T version is 28,2,1 which is not compatible with JetsonHacks tutorial. I’m fairly sure that going down this road will end in the demise of my TX2.

I’ve talked to Infineon about getting the TC275 updated with I2C slave support and they’re ‘working on it’ … Which is good! There’s also a possible workaround [url]https://www.hackster.io/chipmc/arduino-i2c-multi-master-approach-why-and-how-93f638[/url] using an external RTC to provide a clock signal for enabling multi-master. I guess this is currently my best bet?

Eventually ended up using a 5V nano as intermediatory with logic level shifter which works well. It would be nice to get a serial port working on the Jetson, but I don’t know how without using the usb port - I’d really need to use a GPIO pin.