Error: Example projects using old I2C driver - ESP-IDF v5.4

When compiling the ebike_demo example project, compilation is aborted: :rage:

E (1414) i2c: CONFLICT! driver_ng is not allowed to be used with this old driver

This message is generated from the i2c.c file located here:
\ESPIDF\v5.4\esp-idf\components\driver\i2c\i2c.c (Code below)

It appears that the squareline generated code is using an old i2c driver. Have yet to trace it down, but it seems this driver is not compatible with ESP-IDF v5.4


/**

  • @brief This function will be called during start up, to check that this legacy i2c driver is not running along with the new I2C driver
    */
    attribute((constructor))
    static void check_i2c_driver_conflict(void)
    {
    // This function was declared as weak here. The new I2C driver has the implementation.
    // So if the new I2C driver is not linked in, then i2c_acquire_bus_handle() should be NULL at runtime.
    extern attribute((weak)) esp_err_t i2c_acquire_bus_handle(int port_num, void *i2c_new_bus, int mode);
    if ((void *)i2c_acquire_bus_handle != NULL) {
    ESP_EARLY_LOGE(I2C_TAG, “CONFLICT! driver_ng is not allowed to be used with this old driver”);
    abort();
    }
    ESP_EARLY_LOGW(I2C_TAG, “This driver is an old driver, please migrate your application code to adapt driver/i2c_master.h”);
    }

  • **SquareLine Studio version:v1.5
  • **Operating system: win 10
  • **Target hardware: ESP32-S3-LCD_EV_BOARD v1.1

The issue is apparently a known one to Espressif:

We realized that our first version of the I2C slave driver had some problems and was not easy to use, so we have prepared a second version of the I2C slave driver, which solves many of the problems with our current I2C slave and which will be the focus of our maintenance. We encourage and recommend that you use the second version of the I2C slave driver, which you can do by enabling CONFIG_I2C_ENABLE_SLAVE_DRIVER_VERSION_2. This document focuses on the content of I2C slave v2.0. If you still want to read programming guide of I2C slave v1.0, please refer to I2C Slave v1.0. The I2C slave v1.0 driver will be removed with the IDF v6.0 update.


The fix was to open menuconfig in ESP-IDF , search on i2c, and:

  • check the box for “Enable I2C Slave driver version 2”.
  • uncheck “Enable I2C fast mode” (Runs at 100K rather than 400KHZ)
  • uncheck "Enable backward compatibility for the I2C driver…
    As shown below.

While this resolves the old driver issue, there is still issues with i2C.
The code randomly puts the screen on the display and when it does it is just static, nothing works.
Sometimes I see this error: E (2159) gt1151: read_data(136): Checksum error
The gt1151 is the touch controller on I2C.
Sometimes, there are many I2c related errors.
The esp32-s3_LCD_EV board is fine, as espressif examples, work without issue

Finally its working.
If I export from Squareline: Export → Create Template project
Then open and setup ESP-IDF, make the config changes described above, it works.
.
What’s different? Previously I created the Template, then exported the UI files.
Apparently Create Template project also exports the UI files.
So why did an extra “export UI” files kill it?
Because the export directory was not specified, and the extra export put the new files in an upper directory, This killed it
Lesson learned, explicitly enter the UI files path in Squarline.project settings
Project Export Root: c:\path\ProjectFolder
UI Files Export Path: c:\path\ProjectFolder\ebike_demo\main\ui

Also be sure to force ESP-IDF to use the matching LVGL libraries:
idf.py add-dependency “lvgl/lvgl^8.3.11”

1 Like