I need a lot of AD data at 1MHz speed.
I am testing with adcBufTemperature example.
I only changed samplingFrequency and samplesRequestedCount in this example, and added ADCBuf_convert() in the while loop.
/* Set up an ADCBuf peripheral in ADCBuf_RECURRENCE_MODE_CONTINUOUS */ ADCBuf_Params_init(&adcBufParams); adcBufParams.callbackFxn = adcBufCallback; adcBufParams.recurrenceMode = ADCBuf_RECURRENCE_MODE_ONE_SHOT; adcBufParams.returnMode = ADCBuf_RETURN_MODE_CALLBACK; adcBufParams.samplingFrequency = 1000000; adcBuf = ADCBuf_open(CONFIG_ADCBUF_0, &adcBufParams); if (!adcBuf){ /* AdcBuf did not open correctly. */ while(1); } /* Configure the conversion struct */ continuousConversion.arg = NULL; continuousConversion.adcChannel = CONFIG_ADCBUF_0_CHANNEL_0; continuousConversion.sampleBuffer = sampleBufferOne; continuousConversion.sampleBufferTwo = sampleBufferOne; continuousConversion.samplesRequestedCount = 1000; /* * Go to sleep in the foreground thread forever. The data will be collected * and transfered in the background thread */ while(1) { if (ADCBuf_convert(adcBuf, &continuousConversion, 1) != ADCBuf_STATUS_SUCCESS) { /* Did not start conversion process correctly. */ while(1); } /* Wait for semaphore and print average temperature */ sem_wait(&adcbufSem); /* Print a message with average temperature */ Display_printf(displayHandle, 0, 0, "The average temperature is %.3fC", avgTemperature); }
However, after a few loops, adcBufCallback() no longer occurs.
Are there any limits on the sampling rate?
Also, the overflow flag is raised in ADC_OSTAT. Can I ignore it?