does anybody have suggestion how to get the 1Msps on Due

Here is a simple code I tried but it is producing garbage. For example when I ground PIN A6. it should read 0 but some readings will produce values greater than 0 I do not know why. I am trying to read sensor with 3692 pixels.

int myArray[3692];

void setup()
{

Serial.begin(9600);
REG_ADC_MR = 0x10380180; // FREERUN
ADC -> ADC_CHER = 0x02; // enable ADC on pin A6, AD1
delay(1);

}

void loop()
{

for (int i = 0; i < 3692; i++) {

while ((ADC->ADC_ISR & 0x02) == 0); // wait for conversion

myArray = ADC->ADC_CDR[1]; // read value A6, AD1

  • }*

for (int i = 0; i < 3692; i++){

_ Serial.println(myArray*);_
_
}_
_
}*_

Post your code between code tags.

Your code do not compile : myArray = ADC->ADC_CDR[1]; And ADC samples at 1MSPS requires a PDC DMA to log data.

They guy who previously posted the code said that it was working. I am guessing that I might need DMA to collect the data. I have tested over the weeks all the examples I could find, nothing worked. People post codes which was never tested.

Would you know by chance the code ?

Reply #5 here