Page 1 of 1

Change I2C clock speed without reinitializing

Posted: Sat Oct 28, 2023 12:09 pm
by cskilbeck
I have two I2C devices, one supports 1Mbit, the other supports 400Kbit. I would like to use the fast device at the fast speed but if I initialize the I2C device with `i2c_param_config` at 1Mbit then, when I want to communicate with the slow device I need to change the clock speed to 400Kbit.

At the moment I am tearing the I2C driver down and reinitializing it, but this isn't ideal.

Is it supported to call `i2c_param_config` after `i2c_driver_install` with a different clock speed?

If not, am I required to leave the clock speed at 1Mbit and change the timings with `i2c_set_period`, `i2c_set_start_timing` etc?

Re: Change I2C clock speed without reinitializing

Posted: Sat Oct 28, 2023 10:59 pm
by username
The way I got arround this same issue was to set up of them instead of just one. Set the parameters for the first one with the fast clk speed, then set the second with the slower one. The trick is to use the same pins for both.

Re: Change I2C clock speed without reinitializing

Posted: Tue Oct 31, 2023 11:53 am
by cskilbeck
Thanks for this - I'm not sure I understand what you mean when you say 'set up {two} of them instead of just one' - can you clarify what functions you're calling to do this?