DUE ADC

Hello,
At the moment I test the internal ADC from the DUE and there is a little error....
I can sample the input signals however there is always a sample offset.
When there is no input signal at the analog input pin I got a constant sample value of 1023-1024..
The adc resolution is 12 bit.
Here is my code:

unsigned long values[1000];
void setup() { 
pinMode(A3, INPUT);
digitalWrite(A3,HIGH);
ADC->ADC_MR |= 0x80;  //set free running mode on ADC
  ADC->ADC_CHER = 0x10; //enable ADC on pin A3
for(i=0;i<1000;i++){
    while((ADC->ADC_ISR & 0x10)==0); // wait for conversion
    values[i]=ADC->ADC_CDR[4]*0.25; //get values
Serial.println("Values: ");
  for(i=0;i<1000;i++) {
    Serial.println(values[i]);
  }

Should be the analog pin HIGH or LOW at the beginning?

Here is a picture to demonstrate the error.

I've seen noise problems with the Arduino Due but not a massive offset like you're seeing. That's a 1/4 of the way up or about 0.825v positive bias. My guess is going to be that whatever you are measuring has the offset. The easiest way to test is to disconnect everything from the ADC pins and then try again. If the reading is very low and fluctuates a little bit then that's normal. If it still has 1024 offset then something is wrong. If the offset went away then check your analog source to see what is going on. One thing you might check is that you have the ground for ADC well connected.

I have nothing changed in the code but now it works...... I will observe this phenomenon :slight_smile:

Another question:

For further testing I would like to use an external ADC converter.
Does anyone have a good suggestion?
It should have a sample rate up to 1 MSPS and at least a resolution of 16 bits.
The best would be a single-ended input.

Thanks.