-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32: F4: Increase ADC sampling time for VBAT #4691
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
Conversation
This has a huge impact on the normal usage of the ADC.
|
@ohagendorf I was hoping to get some feedback :-) thanks for that - I will proceed as suggested. |
To get a valid VBAT measurement on F4 targets, it is required to increased the sampling time to its maximum value.
d689239
to
f8d6f95
Compare
Maybe two features or three would be nice to have:
But curently for a fast conversion there is another huge problem. We analysed the adc read function:
and lock()+unlock() need much more time than analogin_read(). I had to look into the project documentation for the exact numbers but it was something around 1.5µs for the conversion and 5...6µs for calling lock()+unlock() (Nucleo_F446RE). |
thanks @ohagendorf |
@LMESTM So is there more work to come against this PR as a result of the above conversations ? |
@adbridge No more work - the latest PR takes into account comments from @ohagendorf |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Description
To get a valid VBAT measurement on F4 targets, it is required to increase
the sampling time to its maximum value.
This PR solves the issue reported here #4326
Status
READY
Tests
Tested on NUCLEO_F446RE target with VBAT measurements and non-regression OK
+-----------------------+---------------+-----------------------+--------+--------------------+-------------+
| target | platform_name | test suite | result | elapsed_time (sec) | copy_method |
+-----------------------+---------------+-----------------------+--------+--------------------+-------------+
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-analogin | OK | 12.65 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-analogout | OK | 11.8 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-businout | OK | 28.27 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-digitalio | OK | 13.17 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-i2c | OK | 14.54 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-interruptin | OK | 13.77 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-pwm | OK | 176.65 | shell |
| NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-spi | OK | 16.15 | shell |
+-----------------------+---------------+-----------------------+--------+--------------------+-------------+
More thoughts
Increasing the sample time may have impacts on performances (e.g. max number of samples per sec),
but this PR aims at getting valid sample first. There is way for improvement in MBED API to allow
configuration of this sampling time parameter. An issue will be entered accordingly.
Submitted #4692