Page 1 of 1

It would appear that the ADC configuration is driving the pin high

Posted: Thu Nov 05, 2020 3:27 pm
by chofsass
I'm trying to use the ADC to sample the voltage on GPIO_26. It would appear that the ADC configuration is driving the pin high. I have tested this electrically (when the GPIO_26 is configured as an ADC input the pin is driven high to 3.3V and if it is not configure as a ADC input it is 2.2V which is expected) with an oscilloscope. Below is my code:

Code: Select all

	adc2_config_channel_atten( ADC2_CHANNEL_9, ADC_ATTEN_DB_11 );

        int read_raw;

        while (true)
        {
            esp_err_t r = adc2_get_raw( ADC2_CHANNEL_9, ADC_WIDTH_12Bit, &read_raw);
            if ( r == ESP_OK ) {
                printf("%d\n", read_raw );
            } else if ( r == ESP_ERR_TIMEOUT ) {
                printf("ADC2 used by Wi-Fi.\n");
            }
            vTaskDelay(1000);
        }
Can you offer any insight into what the problem might be?