i'm using the ADC on the QN9080-DK, and found that i can't sample it faster than about 500 Hz, because these three lines:
ADC_DoSoftwareTrigger(ADC);
while (!(ADC_GetStatusFlags(ADC) & kADC_DataReadyFlag)) {}
adcConvResult = ADC_GetConversionResult(ADC);
are taking 2 ms to complete (i tested this by toggling a GPIO pin before and after execution, and measuring the duration of the pulse with an oscilloscope). actually i find that the first 2 lines only take 12 microseconds, and it's the third line that takes 2 ms. why is the call to ADC_GetConversionResult() taking so long?
here's my ADC configuration:
POWER_EnableADC(true);
adc_config_t adcConfigStruct;
adc_sd_config_t adcSdConfigStruct;
ADC_GetDefaultConfig(&adcConfigStruct);
adcConfigStruct.channelEnable = (1U << ADC_CHANNEL);
adcConfigStruct.channelConfig = (ADC_CFG_IDX << ADC_CHANNEL);
adcConfigStruct.triggerSource = kADC_TriggerSelectSoftware;
adcConfigStruct.convMode = kADC_ConvModeSingle;
adcConfigStruct.clock = kADC_Clock2M;
adcConfigStruct.dataFormat = kADC_ForceUnsigned;
ADC_Init(ADC, &adcConfigStruct);
ADC_GetSdDefaultConfig(&adcSdConfigStruct);
ADC_SetSdConfig(ADC, ADC_CFG_IDX, &adcSdConfigStruct);
ADC_Enable(ADC, true);