Closed tao-a-man closed 4 months ago
Hii @Lzw655 Plsss check it, plsss help me 😔 Update: I use T-Display-S3 for screen and Slint Library
Update: Log Error is printed from the line ESP_GOTO_ON_ERROR(i2c_master_cmd_begin(i2c_panel_io->i2c_bus_id, cmd_link, portMAX_DELAY), err, TAG, "i2c transaction failed");
in function panel_io_i2c_rx_buffer
Hi @tao-a-man, according to the logs, there may be some problems with I2C communication. Can you provide the log when running to the code ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_cst816s(io_handle, &tp_cfg, &tp));
? If so, this line should also print some error logs.
Thanks for reply @Lzw655, I fix it by remove code in root file of Espressif (C:\Espressif\frameworks\esp-idf-v5.1.2\components\esp_lcd\src\esp_lcd_panel_io_i2c) i change ESP_GOTO_ON_ERROR(i2c_master_cmd_begin(i2c_panel_io->i2c_bus_id, cmd_link, portMAX_DELAY), err, TAG, "i2c transaction failed")
to i2c_master_cmd_begin(i2c_panel_io->i2c_bus_id, cmd_link, portMAX_DELAY)
Do you think it oke?
Hi @tao-a-man, I just recalled the reason for this issue. The CST816S requires using the INT pin to trigger reading, and the specific reason is illustrated in the following diagram (link).
Hi @tao-a-man, I just recalled the reason for this issue. The CST816S requires using the INT pin to trigger reading, and the specific reason is illustrated in the following diagram (link).
That great @Lzw655, but Can u help me fix it 😔
@Lzw655 Do you think we treat this as bug or this can be closed?
Yes, can be closed.
Answers checklist.
IDF version.
v5.1.2
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
PowerShell
What is the expected behavior?
initTouch and initLCD success
What is the actual behavior?
lcd_panel.io.i2c: panel_io_i2c_rx_buffer(135): i2c transaction failed CST816S: read_data(109): I2C read failed
Steps to reproduce.
Build or installation Logs.
More Information.
include "hwInit.h"
include "esp_lcd_panel_vendor.h"
include "esp_lcd_panel_ops.h"
include "driver/gpio.h"
include "driver/i2c.h"
include "esp_err.h"
include "esp_log.h"
define LCD_BPP 2
define LCD_TARGET_REFRESH_RATE 60
define LCD_PIXEL_CLOCK_HZ (LCD_H_RES LCD_V_RES LCD_BPP * LCD_TARGET_REFRESH_RATE)
define LCD_PIN_DATA0 39
define LCD_PIN_DATA1 40
define LCD_PIN_DATA2 41
define LCD_PIN_DATA3 42
define LCD_PIN_DATA4 45
define LCD_PIN_DATA5 46
define LCD_PIN_DATA6 47
define LCD_PIN_DATA7 48
define LCD_PIN_PCLK 8
define LCD_PIN_CS 6
define LCD_PIN_RD 9
define LCD_PIN_DC 7
define LCD_PIN_RST 5
define LCD_PIN_POWER 15
// Bit number used to represent command and parameter
define LCD_CMD_BITS 8
define LCD_PARAM_BITS 8
// Supported alignment: 16, 32, 64. A higher alignment can enables higher burst transfer size, thus a higher i80 bus throughput.
define PSRAM_DATA_ALIGNMENT 64
define LCD_TOUCH_SDA 18
define LCD_TOUCH_SCL 17
define LCD_TOUCH_RST 21
define LCD_TOUCH_INT 16
define LCD_TOUCH_I2C_CLK_SPEED_HZ 100000
define LCD_TOUCH_I2C_NUM 0
static esp_lcd_panel_io_handle_t io_handle = NULL;
esp_lcd_panel_handle_t initLCD() { gpio_config_t pwr_gpio_config = { .mode = GPIO_MODE_OUTPUT, .pin_bit_mask = 1ULL << LCD_PIN_POWER}; ESP_ERROR_CHECK(gpio_config(&pwr_gpio_config)); gpio_set_level(LCD_PIN_POWER, LCD_BK_LIGHT_ON_LEVEL);
}
esp_lcd_touch_handle_t initTouch() { const i2c_config_t i2c_conf = { .mode = I2C_MODE_MASTER, .sda_io_num = LCD_TOUCH_SDA, .sda_pullup_en = GPIO_PULLUP_ENABLE, .scl_io_num = LCD_TOUCH_SCL, .scl_pullup_en = GPIO_PULLUP_ENABLE, .master.clk_speed = LCD_TOUCH_I2C_CLK_SPEED_HZ }; ESP_ERROR_CHECK(i2c_param_config(LCD_TOUCH_I2C_NUM, &i2c_conf)); ESP_ERROR_CHECK(i2c_driver_install(LCD_TOUCH_I2C_NUM, i2c_conf.mode, 0, 0, 0));
}