EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #232 background imageLoading...
Page #232 background image
Chapter 2. API Reference
Parameters
channel: ADC2 channel to configure
atten: Attenuation level
esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int *raw_out)
Take an ADC2 reading on a single channel.
Note ESP32: 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_ESP32for the description of this issue. As a workaround, call
adc_power_acquire() in the app. This will result in higher power consumption (by ~1mA), but will re-
move the glitches on GPIO36 and GPIO39.
Note ESP32: 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.
Note ESP32-S2: ADC2 support hardware arbiter. The arbiter is to improve the use efficiency of ADC2. After
the control right is robbed by the high priority, the low priority controller will read the invalid ADC2 data.
Default priority: Wi-Fi > RTC > Digital;
Return
ESP_OK if success
ESP_ERR_TIMEOUT ADC2 is being used by other controller and the request timed out.
ESP_ERR_INVALID_STATE The controller status is invalid. Please try again.
Parameters
channel: ADC2 channel to read
width_bit: Bit capture width for ADC2
raw_out: the variable to hold the output data.
esp_err_t adc_vref_to_gpio(adc_unit_t adc_unit, gpio_num_t gpio)
Output ADC1 or ADC2s reference voltage to adc2_channe_ts IO.
This function routes the internal reference voltage of ADCn to one of ADC2s channels. This reference
voltage can then be manually measured for calibration purposes.
Note ESP32 only supports output of ADC2s internal reference voltage.
Return
ESP_OK: v_ref successfully routed to selected GPIO
ESP_ERR_INVALID_ARG: Unsupported GPIO
Parameters
[in] adc_unit: ADC unit index
[in] gpio: GPIO number (Only ADC2s channels IO are supported)
esp_err_t adc2_vref_to_gpio(gpio_num_t gpio)
Output ADC2 reference voltage to adc2_channe_ts IO.
This function routes the internal reference voltage of ADCn to one of ADC2s channels. This reference
voltage can then be manually measured for calibration purposes.
Return
ESP_OK: v_ref successfully routed to selected GPIO
ESP_ERR_INVALID_ARG: Unsupported GPIO
Parameters
[in] gpio: GPIO number (ADC2s channels are supported)
esp_err_t adc_digi_initialize(const adc_digi_init_config_t *init_config)
Initialize the Digital ADC.
Return
ESP_ERR_INVALID_ARG If the combination of arguments is invalid.
ESP_ERR_NOT_FOUND No free interrupt found with the specified flags
ESP_ERR_NO_MEM If out of memory
ESP_OK On success
Parameters
Espressif Systems 221
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish