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

analogRead() slow on STM32F405 #782

Closed
manitou48 opened this issue Nov 19, 2019 · 1 comment
Closed

analogRead() slow on STM32F405 #782

manitou48 opened this issue Nov 19, 2019 · 1 comment
Labels
answered question ❓ Usually converted as a discussion

Comments

@manitou48
Copy link

on STM32F405, analogRead() takes 50 us. On many other MCU's, analogRead() takes 5 us.

The datasheet says ADC stabilization time is 3 us, but in HAL_ADC_Start() in
system/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c
the while/counter stabilization delay is taking 37 us??

maybe a better delay loop would be

while(counter--) asm("nop");

that loop takes about 3 cycles per iteration

@fpistm
Copy link
Member

fpistm commented Nov 19, 2019

Hi @manitou48
the analogRead is know to not be optimized as we it init, calibrate, start, wait conversion and stop each time it is called.
That's why there is an #5 to produce a better ADC usage.

About the HAL, the core use it as it is. I guess you could submit an issue here to talk about:
https://github.com/STMicroelectronics/STM32CubeF4

@fpistm fpistm added the question ❓ Usually converted as a discussion label Nov 19, 2019
@fpistm fpistm closed this as completed Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered question ❓ Usually converted as a discussion
Projects
None yet
Development

No branches or pull requests

2 participants