Page 1 of 1

i2c pulse stretch

Posted: Sat Jun 01, 2013 7:24 pm
by cossack2013
Sorry originally posted this in wrong forum.

Does anyone know if they are working on the I2C drivers to enable support for pulse stretching in order to support slower devices ?

I have a number of these device which currently operate from an arduino but not the raspberry pi, and having done some investigation it appears it is due to the Raspberry pi drivers not supporting the pulse stretch functionality.


Re: i2c pulse stretch

Posted: Mon Jun 03, 2013 8:01 pm
by techpaul
The term you are looking for in I2C terms is clock stretching.

Unfortunately from memory the Pi only supports clock stretching in ACK phase, which is true for High speed (much greater than 400kHz) modes and Pi only supports upto 400kHz.

From what I understand this is a HARDWARE issue within the I2C controller, so no software can do anything about it.

The alternative is to run I2C at lower clock rate. You do realise the clock rate for I2C is specced as
  • Low Speed = 0 tp 100kHz
  • Fast Speed = 0 tp 400kHz
  • High Speed = 0 tp 3400kHz (yes 3.4MHz)
High speed requires a few things not in Low and fast speed.

So you could run the I2C slower to see if things work

Re: i2c pulse stretch

Posted: Tue Jun 04, 2013 8:49 am
by kadamski
You can also use software bitbanged GPIO driver. You need kernel recompilation for that currently, though. You can take a look at this thread for some more information.

Re: i2c pulse stretch

Posted: Sat Jun 08, 2013 12:01 pm
by cossack2013
Thank you both for your responses, I will give your ideas a go.