analogReference() compile error - does Arduino 101 support external A/D ref?

In porting Pulse Sensor code to Arduino 101, I found that having a call to analogReference(EXTERNAL) produces a compilation error.

To reproduce:

  • Install Arduino IDE 1.6.7 and Intel Curie support :slight_smile: Board manager says "Intel Curie Boards by Intel version 1.0.4 INSTALLED"
  • In a new Sketch, add the following line to the setup()
    analogReference(EXTERNAL);
  • Select Board = Arduino 101
  • Verify (compile). It produces the error: invalid conversion from 'int' to 'eAnalogReference {aka _eAnalogReference}'
  • Select Board = Arduino UNO
  • Verify again. No compilation error.

From the error output it sounds almost like Arduino 101 uses an Enumeration rather than an int as the analogReference() parameter.

Does Arduino 101 support an external AREF input? If so, is there an Arduino-compatible way to turn it on? (that is, Sketch code that works on Arduino UNO as well as the 101, without changes)

Thanks.

Hi Brad,
the Curie chip can't change its internal analog reference as it's fixed to 3.3V.
The analogReference function is only an unimplemented stub and should not be used.
To avoid this, you could surround the call with

#ifndef ARDUINO_ARCH_ARC32 ``#endif

and let the function compile on any architecture except ARC32 (101).

thx @facchinm

I am trying that fix on arduino 1.6.12. I get the same error.

#ifndef ARDUINO_ARCH_ARC32
analogReference(EXTERNAL);
#else
// do something to change analog reference assumption
#endif

Correction: After reading the errors more carefully I see that I had 2 references to EXTERNAL. Now both treated as above it compiles OK. Thx.

Hello,
It is clear that the Curie chip does not support an external ADC reference voltage.
So why is AREF printed on the board?
On the schematics of the Arduino 101 I can not find a connection to the AREF pin.
Is there any body who can confirm that this AREF pin really is free and not connected?
I would like to connect it to 3.3V to feed I2C devices ( SDA, SCL, "AREF" and GND would form a connection of 4 consecutive pins).
Thanks