-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp32: Fix stuck TouchPad readings on ESP32-S3, use version specifiers in code. #16169
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
esp32: Fix stuck TouchPad readings on ESP32-S3, use version specifiers in code. #16169
Conversation
@wangshujun-tj Thanks for submitting the bug report and the description of a fix, and for being patient while we followed up. @wangshujun-tj @brainstorm @SkaveRat do any of you have hardware that you can use to confirm this fix before we merge it? |
…, mapped both touch buttons... LED and MIC still need to be fixed/mapped correctly to their pins
Tested on an aditional (different design/prototype) board with an esp32s3-mini-1u module: the difference between having this PR applied or not means reliable touch support or not. |
ESP32 has hardware V1 and S2/S3 has V2, and future chips may have different versions. This should still compile to the same binary before and after. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Closes micropython#13178. TouchPad confirmed working on both chips, and fixes the the ESP32-S3 reading constant max value. Was unable to reproduce the bug on ESP32-S2 but this may be due to my test setup, and it still works with the fix. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
fb6c8da
to
63e184e
Compare
Updated according to review, re-tested with dodgy dupont wire method on ESP32-S2 and original ESP32, rebased. |
Summary
machine.TouchPad
driver to use hardware version specifiers instead of chip names. This should make adding future SoCs easier.The new order of initialisation matches more closely the order in Espressif's example code, i.e.
https://github.com/espressif/esp-idf/blob/v5.2.2/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read/main/tp_read_main.c#L86
This work was funded through GitHub Sponsors.
Testing
The only buggy case of stuck max readings that I was able to reproduce was on ESP32-S3, and never reproduced once the fix was applied.
The hardware FSM did seem to get stuck once on ESP32-S3 in a different way (was reading correctly and then stopped updating and didn't start again). However I think this was due to my poor quality touch pad inputs (had moved the wires a lot and it would have changed capacitance by a huge factor).
Trade-offs and Alternatives