How to reconfigure I2C speed on-the-fly?

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

How to reconfigure I2C speed on-the-fly?

Postby meowsqueak » Thu Oct 28, 2021 10:09 pm

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.

boarchuz
Posts: 606
Joined: Tue Aug 21, 2018 5:28 am

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

Postby boarchuz » Fri Oct 29, 2021 5:09 am

You can use i2c_param_config again with the updated config

Who is online

Users browsing this forum: Baidu [Spider], markkuk and 309 guests