2025-09-12 12:54 PM - last edited on 2025-09-16 2:12 AM by Andrew Neil
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)
2025-09-15 3:11 AM - edited 2025-09-15 3:58 AM
Hello @anthonyog,
I wanted to bring your attention to an important issue with ADC3 when switching channels, this is due to a hardware limitation described in the STM32H735G errata. ADC3 should only be used in continuous conversion mode on a single channel to avoid data corruption.
Check STM32H72xx/73xx device errata - Errata sheet, section 2.10.7
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-09-15 3:42 AM
@Sarra.S wait, what?
I'm using ADC3 on a H733 (and H735-DK) with continuous conversion on several sequenced channels for 2 years now. And it's working.
I have checked the errata sheet just now, never did concerning ADC3, but there's not much info.
What are the exact limitations?
2025-09-16 2:10 AM
Hello @LCE,
Thank you for sharing your experience, it's really important!
I have submitted an internal ticket with dedicated team to get further clarification on the ADC3 channel switching behavior and the related erratum (Internal ticket number: Ticket 217552 )
We will keep you informed as soon as we receive feedback
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-09-16 3:45 AM - edited 2025-09-16 3:47 AM
@Sarra.S thanks for taking care of that!
I use ADC3 in continuous mode and sequencing at least 2 channels (Vref & temperature) with DMA (circular, overwriting, no interrupts) on the Nucleo-H723, the H735-Discovery-Kit, and a custom board with H733 (10 channels or so).
2025-09-16 3:46 AM
Hello @anthonyog,
I recommend trying Zephyr 3.7 (LTS) or later, as these versions include improvements for ADC3, ADC4, and ADC5.
I hope my answer has helped you. When your question is answered, please select this topic as the solution that answered you, as it will help others find that answer faster.
Thanks for your contribution.
Dor_RH