2015-06-29 13:28 UTC
I²C is a fun protocol. It's great for interfacing to real time clocks, sensors, displays etc. My personal favorite right now is the Si5351 frequency generator chip. In a world of ever increasing number of I²C compatible micro-controllers, I though that my MC3 should learn to speak I²C as well. I have chosen a chip from Philips that is a self-contained I²C interface. It's much faster than bit-banging an I/O port. The chip, PCF8584, can still be obtained from various suppliers but I don't think it's being manufactured anymore. Therefore I have taken extra care to protect it. The interface schematic can be seen below. The tricky part about buffering I²C signals is that they are bi-directional (the PCF8584 can work as both master and slave). A buffer that is both bi-directional and has open collector input/outputs needs some extra thinking. It is not possible to just put to buffers back to back and expect it to work. As soon as one of the buffers trigger the opposite buffer will also trigger and the circuit will enter a locked state. To solve this I have designed the buffer stages using two comparators (LM339) with open collector outputs. By using comparators it is possible to carefully adjust the trigger levels so that one buffer does not affect the buffer in opposite direction. A reference voltage of 0.65V is used for the comparators, but the output from the comparators facing the PCF8584 has a series resistor that together with the pull-up resistor creates a voltage divider. When the comparator tries to pull the line low the divider will limit the voltage to around 1.2V, enough for the PCF8584 to register a 'low' level but not enough to trigger the opposite comparator. This is the finished MC3 I/O board. I added an 8-pin socket (not in the schematic) for connecting EEPROMs directly on the board. As always, don't forget to add 100nF decoupling capacitors across the supply on all chips. Sample program for testing the interface This program interfaces to a DS1307 RTC chip but I have made the I²C driver routines generic so they can be used for accessing any other I²C device as well. - source - listing - s19
by Francois Laagel 2019-05-10 16:28 UTC
Hi Daniel, This is very nice indeed. However, is this buffering scheme really necessary if you intend to have only a few devices on the I2C bus (say 3)? Regards. Francois
by Daniel 2019-05-17 20:47 UTC
Hi Francois! You are right. Technically it's not necessary. The main reason for me to buffer the signals is to protect the PCF8584. It's an old and obsolete part in limited supply and I use the I²C bus to experiment with various devices in my lab outside the MC3 computer. Long signal paths and multiple power supplies can cause unfortunate and unexpected things to happen. LM339 comparators are still in production, cheap and widely available. The PCF8584 is not. I also thought it was an interesting opportunity to experiment with a two-way buffering scheme :)
by Francois Laagel 2019-06-15 13:40 UTC
Hi Daniel, I was able to procure a bunch of PCF8584 from ebay for myself. A lot more than I expected actually. I meant to order 2 of them and ended up with 10. Just to say that those DIL I2C controllers are not that difficult to find.