Description
Hardware:
ESP32-WROOM-32E
Programmed with board type 'DOIT ESP32 DEVKIT V1'
using arduino ide V1.8.13 and 1.8.15 under Windows and Ubuntu (all combination, same result)
Description:
Hello,
I have a project in which I use GPIO36 (ADC1_CHANNEL_0) as analog input and everything worked fine until I updated the esp32 core to latest version (4.4), 2021/07/29 commit.
I was previously running the one-year old V3.3.
With the new core, the value returned by 'analogRead(36)' is totally wrong.
Testbench:
800mV applied on GPIO36.
Considering the ~100mV known insensitivity on the lower side, the expected ADC value is around 900 on 4095 full scale.
Sketch output with older core (v3.3.1-61-g367c3c09c):
11:11:22.115 -> 846
11:11:22.626 -> 845
11:11:23.102 -> 844
11:11:23.609 -> 846
11:11:24.121 -> 846
Output with latest core (v4.4-dev-2313-gc69f0ec32):
11:16:52.644 -> 3183
11:16:53.153 -> 3180
11:16:53.663 -> 3181
11:16:54.168 -> 3179
11:16:54.644 -> 3179
11:16:55.154 -> 3181
It takes a very low voltage to bring down the read value, that reaches zero if the pin is connected to ground (as it should).
The problem is: the response curve is totally wrong.
I read in the esp32 documentation that this pin is shared with an internal hall sensor, but for some reason, this was not an issue with the older core.
I compared the adc-related source code and found that the hallRead function in the older core used to initialize and deinitialize some internal registers, while the newer one does not. I then tried to do the same (executing the de-init code in the sketch) in the hope to get the hall sensor disabled but got no result.
Is there a way to get back the analog GPIO36 capability as it was on the V3.3 core?
I'm trying to compare the core's source but so far I couldn't spot it.
Thanks a lot and Best Regards!
Sketch:
void setup()
{
Serial.begin(115200);
pinMode(36, ANALOG);
}
//
void loop(void)
{
delay(500);
Serial.println(analogRead(36));
}