External AREF error and questions

I have a question to the AREF Feature of the DUE. I already unsoldered JR1 and connected the EXT connection. So far so good.

So, now comes the Software part, analogReference(). Which mode is the Default mode using? Since there is already a connection to the AREF Pin which supplies the Chip with 3.3V I assume it is set to the external Reference? If yes, what is the point of analogReference(EXTERNAL)? What is the difference?

Also, if I want to set the Analog reference I get the following error:

Analog_Board.ino: In function 'void setup()':
Analog_Board.ino:40:27: error: invalid conversion from 'int' to 'eAnalogReference {aka _eAnalogReference}' [-fpermissive]
In file included from C:\Users\GodePower\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.2\cores\arduino/Arduino.h:193:0,
                 from C:\Users\GodePower\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.2\variants\arduino_due_x/variant.h:36,
                 from C:\Users\GodePower\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.2\libraries\Wire/Wire.h:28,
                 from Analog_Board.ino:2:
C:\Users\GodePower\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.2\cores\arduino/wiring_analog.h:40:13: error:   initializing argument 1 of 'void analogReference(eAnalogReference)' [-fpermissive]
 extern void analogReference( eAnalogReference ulMode ) ;

Im using the 1.6.2 IDE.


No one? Is this a bug or am I doing something wrong?

From the Arduino Due product page:

The analogReference() function is ignored on the Due.

It seems that it's not entirely ignored since it's producing this error. I get the same error when I try to use analogReference(EXTERNAL) and it doesn't know about INTERNAL at all.

You unsoldered JR1? You mean you moved it over to the pad on the right labelled EXT? Without that component (or a solder blob) you will have no analog reference.

As far as I know the DUE always uses the voltage on its pin 75 (ADVREF) as voltage reference. Therefore the analogReference function doesn't make any sense on the DUE. You just need to connect your voltage the SMA3XE pin 75 (ADVREF) which means break the connection to 3.3V and install the connection to the AREF pin.

Hope that helps

Hi, I have the same problem. I already desoldered the resistor as per instructions on the arduino website. I have connected my external reference voltage to the AREF pin, and run the command analogReference(EXTERNAL). I get the same error. :relaxed: Have you had any luck with this issue so far? Thanks!

Alimo, in the other thread which you rudely resurrected, it gives you the answer: “Don’t do that!”

The Due is always EXTERNAL and calling that function should do nothing. Does it work when you remove it from your sketch?

From wiring_analog.h

 * \brief SAM3 products have only one reference for ADC
typedef enum _eAnalogReference
} eAnalogReference ;

That's the only value valid to pass to analogReference () on the Due.