Page 1 of 1

What is the lowest supported I2C clock speed?

Posted: Tue Nov 05, 2019 10:36 pm
by papaluna
Hi,
For: ESP-IDF v3.3

I want to configure a low I2C clock speed of 1K because I want to use the ESP32 in combination with a few slave devices using a relatively long cable of 1 meter. I cannot use another data protocol in this project.

The ESP-IDF docs do not specify a lowest I2C clock speed so I assumed that a low speed of for example 1K would be possible.

I have implemented the usual things such as using a 0.34mm2 3x twisted pair SCL+VCC SDA+GND VCC+GND cable; and specific pullups for SCL and SDA on both ends of the cable. And it works fine for a cable of 0.75 meter and 1.25 meter. However I noticed that the lowest possible clock speed using EDP-IDF seems to be 5K; even when specifying lower vales such as 1K.

So I ran a few tests using a logic analyzer. The lowest possible speed seems to be 5K. And the actual clock speed is inconsistent when specifying values lower than 5K:

Code: Select all

Test using separate short 10 centimer wires for VCC GND SCL SDA.
	STATUS	CLK_SPEED	SCLMeasuredSpeed
	=======================================
	Error	    50		  2924 !
	Error	   100		  5800 !
	Error	  1000		  5511 !
	Error	  2000		 10000 !
	Ok	  4000		  3989
	Ok	  5000		  4983
	Ok	 20000		 19750
	Ok	100000		 94120
	Ok	400000		320000
Can someone confirm that 5K is indeed the lowest possible speed? Or am I doing something wrong?

Thanks,
Paul.

Re: What is the lowest supported I2C clock speed?

Posted: Wed Nov 06, 2019 2:38 am
by WiFive
Theoretically ~2.5k but the driver may not be able to calculate the values correctly

Re: What is the lowest supported I2C clock speed?

Posted: Wed Nov 06, 2019 4:18 pm
by papaluna
Thanks.

Should I create a github issue for the driver and how it calculates the clk_speed?

Re: What is the lowest supported I2C clock speed?

Posted: Thu Nov 07, 2019 1:49 am
by WiFive
Sure

Re: What is the lowest supported I2C clock speed?

Posted: Thu Nov 07, 2019 10:46 pm
by papaluna