Browse Source
Each SoC family has its own clocks and timings/timeouts. For I2C, the default source clock is either APB (ESP32, ESP32-S2) or XTAL (ESP32-S3, ESP32-C3) as shown in the datasheets. Since machine_i2c.c/machine_hw_i2c_init() uses the default clk_flags (0), the alternate low-power clock source is never selected in ESP-IDF i2c.c/i2c_param_config(). There is not an API in i2c.c to get the source clock frequency, so a compile-time value is used based on SoC family. Also, the maximum timeout is different across the SoC families, so use the I2C_LL_MAX_TIMEOUT constant to eliminate the warning from i2c_set_timeout(). With these changes, the following results were obtained. The I2C SCL frequencies were measured with a Saleae logic analyzer. ESP32 (TTGO T Dislay) I2C(0, scl=22, sda=21, freq=101781) Measured: 100KHz I2C(0, scl=22, sda=21, freq=430107) Measured: 400KHz I2C(0, scl=22, sda=21, freq=1212121) Measured: 941KHz ESP32-S3 (TTGO T-QT) I2C(0, scl=34, sda=33, freq=111111) Measured: 107KHz I2C(0, scl=34, sda=33, freq=444444) Measured: 400KHz I2C(0, scl=34, sda=33, freq=1111111) Measured: 842KHz ESP32-C3 (XIAO ESP32C3) I2C(0, scl=7, sda=6, freq=107816) Measured: 103KHz I2C(0, scl=7, sda=6, freq=444444) Measured: 380KHz I2C(0, scl=7, sda=6, freq=1176470) Measured: 800KHz (ESP32-S2 board was not available for testing.)pull/9799/head
Mark Grosen
2 years ago
committed by
Damien George
1 changed files with 18 additions and 2 deletions
Loading…
Reference in new issue