I’m trying to get the ADC FIFO to take 16 samples, save them to the FIFO and then trigger an interrupt. The code I have only works once and then I have to power cycle before it will trigger again. Here is the ADC initialization settings:
At the start of main I initialize as follows:
adcInit();
adcResetFiFo(adcREG1, adcGROUP1);
adcEnableNotification(adcREG1, adcGROUP1);
adcStartConversion(adcREG1, adcGROUP1);
The interrupt handler is below:
void saveADCSamples(ADC_DATA_STRUCT* self)
{
int i;
for(i=0; i<16; i++){
// copy the samples into our buffer
self->samples[self->currentSampleCounter][i] = adcREG1->GxBUF[1].BUF0;
}
INCREMENT_SAMPLES_WITH_WRAP(self->currentSampleCounter);
}
#pragma INTERRUPT(adcGroup1Interrupt)
void adcGroup1Interrupt(void)
{
adcREG1->GxINTFLG[1U] = 9U; // clear the interrupt flag
saveADCSamples(&ADC_Struct); // save the data
// G1IntCtrl is back to 0x10 and device should be ready to trigger again
// I’ve tried adcResetFifo here but didn’t make a difference
// Only way to enter this code again is to power cycle and apply trigger
}
My guess is that something with the DMA control is not getting set right. Also, what is G1DMACtrl it’s not documented?
Thanks for the help,
Chris