10 years, 2 months ago.

AnalogIn class broken for the STM32L152RE board

It seems to me that the AnalogIn class has somehow broken on the mbed software for this target board. It seems to just hand the board when you call the function. I even downloaded and ran the trivial demo: Nucleo_read_analog_value to make sure I was not doing anything stupid. Tried it as well on several brand new board to confirm no hardware problem. Confirm commincation through UART is OK to computer and also confirmed through just using LED. See program below does not blink LED! I think think seems to be a real bug or something very strange. I have been using these board for 6 months so I am pretty familiar with using them.

#include "mbed.h"
 
AnalogIn analog_value(A0);
 
DigitalOut myled(LED1);
 
int main() {
    while(1) {      
        uint16_t meas = analog_value.read_u16(); // Converts and read the analog input value
 
          myled = !myled;
        wait(0.2); // 200 ms
    }
}

Edited by 0xc0170: Please use code highlight syntax for code snippets. Thanks

I experienced the same problem. It works as expected on mbed library revision 81 and earlier. From mbed library revision 82 onwards it stopped working.

posted by Mike Venter 26 Aug 2014

1 Answer

10 years, 2 months ago.

i had the same problem Solution? please

Use an older revision of the mbed lib, unless you really need to use the latest one. In the next one it will be fixed.

posted by Erik - 11 Sep 2014