Analog Reference on Arduino UNO Wifi Rev2

First post... I am new to the arduino world and so far so good pretty happy, except for the precision of the ADC.
From what i can see the ATmega4809 micro controller used on the Arduino UNO Wifi Rev2 has a selection of built internal references voltages (0.55V, 1.1V, 2.5V, and 4.34V ), is there an API function to select these ? analogReference does not seem to support those values (I would need the 4.34 value).

Thanks
GD

gdinkanata:
First post... I am new to the arduino world and so far so good pretty happy, except for the precision of the ADC.
From what i can see the ATmega4809 micro controller used on the Arduino UNO Wifi Rev2 has a selection of built internal references voltages (0.55V, 1.1V, 2.5V, and 4.34V ), is there an API function to select these ? analogReference does not seem to support those values (I would need the 4.34 value).

Thanks
GD

from datasheet:

not sure if available in arduino IDE but maybe try ADC0_CTRLA = 0x30 in 'setup' to set the ADC reference to 4.34V.

hope that helps

github.com/arduino/ArduinoCore-megaavr … cores/arduino/Arduino.h#L45

#define INTERNAL0V55 (VREF_ADC0REFSEL_0V55_gc >> VREF_ADC0REFSEL_gp)
#define INTERNAL1V1 (VREF_ADC0REFSEL_1V1_gc >> VREF_ADC0REFSEL_gp)
#define INTERNAL2V5 (VREF_ADC0REFSEL_2V5_gc >> VREF_ADC0REFSEL_gp)
#define INTERNAL4V3 (VREF_ADC0REFSEL_4V34_gc >> VREF_ADC0REFSEL_gp)
#define INTERNAL1V5 (VREF_ADC0REFSEL_1V5_gc >> VREF_ADC0REFSEL_gp)

I have submitted a pull request to document the analogReference() values for Uno WiFi Rev2 in the Arduino Language Reference:

Excellent ! so it is already implemented, just have to select the proper parameter for analogReference.
Thanks :slight_smile: