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

Unexpected bahaviour touch sensor on ESP32-S3 measurement time (IDFGH-7499) #9067

Closed
Phigu77 opened this issue May 31, 2022 · 5 comments
Closed
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@Phigu77
Copy link

Phigu77 commented May 31, 2022

Environment

  • Development Kit: ESP32-S3-DevKitC-1
  • IDF version v4.4.1
  • Build System: CMake
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it): 8.4.0
  • Operating System: Windows
  • Using an IDE: VSCode
  • Power Supply: USB

Problem Description

On the dev-board the example code touch_sensor_v2 produces unexpected behavior. I tried 2 different boards and different pins.

Expected Behavior

According to the documentation, the measurement time is set with touch_pad_set_meas_time(). The sensor value is supposed to be the count of charge and discharge cycles within the fixed measurement period. My ESP32-Module behaves exactly as described in the documentation.

Actual Behavior

The ESP32-S3 however extends the measurement time when a sensor is being touched. The raw value increases value returned by touch_pad_read_raw_data() while being touched rather than decreasing. The measurement time is being increased with an increase of the measured capacity.

Measurement without touch (raw value ~68.000)
image

Measurement with touch (raw value ~270.000)
image

Steps to reproduce

  1. Compile and flash example touch_sensor_v2
  2. Connect Oscilloscope and touch pad to any touch-pin.
@espressif-bot espressif-bot added the Status: Opened Issue is new label May 31, 2022
@github-actions github-actions bot changed the title Unexpected bahaviour touch sensor on ESP32-S3 measurement time Unexpected bahaviour touch sensor on ESP32-S3 measurement time (IDFGH-7499) May 31, 2022
@L-KAYA
Copy link
Collaborator

L-KAYA commented Jun 1, 2022

Yes, the touch sensor on ESP32 and ESP32-S3 are different. Actually, the touch sensor on ESP32-S2 and ESP32-S3 adopts an opposite way to measure the capacity, they will fixed the count of charge and discharge cycles and then record the count of the clock cycles during the sensing period.

That is to say, the result of these two version are also opposite, on ESP32, the capacity will get bigger with finger put on the touch pad, then the touch sensor will count less charge and discharge cycles in a fixed period, however, on ESP32-S2 and ESP32-S3, it will count more clock cycles with the fixed charge and discharge cycles.

The pity is that currently the TRM of S2/S3 doesn't have the section about the touch sensor. The second version of touch sensor has some improvements comparing to the first one. Maybe the touch_element driver for S2 is a better reference. Hope it can help~

@Phigu77
Copy link
Author

Phigu77 commented Jun 1, 2022

Thanks for the clarification regarding the measurement principle. I am referring to the programming guide for ESP32-S3. From what you describe, it needs to be updated.
What is also very misleading is the function touch_pad_set_meas_time() used to specify a fixed measurement time, which it is obviously not longer doing. What is it doing instead? With the procedure you describe, I would have expected an API that lets me specify the number of charge and discharge cycle within one measurement cycle. Is such a function implemented?
Can you anticipate, when the documentation will be updated?

@L-KAYA
Copy link
Collaborator

L-KAYA commented Jun 1, 2022

I agree, the API name touch_pad_set_meas_time are same on both two versions is quite misleading, but this API can still specify the number of charge and discharge cycle in one measurement cycle, the second parameter meas_times is exactly the charge and discharge times, and an appropriate value recommended to to keep the measurement time about 1 ms.

Since the API has public, its name can't be updated easily, but we'll add detailed description for this API as soon as possible

@Phigu77
Copy link
Author

Phigu77 commented Jun 1, 2022

OK, thank you!

@Phigu77 Phigu77 closed this as completed Jun 1, 2022
@krzychb
Copy link
Collaborator

krzychb commented Jun 5, 2022

We will keep this issue open and close it once documentation is updated.

@krzychb krzychb reopened this Jun 5, 2022
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Jun 13, 2022
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable labels Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants