AnalogIn mbed library bug for Nucleo-F746ZG boards?

18 Apr 2016

I suspect there is a bug with the AnalogIn component of the mbed library for Nucleo-F746ZG boards. It seems that both AnalogIn's read() and read_u16() always return 0, regardless of the voltage applied to the ADC pin.

I have copied the following example verbatim to test there is a problem with the library and not a conflict with other elements of my code: https://developer.mbed.org/teams/ST/code/Nucleo_read_analog_value/file/6d058686efbf/main.cpp

I have tested this with two different Nucleo-F746ZG boards and observed the same effects. I have also tried different ADC pins with no difference in results. My test setup involves connecting the 3.3v pin of the board to the ADC pin under test via a 100 ohm resistor.

To rule out my local compiler setup, I compiled this with the online compiler. I used mbed library version 118.

I scanned through the F746ZG board docs to see if there is a jumper I need to set to enable ADC functionality but haven't seen it yet.

Hopefully this can be addressed soon as I really need the ADC pin functionality to finish this project and I really don't want to have to manually set all the pin configuration components manually if I can help it.

19 Apr 2016

Does this happen as well if you Import Nucleo_read_analog_value and do not select to Update libraries and then compile? I don't have the board here unfortunately, but I haven't seen this bug reported before, so I assume it worked before...

If the nucleo_read_analog_value program is also broken I'll ping someone in ST.

19 Apr 2016

The Nucleo_read_analog value example uses mbed library version 95. The NUCLEO_F746ZG was not introduced into the library until version 115 so I'm not sure if that will work. It is a new board so perhaps that is why nobody else has mentioned it yet. I think it would be worthwhile for ST to check.

I do see similar issues have arisen in the past with other Nucleo boards: https://developer.mbed.org/questions/4420/Problem-with-Nucleo-L152RE-AnalogIn/ https://developer.mbed.org/questions/4494/I-can-not-get-my-ADC-to-work-What-am-I-d/ https://developer.mbed.org/questions/4504/The-AnalogIn-function-doesnt-seem-to-wor/ https://developer.mbed.org/questions/6141/AnalogIn-does-not-recognize-the-AinA0/ https://developer.mbed.org/questions/54298/The-read-result-on-A5-always-0/

I have not had an opportunity to dive deeper to asses these solutions (i.e. verifying HSI is enabled, etc)

20 Apr 2016

As expected, I cannot compile the Nucleo_read_analog value example when I do not update the mbed library. I receive an error -230 from the online compiler.

20 Apr 2016

Ok, I can confirm this as a bug now with the mbed library and better yet I narrowed down when the bug happened.

If I use version 115 (the version that first supports this board) then AnalogIn on A0 works (I did not try it on other analog inputs yet). If I use version 116, AnalogIn for A0 reports 0 all the time.