Skip to content

Regarding the issue of probabilistic initialization failure of GT911 (BSP-677) #573

@illusionkiller

Description

@illusionkiller

Development environment: Windows+VSCode+IDF5.4
Component: espresso/esp-bsp_generic: ^ 3.0.0
Fault phenomenon: After stable power on, gt911 will fail to initialize, but after hard reset, it will work normally. After soft reset, initialization will continue to fail, and the system will cycle through restarts
Code snippet:

#elif CONFIG_BSP_TOUCH_DRIVER_GT911
    ESP_LOGI(TAG, "Initialize LCD Touch: GT911");
    esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
    tp_io_config.scl_speed_hz = CONFIG_BSP_I2C_CLK_SPEED_HZ; // This parameter was introduced together with I2C Driver-NG in IDF v5.2
    ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c(i2c_handle, &tp_io_config, &tp_io_handle), TAG, "");
    return esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, ret_touch);

Fault cause: No address was given during initialization, and gt911 will use the default address. This default address is not set, resulting in address uncertainty and causing initialization failure
Solution: Give an address during initialization

#elif CONFIG_BSP_TOUCH_DRIVER_GT911
    ESP_LOGI(TAG, "Initialize LCD Touch: GT911");
    esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG();
    tp_io_config.scl_speed_hz = CONFIG_BSP_I2C_CLK_SPEED_HZ; // This parameter was introduced together with I2C Driver-NG in IDF v5.2
    esp_lcd_touch_io_gt911_config_t gt911_config = {0};
    gt911_config.dev_addr = tp_io_config.dev_addr;
    tp_cfg.driver_data = &gt911_config;
    ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c(i2c_handle, &tp_io_config, &tp_io_handle), TAG, "");
    return esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, ret_touch);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions