Parameter to pass for ADC reference routing to GPIO

VinayDand
Posts: 4
Joined: Fri Jun 24, 2022 6:47 am

Parameter to pass for ADC reference routing to GPIO

Postby VinayDand » Fri Jun 24, 2022 7:14 am

Hello,

On ESP32 module,
following code fails
  1.     esp_err_t status = adc_vref_to_gpio(ADC_UNIT_2, ADC2_CHANNEL_9);
  2.     if (status == ESP_OK) {
  3.         printf("v_ref routed to GPIO\n");
  4.     } else {
  5.         printf("failed to route v_ref\n");
  6.     }
But if we replace
adc_vref_to_gpio (ADC_UNIT_2, ADC2_CHANNEL_9) function with deprecated function
adc2_vref_to_gpio (GPIO_NUM_26) then code works OK.
(We can see steady Vref value on the pin, using external voltmeter)

That seems parameter being passed to "adc_vref_to_gpio " function seems wrong.

Appreciate any guidance to use adc_vref_to_gpio function correctly.
(Will like to avoid deprecated "adc2_vref_to_gpio" function)

I am on esp-idf-v4.4.1 version.

Best Regards,
Vinay

Who is online

Users browsing this forum: NoTan2 and 107 guests