Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[i2c,sival] Reduce I2C bitbanging flakiness by separating SDA and SCL…
… write This commit reduces the flakiness seen in tests that use I2C over GPIO bitbanging - namely `i2c_target_test` where this was being used. Currently, writes to SCL and SDA can be performed within a single GPIO bitbanging sample. This relied on the SDA value being set before the the SCL value, but in reality these changes were happening microseconds apart. Physical characteristics of the FPGA such as e.g. the capacitance on different pins could add delays of a couple of microseconds, causing the SDA variation to appear after the SCL variation. This could cause a valid write (setting SDA high before SCL's rising edge) to transmit as a 'None' signal, which was causing a lot of flakiness in tests. This commit fixes the I2C bitbanging logic to run at half the sampling rate, extending each sample into two samples - one that sets the new SDA value whilst the clock is maintained, and one that sets the SCL value while the SDA is maintained. This ensures "atomic" sequential I2C GPIO pin writes which will be interpreted correctly, improving reliability. Signed-off-by: Alex Jones <[email protected]>
- Loading branch information