ADC support in Zephyr appears to be severely limited on STM32 devices

Recently I’ve been testing out ADC & PWM devices on the nRF52840 & STM32 (blackpill_f411ce) boards under Zephyr, as part of an effort to move my projects over from Arduino to PlatformIO/Zephyr.

I’m finding that the current ADC support in Zephyr for the STM32 boards is severely limited. From my debug sessions, it appears that only one or two ADC channels are currently supported on the STM32. On the blackpill_f411ce (stm32f411ce), only one ADC channel on pin PA1 is currently supported.

Zephyr does support multiple ADC channels on other boards, for example, with the Particle Xenon (nRF52840), I’m able to access all the 6 ADC channels without any issues.

In addition, with the blackpill_f411ce under the Arduino Framework, I’m able access all the ADC 10 channels.

As the STM32 are very popular and used extensively, it would be very useful to have full channel support on the STM32 devices.

Are there any plans to provide full ADC channel support?
Is there an enhancement request? If not, how can I raise a request?


We’re the build-system people, not the Zephyr people, so we can’t say what the ADC support roadmap is. The framework code is taken from them. With the STM32 platform, we’re currently using Zephyr 2.4.0, which is the latest stable release.

I suggest you either start a thread on Discussions · zephyrproject-rtos/zephyr · GitHub with the exact code you’re using and the issue you’re seeing (or the limitations of that) and if that’s confirmed you can open an enhancement request at Sign in to GitHub · GitHub. (Or if you can directly reference the code that is limiting you, you should be able to directly open an enhancement request issue).

Hi maxgerhardt,

Thank you for your response.

Incidentally, this morning I noticed that an ADC example has recently been added to the “/framework-zephyr/samples/drivers folder in Zephyr 2.5.0-rc1”, so may be some changes are in the works for Zephyr 2.5.

Analog-to-Digital Converter (ADC) — Zephyr Project Documentation.

I’ll review the new ADC example from Zephyr 2.5.0-rc1 against what I have. My code works fine with all the ADC channels on the nRF52840 (Particle Xenon) board. As per your suggestions, I’ll open a thread with the Zephyr folks.

Initially, I was little confused with exactly what version of Zephyr being used by PlatformIO. The pio build displayed “framework-zephyr 2.20400.201210 (2.4.0)”.
Not sure why there is still a reference to “2.2”?

Processing stm32 (platform: ststm32; framework: zephyr; board: blackpill_f411ce)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 (11.0.0) > WeAct BlackPill V2.0 (BlackPill F411CE)
HARDWARE: STM32F411CEU6 100MHz, 128KB RAM, 512KB Flash
DEBUG: Current (stlink) External (blackmagic, cmsis-dap, jlink, stlink)
 - framework-zephyr 2.20400.201210 (2.4.0) 
 - framework-zephyr-canopennode 0.0.0-alpha+sha.468d350028 
 - framework-zephyr-civetweb 0.0.0-alpha+sha.99129c5efc

2.20400.201210 does not mean Zephyr v2.2 but major PIO package version 2, inner version 20400 → 2.4.0 in semver, and 2020 December 10th for the date.

My bad. Thanks for the clarification.