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:
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);
}
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:
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
Workaround based on the following commit:
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},
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...