Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GT911 show error the first time #237

Closed
herexiong opened this issue Jun 26, 2024 · 1 comment
Closed

GT911 show error the first time #237

herexiong opened this issue Jun 26, 2024 · 1 comment

Comments

@herexiong
Copy link

When I use GT911, I have to reboot it manually after burning, otherwise it won’t work properly. The i2c_master_cmd_begin function reports an error ESP_FAIL Sending command error, slave hasn’t ACK the transfer. I found a comment in the code (// Only show error the first time) and I want to know why. Can this be fixed?
image

I tried to use the GT911_RST() function to fix it, but it didn't work.

void GT911_RST()
{
    //init I2C before GT911 reset
    lvgl_i2c_init(I2C_NUM_0);

    // 设置4号RTS和17号INT引脚为输出模式
    gpio_set_direction(GT911_PIN_RST, GPIO_MODE_OUTPUT);
    gpio_set_direction(GT911_PIN_INT, GPIO_MODE_OUTPUT);

    // 低电平复位
    gpio_set_level(GT911_PIN_RST, 0);
    gpio_set_level(GT911_PIN_INT, 0);

    vTaskDelay(pdMS_TO_TICKS(10));

    if (GT911_I2C_SLAVE_ADDR == 0x5D)
    {
        vTaskDelay(pdMS_TO_TICKS(15));
        gpio_set_level(GT911_PIN_RST, 1); // RTS拉高
        vTaskDelay(pdMS_TO_TICKS(50));
        gpio_set_direction(GT911_PIN_INT, (GPIO_MODE_INPUT) | (GPIO_MODE_DEF_OD)); // 将INT转为悬浮输入态
    }
    else if (GT911_I2C_SLAVE_ADDR == 0x14)
    {
        vTaskDelay(pdMS_TO_TICKS(5));
        gpio_set_level(GT911_PIN_INT, 1);
        vTaskDelay(pdMS_TO_TICKS(10));
        gpio_set_level(GT911_PIN_RST, 1);// RTS拉高
        vTaskDelay(pdMS_TO_TICKS(50));
        gpio_set_direction(GT911_PIN_INT, (GPIO_MODE_INPUT) | (GPIO_MODE_DEF_OD)); // 将INT转为悬浮输入态
    }
}

Thank you for reading.

@herexiong
Copy link
Author

#238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant