-->
Page 2 of 2

Re: I2C clock speed

PostPosted: Sat Sep 10, 2016 4:29 pm
by Thomas S.
Hi Martin, sorry for not responding earlier.

If there is no other answer in sight, I believe, that this is to make sure that the optimizer in the compiler will not throw it all away. It will know that input pins are "volatile", so they must be read in again each time, and cannot be "cached" in a register.

But after all, I believe, that this is a kind of "bug" in wiring_shift. If there is no documentation about the shift speed, it is not really a bug, but as other libraries are using it to connect to existing HW, the shift speed should probably stay the same as in 16 MHz arduinos.

I will probably need it soon, and if my concerns get confirmed, I will give feedback again to the forum.

Re: I2C clock speed

PostPosted: Sun Mar 18, 2018 11:28 am
by aidanruff
I looked into core_esp8266_si2c.c as no matter what I did I couldn't change the i2c clock speed. Anyway, long story short, inside twi_init() there's an over-ride "twi_setClock(100000)" which forces the clock speed to the slowest settings.

Comenting that out meant that I could get the top speed available.

If you do go for the top speed though, make sure that your SCL and SDA pullup resistors are around 1K2 or you may get problems - it's in the i2c spec' - minimum 996 ohms, max 1k5 at clock of 1000000