Manipulating I2C Transfers Using I2C Slave

telos I2C Negative Tester Application Notes

The described procedure can e.g. be used in the following situations:

  • Change data values e.g. from a temperature sensor to simulate an over or under temperature scenario
  • Modify a checksum (e.g. a CRC) that is transmitted from the slave to the master. This can be helpful to verify if the system recognizes the error.
  • Change the clock time of an I2C RTC
  • Modify the memory contents of an I2C EEPROM

Assuming you have an I2C transfer between a master and a slave. From the functional view the slave behaves like a memory (e.g. an EEPROM) and has the address 0x50.

The following steps describe an example for a regular transfer and how it can be manipulated:

  • The master transmits an address pointer (0x00) and three bytes to the slave (0x11, 0x22, 0x33)
  • In the 2nd message the master sets the address pointer and then requests 3 bytes from the slave with a combined message.
  • In this scenario the slave should respond with the 3 data bytes as described above (0x11, 0x22, 0x33)
  • Now open a telos I2C Negative Tester window in I2C Studio and change to the “Slave” tab.

  • From the main menu choose “Negative Tester” and “Negative Tester Options”:
  • In the section “Slave Transmitter” 3 data bytes should be inserted: “FF FF FE” (see screenshot “Negative Tester Options”)
  • Now the Negative-Tester slave is configured to set the LSB of byte to ‘0’ (FE) and leave the first two bytes untouched (FF).
  • Enable the slave by pressing the “Start” button (the address of the slave should be also 0x50).
  • At this moment there are two slaves with the same address active on the bus: The original memory slave and the slave of the Negative-Tester.
  • In the following transfer the bit manipulation is clearly visible: The slave of the Negative Tester has set the LSB of the 3rd byte to zero which results in data byte 0x32 instead of 0x33 that is sent by the original memory slave (see screenshot “Negative Tester Trace”).

Please note that the slave of the Negative Tester repeats its data array if more bytes are requested than defined. Hence you should fill up the data array with as much as 0xFF data bytes as requested by the master.