After some long debugging sessions I just found out that the Arduino function touchRead(pin) swaps pins 32 and 33. So touchRead(32) does in fact check pin 33 and vice versa.
Quite unexpected result
Will have to explore further when I'll have the time...
touchRead(32) and touchRead(33) pins are swapped
Re: touchRead(32) and touchRead(33) pins are swapped
Somehow my follow up has disappeared, so I summarize:
The issue is in the esp32-arduino software.
Please react in the thread in the Arduino subforum
"How to check Arduino version" https://www.esp32.com/viewtopic.php?f=19&t=17741
The issue is in the esp32-arduino software.
Please react in the thread in the Arduino subforum
"How to check Arduino version" https://www.esp32.com/viewtopic.php?f=19&t=17741
Re: touchRead(32) and touchRead(33) pins are swapped
Short summary of what i found out so far:
In esp32-arduino touchRead(32) and touchRead(33) do read the pins swapped, while analogRead() works as expected.
I see this on all the different boards I have tested.
try this:
If you touch pin 32 or pin 33 you will see what I mean.
Even better when you connect one of the pins to ground:
Workaround based on the following commit:
https://github.com/espressif/arduino-es ... 1a63579378
change file esp32-hal-gpio.c
This is a bad hack, as it bypasses git, but it works for me.
I had no success trying to find and checkout the right development branch yet.
I have started here https://github.com/espressif/arduino-es ... structions
Help would be much appreciated...
In esp32-arduino touchRead(32) and touchRead(33) do read the pins swapped, while analogRead() works as expected.
I see this on all the different boards I have tested.
try this:
Code: Select all
void setup() {
Serial.begin(500000);
Serial.println("TEST: touchRead(32) and touchRead(33) are swapped\n");
delay(3000);
}
void loop() {
Serial.print("touch(32) ");
Serial.print(touchRead(32));
Serial.print("\ttouch(33) ");
Serial.print(touchRead(33));
Serial.print("\tanalog(32) ");
Serial.print(analogRead(32));
Serial.print("\ta(33) ");
Serial.println(analogRead(33));
delay(500);
}
Even better when you connect one of the pins to ground:
Code: Select all
// pin 32 connected to GND
touch(32) 136 touch(33) 0 analog(32) 0 a(33) 732
// pin 33 connected to GND
touch(32) 0 touch(33) 131 analog(32) 1001 a(33) 0
https://github.com/espressif/arduino-es ... 1a63579378
change file esp32-hal-gpio.c
Code: Select all
// ~/.arduino15/packages/esp32/hardware/esp32/1.0.4/cores/esp32/esp32-hal-gpio.c
// lines 62, 63
{0x1c, 9, 4, 9},
{0x20, 8, 5, 8},
// change to
{0x1c, 9, 4, 8},
{0x20, 8, 5, 9},
I had no success trying to find and checkout the right development branch yet.
I have started here https://github.com/espressif/arduino-es ... structions
Help would be much appreciated...
SOLVED: touchRead(32) and touchRead(33) pins are swapped
Installing new esp32-arduino version 1.0.5-rc1 fixes the issue
Who is online
Users browsing this forum: jhlee1 and 97 guests