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

AnalogIn Read giving incorrect voltages L476RG

22 Mar 2016

Anyone tried the example code for analog input read - on L476RG?

Scale of voltage readings is way off (code reports 51 Volts!).

http://www.emcu.it/NUCLEOevaBoards/mBed/QSG-Mbed-Library.pdf

I'm no expert but the code above seems to expect analog_value.read_u16() to be in the range 0 - 4095 (12bit)... ...it actually seems to range 0 - 65535. Is this just a question of where the ADC's 12 bits gets placed in the 16 bit uint_16?

I've tested shifting the ADC read to the right 4 bits and it seems to work with this !!correction!! : Result_V = ((MinStepRes * meas))/ ( !! 0x10 * !! 1000);