2025-09-12 12:54 PM
I am trying to use pins on ADC3 of an STM32h735g in Zephyr, but I am getting a "Could not read (-22)" error, despite not having issues with ADC1. Is ADC3 supported? If so, can you help me with how to configure it?
This is based on the Zephyr samples/drivers/adc/adc_dt and I am using the stm32h735g Discovery Kit to test this.
I modified boards/stm32h735g_disco.overlay to
/* Copyright (c) 2021 STMicroelectronics
SPDX-License-Identifier: Apache-2.0 */
/ {
zephyr,user {
/* Adding adc3 1 to the existing definition of io-channels */
io-channels = <&adc1 0>, <&adc3 1>;
};
};
&adc1 {
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <16>;
};
};
/* The following I defined for adc3 */
&adc3 {
#address-cells = <1>;
#size-cells = <0>;
/* Compiler requiess definition for the following on adc3*/
pinctrl-0 = <&adc3_inp0_pc2_c>;
pinctrl-names = "default";
st,adc-clock-source = <SYNC>;
st,adc-prescaler = <4>;
status = "okay";
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <16>;
status = "okay";
};
};
However the output is
ADC reading[0]:
- adc@40022000, channel 0: 2278 = 114 mV
- adc@58026000, channel 1: Could not read (-22)