7 years, 6 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

7 years, 6 months 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

Accepted Answer

Jack.

Are your ADC measurements synchronized with the power line frequency in your building (50 or 60 Hz). If not, try to start your ADC measurement at the same frequency as power line in building to compensate for this noise.

Regards,

Bo

posted by Bo Liljedahl 29 Oct 2016