AnalogueReference() needs update

Have not been able to use this feature as there does not seem to be a valid constant for the available reference values.

Is this correct or should I be using Portenta [still fails] !!!

Regards Colin

Hi @lensman11. I'm not knowledgeable on this subject, but I saw this comment from someone who is:

https://github.com/arduino/ArduinoCore-mbed/issues/161#issuecomment-1106208028

To set the analog reference in STM32H7 boards there's no need to call any function, just connect the external reference to AREF pin and it will be used. I'm going to add an empty function with a warning at compile time to make the linker happy.

Here is the implementation of the "empty function" mentioned above:

And another here:

https://github.com/arduino/ArduinoCore-mbed/issues/161#issuecomment-1143495047

As far as I know, an external voltage reference is required for stable readings. When not connecting it, it automatically uses the internal voltage reference via weak pull-ups.

So you have the options of a rough internal ~3.3 V reference or you can connect an external reference. Either way, it is all done electrically with no need for any modifications to the code. There isn't the programmable reference selection capability like we have in the AVR boards so analogReference is irrelevant for these boards.

1 Like