Skip to content

stm32h7: ADC acquisition time not set #94071

@geblerg

Description

@geblerg

Describe the bug

The macro ADC_ACQ_TIME is used in adc_stm32.c, adc_stm32_sampling_time_check() to pick the index of sampling_time_table:

for (int i = 0; i < STM32_NB_SAMPLING_TIME; i++) { if (acq_time == ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, config->sampling_time_table[i])) { return i; }

This is useful for setting the "zephyr,acquisition-time" property but not for retrieving the value at an index
Using the raw value at current index of sampling_time_table leads to picking the correct index:

for (int i = 0; i < STM32_NB_SAMPLING_TIME; i++) { if (acq_time == config->sampling_time_table[i]) { return i; } }

Regression

  • This is a regression.

Steps to reproduce

Use adc_stm32.c, adc_stm32_sampling_time_check(const struct device *dev, uint16_t acq_time) with any parameter.

Relevant log output

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

  • Zephyr 4.1

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Waiting for responseWaiting for author's responsearea: ADCAnalog-to-Digital Converter (ADC)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