Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: adc for stm32h7 depends on the version for oversampling #37379

Closed
FRASTM opened this issue Aug 2, 2021 · 1 comment
Closed

drivers: adc for stm32h7 depends on the version for oversampling #37379

FRASTM opened this issue Aug 2, 2021 · 1 comment
Labels
area: ADC Analog-to-Digital Converter (ADC) area: Tests Issues related to a particular existing or missing test platform: STM32 ST Micro STM32

Comments

@FRASTM
Copy link
Collaborator

FRASTM commented Aug 2, 2021

Describe the bug
The stm32h7 HAL and LL has ADC_LL_EC_OVS_RATIO Oversampling - Ratio defined for
only ADC of version ADC_VER_V5_V90.
For some stm32H7xx soc, like the stm32h743 and stm32h753, the function LL_ADC_ConfigOverSamplingRatioShift has a different prototype which is not compatible with other soc series. The start-read() fails because the ADC_LL_EC_OVS_RATIO does not exist So the build fails for nucleo_h743zi and nucleo_h753zi target boards.

To Reproduce
Steps to reproduce the behavior:

  1. west build -p auto -b nucleo_h743zi tests/drivers/adc/adc_api/

Expected behavior
compilation passed

Impact
What impact does this issue have on your progress (e.g., annoyance, showstopper)

Logs and console output

./drivers/adc/adc_stm32.c: In function 'start_read':
./drivers/adc/adc_stm32.c:444:44: error: 'LL_ADC_OVS_RATIO_2' undeclared (first use in this function)

Environment (please complete the following information):

  • OS: (e.g. Linux, 18.04)
  • Toolchain (e.g Zephyr SDK, ...)
  • Commit SHA 9143f4f$
  • stm32Cube: ../modules/hal/stm32/stm32cube/stm32h7xx V1.9.0

Additional context
./modules/hal/stm32/stm32cube/stm32h7xx/stm32h7xx_ll_adc.h:

LL_ADC_ConfigOverSamplingRatioShift
  * @param  Ratio This parameter can be in the range from 1 to 1024.
@FRASTM FRASTM added bug The issue is a bug, or the PR is fixing a bug area: ADC Analog-to-Digital Converter (ADC) area: Tests Issues related to a particular existing or missing test platform: STM32 ST Micro STM32 labels Aug 2, 2021
@FRASTM
Copy link
Collaborator Author

FRASTM commented Aug 2, 2021

In the LL_ADC_ConfigOverSamplingRatioShift() function of the stm32h7xx Cube,
the LL_ADC_OVS_RATIO must be converted in a value from 1 to 1024
LL_ADC_OVS_RATIO_2 replaced by ratio = 1
LL_ADC_OVS_RATIO_4 replaced by ratio = 2
LL_ADC_OVS_RATIO_8 replaced by ratio = 3
LL_ADC_OVS_RATIO_16 replaced by ratio = 4
LL_ADC_OVS_RATIO_32 replaced by ratio = 5
LL_ADC_OVS_RATIO_64 replaced by ratio = 6
LL_ADC_OVS_RATIO_128 replaced by ratio = 7
LL_ADC_OVS_RATIO_256 replaced by ratio = 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ADC Analog-to-Digital Converter (ADC) area: Tests Issues related to a particular existing or missing test platform: STM32 ST Micro STM32
Projects
None yet
Development

No branches or pull requests

2 participants