Hi, I find that the analog input on the Arduino 101 has a settling error when reading multiple channels and the source impedance is 10 kohm. I started with low impedance by connecting a wire from channel A0 to GND and a wire from channel A1 to 3.3 V. Then using analogRead() in wiring_analog.c, I get the expected results of 0 and 1023 for channels A0 and A1. When I replace the wires with 10 kohm resistors, the measurement becomes 9 and 1022 and sometimes A0 jumps to 74. I chose 10 kohm because that's a common potentiometer value that many people will use. I suspected a settling error due to the multiplexed nature of the Arduino's ADC.
Inside analogRead there's the statement:
SET_ARC_MASK(ADC_CTRL, ADC_SEQ_PTR_RST | ADC_SEQ_START | ADC_ENABLE);
This statement initiates a series of macro calls that switches the mux to the desired channel, turns on the ADC and then starts the acquisition. After the acquisition, the mux will stay on the desired channel and this is where the problem is - there isn't enough settling time from switching the mux to starting the acquisition. So, I inserted a delay between the mux channel switch and the acquisition start:
SET_ARC_MASK(ADC_CTRL, ADC_SEQ_PTR_RST | ADC_ENABLE);
delay(1);
SET_ARC_MASK(ADC_CTRL, ADC_SEQ_START);
Now, I get the expected results of 0 and 1023 with 10 kohm impedance.
How do I submit a bug report?