7 years, 11 months ago.

FRDM-F64K Analogin weird values

Dear list,

I am trying the simplest little program reading an analogue input but get some weird values. When I connect the input directly to the board's GND, the read_u16 value returned is very high (65418) and fluctuating. Connecting it directly to 3V3 returns 32267, which is stable. Using a linear 5K pot, the values measured are not very stable, the read-out is not linear and when the pot is in the lowest position, I get the same problem as with the GND.

#include "mbed.h"
 
AnalogIn sensor(A1);
 
int main() {
    uint16_t val;
    while(1) {
        val = sensor.read_u16();
        printf("%u\n\r", val);
        wait(0.5);
    }
}

I have been looking around if other people reported an issue like this, but everybody just seems to have no issues whatsoever reading analogue values like this. I have tried three different boards and different inputs, but it is always the same. Also tried with a separate external power supply but still the same issue.

Is the board's ground the same as the analogue input's ground? Is the input very sensitive for noise, even with a 5K potmeter? What is the input range for the boards analogue inputs (can not find definitive information in the docs on this!)

What am I missing?!

Thanks,

Frans

Be the first to answer this question.