I found a fix, it is now 1 us, 1 Msps but I cannot find a way to do this on pin A7, everybody is using pin A0
int x; // read value
int myArray[20000];
void setup()
{
Serial.begin(9600); // initialize the serial port:
REG_ADC_MR = 0x10380180; // change from 10380200 to 10380180, 1 is the PREESCALER and 8 means FREERUN
ADC -> ADC_CHER = 0x80; // enable ADC on pin A0
}
void loop() {
int t = micros(); // init time an elapsed time, in micro seconds
for(int i = 0; i < 20000; i++) {
// instrucction to measure
while((ADC->ADC_ISR & 0x80)==0); // wait for conversion
myArray *= ADC->ADC_CDR[7]; // read value A0 *
-
} *
-
int t1 = micros(); *
-
Serial.println(t1-t);*
-
delay(2000);*
}