Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 2 months ago.
NUCLEO-F446RE ADC unstable
Hi mbed friends, yesterday I tried to use the ADC on the NUCLEO-F446RE. The reading is very unstable and varied about 20%. The board firmware and libraries are up-to-date. I checked power, all fine. After that I used the same code on the NUCLEO-F746ZG and that worked stable.
Are there known issues with the ADC on the NUCLEO-F446RE? I tried something like below:
#include "mbed.h" AnalogIn a0in(A0); AnalogIn a1in(A1); AnalogIn a2in(A2); int main() { while(1) { printf("%1.3f %1.3f %1.3f\r\n", a0in.read(), a1in.read(), a2in.read()); wait (1); } }
Kind regards, Jack.
1 Answer
8 years, 1 month ago.
Jack,
Normally this type of behavior is due to noise on the ADC reference input. I am too lazy to look up your board, but the ADC reference is almost certainly just the same 3.3V LDO that powers everything else on the board. The 3.3V rail will not actually be constant, it will have tiny spikes from all the switching in the circuit. The best way to solve this problem in a commercial product is an external reference voltage around say 3.0V, and just connect it to the micro's ADC ref pin. This gives a really clean reference point for the ADC. I have also seen datasheets suggesting using various types of LC filters between the 3.3V rail and the ADC ref input. Adding the series inductor can help tamp down some of the noise on the 3.3V rail.
For a dev board you could try software filtering maybe. Average a bunch of samples, or maybe take a bunch of samples and throw away the high and low one, average the rest.
It is also possible the impedance of your analog input is too high. This would result in a slow charge of the ADC sample cap and lead to varying results. Could try adding parallel cap to the input of the AD channel so it buffers things a bit.
Graham