-
Notifications
You must be signed in to change notification settings - Fork 973
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
[F1] How do I debug ADC / analogRead() not working? #552
Comments
Hi @benwaffle, Note: value change each 30ms, so I use your sketch with 15ms delay. To debug you can try one of those methods: |
Sorry misclicked when commented. |
@benwaffle any feedback? |
Bump |
Sorry, I've been working on other things. Most recently, I was able to get stable-ish values, but still getting random spurts +/- 10 mV. How accurate can the ADC get with the arduino layer? |
Mostly the noise you see is independent from the used core. |
Arduino analogRead() is notorious for its slowness. |
If i remember correctly the analog circuitry on the 'Blue Pill' is far from 'well made'. |
As @AnHardt told, You can try customize on sample time:
With one of those possible values (default: Arduino_Core_STM32/system/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h Lines 293 to 300 in 5cc75ca
Note: you should have at least Core version 1.6.0. |
No feedback since a week. |
Looks like I had noise from the power supply. |
Describe the bug
analogRead() is returning incorrect / garbage values. A multimeter between PA2 and GND shows the correct value.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expected that code reads correct voltage as measured by multimeter.
Desktop:
Board:
The text was updated successfully, but these errors were encountered: