Page 1 of 1

How to reconfigure I2C speed on-the-fly?

Posted: Thu Oct 28, 2021 10:09 pm
by meowsqueak
I have a device that needs to be configured using a low-speed I2C rate (100 kHz) before it can be used at a faster rate (e.g. 400 - 1000 kHz). I am setting the I2C speed with the i2c_config.t clk_speed field set to the low rate, with the entire struct passed to i2c_param_config() just prior to installing the driver with i2c_driver_install().

Apart from shutting down the I2C driver and reinitialising it with the new, faster speed in clk_speed, is there any other safe way to reconfigure the I2C clock speed on-the-fly?

I am using ESP-IDF v4.3.

Re: How to reconfigure I2C speed on-the-fly?

Posted: Fri Oct 29, 2021 5:09 am
by boarchuz
You can use i2c_param_config again with the updated config