analogReadResolution 16 bit on certain pins?



So we hit a funny problem, we have the Dash reading a voltage reading (~2.8v) with the the ADC resolution at 16 bits using analogReadResolution.

Looks like pins A09, A08, A02, A01 but not for the other ADC pins. When I bring ADC A06 resolution to 10 bit instead of 16 bits, I get an accurate reading (12 bits also looks good but 8 bit looked terrible).

We’re probably doing something wrong, can you advise on which pins support what resolutions? I noticed on the K22 datasheet

Analog modules
• Two 16-bit SAR ADCs
• Two 12-bit DACs

So something is up and can you help clarify what pins support what kinds of resolution.

16-bit ADC accuracy

Can you share the code for changing the resolution?? I am interested in messing around with this.


Never mind, I found a page if anyone is interested:



All of the analog pins use one of two ADC16 peripherals (as you pointed out with the datasheet). All analog pins support 8/10/12/16-bit resolutions. Calling analogReadResolution() sets the ADC16 peripheral to use that specific resolution, so there isn’t any further conversion occurring. Unless you use an unsupported resolution, then the conversion is done in software. For example, an 11-bit read is done using a 12-bit read and down-converting to 11 bits.

I did some comparisons between resolutions and pins, and I didn’t see much of a variance. I used the internal DAC (provided on L14 using analogWrite()) as my voltage source, with a resolution of 12-bits and a value of 3475, which is close to 2.8V if VCC is 3.3. Depending on your board, the 3.3V may be slightly higher or lower, affecting the results.

Can you quantify ‘looked terrible’? What value are you expecting vs the values you are reading?


Thanks for the answer Erik!

To follow up, we debugged the hardware and it looks like the circuit the ADC is connected to is sensitive to noise. We put a cap and new resistors on it and the problem finally went away last night. Thanks though!


Oh for terrible, we had an input voltage of 3.0 measured by the meter and the ADC read less than 2 and when I switched the bit precision, it increased the accuracy. I guess moving down in precision had some positive effects to reduce noise.