Analog I/O Pins and ADC Sampling Frequency

no answer to the digital read/write question, but going back to OP:
the link that BuckM provided (Evaluating Arduino and Due ADCs) is a real gem if you want fast ADC (analogRead). This djerikckson did a fantastic job in evaluating the ADC speed, resolution, accuracy etc of the Arduino DUE.
What is most interesting is that he hints at a possible programming mistake in the Arduino 1.5 codebase; a quote from the ADC speed section of djerickson's evaluation:
"This may be a bug. STARTUP is a four bit field so 12 (0xC) works, but 40 (0x28) won't work. And 12 sets the value to 768 which is why the ADC is so slow. So I suspect that the programmer confused the value with the hardware settings. "

I tried the hack and it works as claimed:

    REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000;

this gives a 4usec analogRead, instead of the 39usec that the standard settings give you.

tip of the hat and big thanks to djerickson.com

1 Like