Open saillingaway opened 1 year ago
@saillingaway Hi, please refer #12198
@leeebo Thanks for the reply. I saw this issue already while I was searching for a solution and I don't think this is the same issue I'm having now. The way I understand it, if one touch sensor gets too high, all of the other touch sensors will hang as well. Is this right? I do think that was happening at first--one of the first high readings from touch_pad_read_raw_data()
would hang the rest of the sensors and so none of the values would ever change. It makes sense that calling touch_pad_fsm_start()
right before touch_pad_read_raw_data()
would 'fix' things so most of the values update each time. However, I don't understand why T3
, T4
and T5
would still be stuck. After the weird fix of getting rid of the for loops, TOUCH_PAD_NUM3/T3
would still show a high unchanging value, even though it's only configured as a touch sensor. I basically can't use T3 as a touch sensor as things are now. From that other thread, are you saying T3
is hanging every time values are read, and it reads the exact same raw value every iteration despite resetting the fsm before each read?
In #12198 you said if one of the pins was accidentally connected to another device the touch sensor would be trapped in that pin, causing abnormal readings in that channel and maybe in other channels too, but I've only plugged the chip into my machine, in order to flash and monitor. Still, if that is what's happening here, is there more configuration for T3
that's necessary to use it as a touch sensor again? I already have a smaller sample size (100) like you mentioned in the other thread and what I had above was the result of that. I've also tried resetting all the pins with gpio_reset_pin(GPIO_NUM_X) and then configuring them as a touch_sensors.
I understand any GPIO pins enabled and configured as touch sensors can't be connected to any other function or hardware, which I don't believe I'm doing. Also, the other functionality T1 will be used for that I mentioned before isn't configured, I only removed TOUCH_PAD_NUM1
from button[]
preemptively as a reminder to myself. I also experimented with touch_pad_set_voltage()
to try to see if I could get the value of T3
to come down but didn't have any luck.
I was reading through the esp32-s3 data sheet again and saw on page 16 that GPIO3
is a strapping pin. It says after start up the strapping pins are freed up to be used as I/O pins after reset, but I'm curious if there's some artifact that's interfering with the reading?
Hi @saillingaway , after checking the StampS3 schematic, I found the root cause: the GPIO3 (T3) of StampS3 is pulled up outside, this is forbidden for the touch sensor because the pulled-up pin is not able to charge and discharge as normal.
touch_pad_fsm_start();
before each read makes some difference, is because the FSM will restart. In normal case please only call it onceThe StampS3 pullup GPIO3 by default, could be an attempt to switch USB-JTAG
and Standard JTAG
interface through the strapping pin. which causes touch sensor T3 to become unusable.
Thank you! I looked at the schematic and I see that now. Thankfully my work around will be okay since I don't need all the sensors. Unfortunately like I said, if I don't call touch_pad_fsm_start();
every single time, no values will update. If I only call it once, the output of raw data will look like this:
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
T1: [14721] T2: [14516] T3: [2438734] T4: [4116735] T5: [4158749] T6: [1539359] T7: [1538649] T8: [1585147] T9: [4035765] T10: [244164] T11: [948200] T12: [1998005] T13: [3530295] T14: [4177858]
So the only way I can get any new readings is to call it at the beginning of the while loop before all the touch_pad_read_raw_data();
calls. Is this maybe because T3
was causing the sensors to hang? Also, is there any reason you can think why moving the config and init outside of for loops would fix T4
and T5
?
Yes, If you enable and try to read from T3, the sensor will hang, causing other channels not work also.
After remove GPIO3/T3, the example touch_sensor_v2/touch_pad_read should work as normal
- The reason call
touch_pad_fsm_start();
before each read makes some difference, is because the FSM will restart. In normal case please only call it once
@leeebo yeah I understand that the values are different because the FSM restarts, normally I would follow the example and only call it once but I need to use it every loop to get different readings because of the issue with T3
I think. (Even if T3
is removed, calling touch_pad_fsm_start();
only once at the beginning outputs data that never changes)
@saillingaway After removing T3 (not config and not read), the touch should work as normal, touch_pad_fsm_start();
only needs to be called once after touch init. Does the examples work for you then?
@leeebo I tested it again and it works 🎉 Never took out the config but I think before I must not have actually removed TOUCH_PAD_NUM3
from button[]
, I may have only removed the touch_pad_read_raw_data()
for button[2]/GPIO3/T3
which wouldn't fix anything lol. Thanks for your help on this!
Answers checklist.
IDF version.
v5.2-dev-2756-g2bc1f2f574
Operating System used.
macOS
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32-S3 M5Stack M5Stamp
Power Supply used.
USB
What is the expected behavior?
The touch_sensor_v2 touch_pad_read example should output values that fluctuate similarly to the example output, and values should go up when respective sensors are touched.
What is the actual behavior?
Running the example exactly as it is results in the following output:
The values are all exceptionally higher than the ones from the example output, and none of the values ever change no matter which sensors are touched.
Steps to reproduce.
esp-idf/examples/peripherals/touch_sensor/touch_sensor_v2/touch_pad_read
idf.py build
idf.py flash -p PORT
idf.py monitor
to see the outputDebug Logs.
No response
More Information.
During my troubleshooting I found that:
touch_pad_fsm_start();
right beforetouch_pad_read_raw_data();
makes it so some of the raw values will fluctuate a little and respond to touch, but some remain unchanging.resulting output shows T2, T3 and T4 still don't show any change, and they don't respond to touch unlike the others.
The output from this change have T3 and T4 still showing some unexpected behavior-- both are much higher relative to the example output and other raw values, and T3 is still unresponsive and unchanging.
for my project touch sensor 1 is being used for something seperate, and I want 12 touch sensors, so my workaround right now is to use T2, and T4-T14:
Which gives me the below output most similar to the example output, all the sensors fluctuate, react to touch and the value for T4 is also lower when I don't include
TOUCH_PAD_NUM3
intouch_pad_t button
).I'm new to embedded development so I may have missed some additional necessary configuration, but I've looked at the docs and application note and didn't see anything so posting an issue here in hopes to get some insight onto what's going on. A little confused as to why I had to make these adjustments to get raw data like in the example--especially since the way I'm using
touch_pad_fsm_start()
now to get those values seems wrong/different from its intended use. Is there possibly a bug here? Either with the higher values or why the raw values don't update unless I restart the finite state machine each time I want to read values. Thanks in advance.