Closed securelyfitz closed 4 years ago
Test: pulling off diodes and pullups, I2C still works fine both with bare devices and in-circuit. Likely works because 1) in-circuit has pullups on the target and 2) bare device, the level shifter is sensitive enough that the 100k pullups are sufficient.
So, confirmed todo:
breaking off switch options to separate issue #5
There are diodes between the SDA/SCL pins and the CK/DI/DO pins to protect JTAG and SPI from the I2C pullups.
Unfortunately these diodes prevent I2C device's response from getting back to the FT2232H - When trying to read an I2C eeprom, using the SPI header works, using the I2C header does not.
The FT2232H doesn't do real push-pull, it ties in and out wires to each pin to make it work.
Since we don't support clock stretching (at least, the hardware doesn't - if that should change, separate issue), then we can remove the diode and pullup on SCL.
Since we already have a dual pole switch to combine DI and DO for both I2C and SWD, we can use the second pole to switch in a pullup
The remaining difference between SPI and I2C headers are CS and MISO. Some 8 pin I2C chips use those pins for address bits. AFAIK those are only checked at poweron, but i haven't tested and wouldn't be surprised if they mess with other devices. CS is unused in I2C mode, but MISO could theoretically interfere. Perhaps the I2C/SWD switch could also disconnect the spi header MISO pin with no additional hardware?
I can bluewire whatever changes we decide on to make sure they work - and perhaps also experiment with removing the SDA pullup entirely?