8 years, 2 months ago.

AnalogIn value too low?

On the NUCLEO-F303K8 when measuring volt, value is 5% - 6% below correct value.

Same code on NUCLEO-F446RE gives correct value.

 
#include "mbed.h"

// Initialize a pins to perform analog input and digital output fucntions
AnalogIn   ain(A1);

int main(void)
{
    float verdi;
    while (1) {
        verdi = ain.read();
        
        printf("percentage: %3.3f%%\n", verdi*100.0f);
        printf("volt: %3.3f\n\n", verdi*3.321f); //Multimeter value on AREF = 3.321
        wait(1);
    }
}

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F303K8T6 microcontroller.

1 Answer

8 years, 2 months ago.

I can confirm they do seem quite a bit out - is there any solution for this yet?

Unfortunate no solution yet

posted by Petter Pripp 15 Mar 2016

I have a similar problem on a 103 board. There is an STM 'Start Calibrate()' function in CMSIS, and if you use an old mbed version (pre 95 I think) you can access it and it works well (within 10mV). The problem is that the move to HAL breaks this, and I don't know how to call HAL function - anyone else know?.

posted by Philip Tranter 17 Nov 2016