Skip to content

ADC1 doesn't read correctly on STM32F7 #29309

@disposedtrolley

Description

@disposedtrolley

Describe the bug
The ADC_1 peripheral doesn't seem to work correctly on the STM32F7 series. I've tried compiling a test project following the test code supplied in the PR which introduced ADC support for STM32, but I get garbage readings on my Nucleo F767ZI board. The same code works fine on my Nucleo F401RE.

My settings:

  • F767ZI
    • ADC_1
    • Channel 12
  • F401RE
    • ADC_1
    • Channel 0

To Reproduce
Steps to reproduce the behavior:

  1. Build a minimal project according to the test code targeting the Nucleo F676ZI board. Use the following channel config:
static const struct adc_channel_cfg adc_cfg = {
    .gain = ADC_GAIN_1,
    .reference = ADC_REF_INTERNAL,
    .channel_id = 12
};
  • If gain and reference aren't provided when building for the F7, it results in errors when executing adc_channel_setup().
  1. Connect something to Pin 7 of CN10 (PB1).
  2. Observe that garbage readings are printed to the console.

Expected behavior
The ADC should output similar readings on the F7 series as the F4.

Impact
It was painful to debug whether this was an issue with my code, a hardware problem, or a Zephyr issue. Since the ADC implementation was only tested on some F4 boards, perhaps compatibility with other STM32 series should be removed from the docs.

Logs and console output
If applicable, add console logs or other types of debug information
e.g Wireshark capture or Logic analyzer capture (upload in zip archive).
copy-and-paste text and put a code fence (```) before and after, to help
explain the issue. (if unable to obtain text log, add a screenshot)

Environment (please complete the following information):

  • OS: MacOS
  • Toolchain: arm-none-eabi-gcc
  • Commit SHA or Version used

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugThe issue is a bug, or the PR is fixing a bugplatform: STM32ST Micro STM32priority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions