9 years, 1 month ago.

Interface with Non-standard I2C protocol

Dear All,

/media/uploads/bc/i2c.jpg

I would like to share the I2C interface line with non-standard I2C device such as 74HC595 ic.

The problem is i can't control the SCL and SDA pin. May i know is it possible to control the I2C pin manually?

I have write a simple code to show where's the error /media/uploads/bc/i2c.zip

Please kindly advice.

THank you, Wq

2 Answers

9 years, 1 month ago.

It is possible, in theory, but you have to directly control the hardware, you need to switch the pins between I2C pins and GPIO pins. And the I2C device may not enjoy it. In general I would advice against it.

But why would you want to do that with for example a 74HC595? That is a shift register, if you want to drive them you can use either SPI or GPIO, no need to use I2C pins for that.

Dear Erik,

Thanks for your reply.

Can you show me how the code and how can i directly control the hardware?

Is it when every time i switch the communication i need to configure either I2C pins or GPIO pins? Will it slow down the processing?

74HC595 just a example. Because of mbed have limited number of GPIO then i have expand some I/O. Beside that i also plan to use SHT10 sensor. It is also not a standard I2C interface too...If i need more something like this kind of device then i will need some chip select to multiplex the device then it will look something similar to SPI interface.

Thanks...

posted by Wen qian 07 Feb 2014

The SHT10 is different from normal I2C, but looks to be compatible.

Directly controlling the hardware for such a task is one of those things where if you don't know where to start with it, it simply is not a good idea. If you need more pins you can also consider a port expander. But I wouldn't use non-I2C compatible traffic over an I2C bus.

posted by Erik - 07 Feb 2014

I think i might know how to do it but at this moment i'm facing hardware problem...I have to fix it first.

posted by Wen qian 10 Feb 2014
Wen qian
poster
9 years, 1 month ago.

.