Photon 2 I2C setSpeed()

when compiling code from photon to photon 2 the I2C gets broken: I always get 370kHz clock while i do a "Wire.setSpeed(20000)" and expecting a 20 kHz clock.
( does work on photon )

I'm using 5.5.0.

Can somebody explain me how to reduce the I2C speed on photon 2?
thanks
Erik

On the P2 and Photon 2 the only valid values are CLOCK_SPEED_100KHZ and CLOCK_SPEED_400KHZ. Other speeds are not supported and if you specify an unknown value it defaults to 400 kHz (approximately).

Hi Rick,
will that change in the near future or does that mean we cannot use photon2 ?
best regards,
Erik

It looks like the hardware supports it, so I created an engineering ticket to examine whether its possible to support custom I2C speeds on the RTL872x in the future.

Hi Rick,
awesome

thanks very much for the swift answers,
best regards,
Erik

Hi Erik,

I have feedback from engineering. This feature was last supported on Gen2 devices, and will not be ported to Gen3 or the Photon2/P2.

Hi Chris,

regrettably, our board are using slow I2C speeds. I'll keep it in mind when designing new applications.

best regards,
Erik

1 Like