These are the I2C Bus Hardware and Software settings I am using with the on OpenWrt Midge router to talk to a PIC 16F876 I2C Slave.
I2C Hardware
Here is the level shifter I’m using for the Router (3v) I2C interface (5v on Pic and other chips I have)
5v
|
|
R
4k7
R
|
SCL ---+--R220--+-----> 5v SCL
|
===== Use the Same
ZD\ For the Data
/3.3\ Line
|
|
0v-----+---------------
The above has so far worked happily with an old philips 2048bit (256 bytes!) eeprom.
Pin Header (for breadboard)
1: 0v
2: 3v
3: 5v
4: KEY NC
5: TX (I/O Bus -> project)
6: RX (project <- I/O Bus)
7: LED3 GPIO8 I2C SDA
8: LED5 GPIO11 I2C SCL
I2C Software Settings
In the sunspot.co.uk Midge rom, the default I2C port uses different gpio lines. To use gpio 8 and 11, the file “/etc/init.d/S99start_i2c” file needs changing:-
The line containing “insmod i2c-adm5128″ needs to read “insmod i2c-adm5120 scl=11 sda=8″