-
Notifications
You must be signed in to change notification settings - Fork 207
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
Constantly getting i2c errors when using touch (nothing else connected to i2c bus) #168
Comments
I'v seen this as well have a look at lvgl i2c_manager |
I dont understand why there are scheduling problems if nothing else is connected via i2c? Also I dont want to be forced to do RTOS or concurrency programming with all its pitfalls. Edit: |
how exactly can you run touch on core 0 and loop on core 1 if you are saying this is single-threaded? why not post a repo for inspection that said: FreeRTOS-based Arduino usually has some background tasks like for Wifi event handling |
With : TaskHandle_t Task1;
xTaskCreatePinnedToCore(
Task1code, /* Function to implement the task */
"Task1", /* Name of the task */
10000, /* Stack size in words */
NULL, /* Task input parameter */
0, /* Priority of the task */
&Task1, /* Task handle. */
0); /* Core where the task should run */
Void Task1code( void * parameter) {
while(true) {
if (touch.read()) {...
(...)
} |
Are you sure you are using the CST820 touch? |
Yes the touch_test example only works if I use The Version No. on the pcb says: T_Display_S3 22-8-2 V1.2 |
Oh! If using CST820, if the touch chip does not detect being pressed for a certain period of time, and ESP32 accesses the touch device, then CST820 will not return any data. This is mainly due to the access mechanism of CST820 touch, which is not a fault |
By the way, the CST820 is not a standard I2C device This is very annoying to me |
This is the complete code btw: https://github.com/shyney7/TDisplay-S3_PMX_Ground |
You can add fully closed internal debugging printing in platformio.ini
|
Disabling debug messages doesn't fix the problem it just hides it. Output with print of y coordinate registering withouth any physical touch operation: [205323][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[209654][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[211877][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[216427][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
4095
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
[218368][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
4095
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
3331
[219933][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[225431][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1
[227401][E][Wire.cpp:513] requestFrom(): i2cRead returned Error -1 |
Whats also weird is that if I keep touching the display the touch functionality works completely fine. |
I think I have already explained. |
well touch changes relative timing either use a mutex around I2C transactions, or try lvgl i2c_manager |
If nothing else except the touch IC is using the i2c bus why should there be a race condition? //core 0 task for touch. Default loop is on core 1
void touchTask(void *pvParameters) {
while (true) {
if (pthread_mutex_trylock(&uiMutex) == 0) {
switchTouch();
delay(1);
pthread_mutex_unlock(&uiMutex);
}
}
} |
This problem was fixed in the espressif esp-bsp touch driver repo 3 weeks ago with this pull request: espressif/esp-bsp#181 This is the issue that was created: espressif/esp-bsp#178 Is it possible for lilygo to update the touchlib with this information? I also managed to get rid of the i2c errors by only calling the touch functions when the touch interrupt pin is low (check is done in a if statement). I don't know if this is the best way of doing it. Tried doing it with an interrupt semaphore but was getting core dump issues. |
Try the CST816S library. It works. In case you don't need all the functionality of that library you can modify it and remove the gestures. |
This issue is stale because it has been open for 30 days with no activity. |
Do you mean this one? https://github.com/fbiego/CST816S |
This issue is stale because it has been open for 30 days with no activity. |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
Im using the Lilygo T-Display-S3 CAP. Touch version and if I implement the touch functionality to my code I'm constantly getting the following i2c errors:
The problem is also that as soon as the errors occur the whole process loop is slowed down. This is unacceptable.
Nothing else is connected to the i2c bus and this seems to be a problem with every unit since all 4 units that I bought have this problem.
I'm not doing anything special I'm just changing a variable with the touch function. Another problem is that sometimes even if I don't touch the display the variable is incremented...
The text was updated successfully, but these errors were encountered: