Due analog input pull-up resistor not working

Hello.

Does anyone know why on Due analog input pull-up not working.
According to datasheet there is pull-up on analog input also.
I tried to put it on but there is nothing happens.

I tried pinMode(A0, INPUT_PULLUP);
then digitalWrite(A0, HIGH);
then REG_PIOA_SODR = 0x0000000F this is register for pull UP on A0 input.

Any help please?

I've used pinMode to enable the pull-up other analog inputs on the Due without any issues, but unfortunately not on A0.

Have you tried setting the pull-up using the PIO Pull Up Enable (PUER) register?

REG_PIOA_PUER = PIO_PA16;

A0 on the Due corresponds to pin PA16 on its SAM3X8E microcontroller.

There's also a pull-up disable register (PUDR) and a pull-up status register (PUSR).

How do you know nothing happens? That snippet of code doesn't do anything detectable from outside. Show us the rest of your code.

If you do an analogRead(A0) then it will switch off the pullup.

Yes i make analogread(A0)
I didn't know that it tern pull-up off.
I tried Example sketch

int sensorValue = 0;        // value read from the pot


void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
  pinMode(A0, INPUT_PULLUP);
  //digitalWrite(A0, HIGH);
  //REG_PIOA_SODR = 0x0000000F;
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:

  // change the analog out value:


  // print the results to the serial monitor:
  Serial.print("sensor = " );
  Serial.print(sensorValue);


  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(2000);
}

and analogread show floating reads 200-700 with no input

If you require a pull-up on your analog input, you can use an external resistor.

I Also Also tried more possibilities

void setup() {
  // initialize serial communications at 9600 bps:
  SerialUSB.begin(57600);

  // digitalWrite(A0, HIGH);
  // REG_PIOA_SODR = 0x3FFF;
  //adc_enable_all_channel(ADC);
  ADC->ADC_MR |= 0x80;  //set free running mode on ADC
  ADC->ADC_CR = 2;
  ADC->ADC_CHER = 0x3FFF;
  PIOA->PIO_PUER |= PIO_PA16;
  PIOA->PIO_SODR |= PIO_PA16;
  PIO_PullUp(PIOA, PIO_PA16, PIO_PULLUP);

}


void loop() {
  int t = micros();
  int a[11];

  while ((ADC->ADC_ISR & 0x3FFF) != 0x3FFF);
  a[0] = ADC->ADC_CDR[7];
  a[1] = ADC->ADC_CDR[6];  
  a[2] = ADC->ADC_CDR[5];
  a[3] = ADC->ADC_CDR[4];
  a[4] = ADC->ADC_CDR[3];
  a[5] = ADC->ADC_CDR[2];
  a[6] = ADC->ADC_CDR[1];
  a[7] = ADC->ADC_CDR[0];
  a[8] = ADC->ADC_CDR[10];
  a[9] = ADC->ADC_CDR[11];
  a[10] = ADC->ADC_CDR[12];
  a[11] = ADC->ADC_CDR[13];


  t = micros() - t;
  SerialUSB.print("1  conversion in All Channels  "); SerialUSB.print(t); SerialUSB.println(" micros");
  SerialUSB.print("A0 total:"); SerialUSB.println(a[0]);
  SerialUSB.print("A1 total:"); SerialUSB.println(a[1]);
  SerialUSB.print("A2 total:"); SerialUSB.println(a[2]);
  SerialUSB.print("A3 total:"); SerialUSB.println(a[3]);
  SerialUSB.print("A4 total:"); SerialUSB.println(a[4]);
  SerialUSB.print("A5 total:"); SerialUSB.println(a[5]);
  SerialUSB.print("A6 total:"); SerialUSB.println(a[6]);
  SerialUSB.print("A7 total:"); SerialUSB.println(a[7]);
  SerialUSB.print("A8 total:"); SerialUSB.println(a[8]);
  SerialUSB.print("A9 total:"); SerialUSB.println(a[9]);
  SerialUSB.print("A10 total:"); SerialUSB.println(a[10]);
  SerialUSB.print("A11 total:"); SerialUSB.println(a[11]);

  delay(2000);
}

And also nothing work.

Nothing? You mean you broke Serial.print() too? It must print something!

NO no no!

Just floating point 1200-2000 Code makes 12 bit resolution.
Adn reading very fast 2-3 micros for all 12 reads together.

Now i soldered 10k resistors t my DUO for PULL-UP working ok, now is the time to make not blocking
conversion because 2-3 uS is big time.

I think Interrupts will be ok.