From d53661a6634f65814c018bedfbe38f18a9297d22 Mon Sep 17 00:00:00 2001 From: kooho <2229179028@qq.com> Date: Mon, 5 Feb 2018 21:51:32 +0800 Subject: [PATCH] driver(adc): add descriptions for the issue that starting ADC can trigger interrupt of GPIO36 and GPIO39. --- components/driver/include/driver/adc.h | 19 +++++++++++++++++++ components/driver/include/driver/gpio.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/components/driver/include/driver/adc.h b/components/driver/include/driver/adc.h index e6c6df1a4..b5a9a9848 100644 --- a/components/driver/include/driver/adc.h +++ b/components/driver/include/driver/adc.h @@ -192,6 +192,10 @@ esp_err_t adc1_config_channel_atten(adc1_channel_t channel, adc_atten_t atten); /** * @brief Take an ADC1 reading from a single channel. + * @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on, + * the input of GPIO36 and GPIO39 will be pulled down for about 80ns. + * When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. + * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. * * @note Call adc1_config_width() before the first time this * function is called. @@ -210,6 +214,11 @@ int adc1_get_raw(adc1_channel_t channel); /** @cond */ //Doxygen command to hide deprecated function from API Reference /* + * @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on, + * the input of GPIO36 and GPIO39 will be pulled down for about 80ns. + * When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. + * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. + * * @deprecated This function returns an ADC1 reading but is deprecated due to * a misleading name and has been changed to directly call the new function. * Use the new function adc1_get_raw() instead @@ -288,6 +297,11 @@ void adc1_ulp_enable(); /** * @brief Read Hall Sensor * + * @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on, + * the input of GPIO36 and GPIO39 will be pulled down for about 80ns. + * When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. + * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. + * * @note The Hall Sensor uses channels 0 and 3 of ADC1. Do not configure * these channels for use as ADC channels. * @@ -349,6 +363,11 @@ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten); /** * @brief Take an ADC2 reading on a single channel * + * @note When the power switch of SARADC1, SARADC2, HALL sensor and AMP sensor is turned on, + * the input of GPIO36 and GPIO39 will be pulled down for about 80ns. + * When enabling power for any of these peripherals, ignore input from GPIO36 and GPIO39. + * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. + * * @note For a given channel, ``adc2_config_channel_atten()`` * must be called before the first time this function is called. If Wi-Fi is started via ``esp_wifi_start()``, this * function will always fail with ``ESP_ERR_TIMEOUT``. diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index 2f272ef5e..aed6427bf 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -265,6 +265,10 @@ esp_err_t gpio_set_intr_type(gpio_num_t gpio_num, gpio_int_type_t intr_type); /** * @brief Enable GPIO module interrupt signal * + * @note Please do not use the interrupt of GPIO36 and GPIO39 when using ADC. + * Please refer to the comments of `adc1_get_raw`. + * Please refer to section 3.11 of 'ECO_and_Workarounds_for_Bugs_in_ESP32' for the description of this issue. + * * @param gpio_num GPIO number. If you want to enable an interrupt on e.g. GPIO16, gpio_num should be GPIO_NUM_16 (16); * * @return