I'm testing ADC interrupt performance on a TMS570LS31 HDK. As first test the ADC is single triggered by RTI compare 0. The ADC1 Event group FIFO is set to 64 samples and the interrupt function is called (using threshold interrupt) every 32 sample. The test should measure the maximum frequency on which the ADC data can be discharged in the interrupt without goiing in the overrun condition.
in the main:
// setup a ADC interrupt every half FIFO
adcREG1->GxINTENA[0] = 0x01; // enable threshold interrupt
adcREG1->GxINTCR[0] = 0x20; // threshold value
// enable overwrite on memory overrun
adcREG1->GxMODECR[0] = adcREG1->GxMODECR[1U] | 0x10U;
/** - Start Conversion */
adcREG1->GxSEL[0] = 0x00000001U;
// start the RTI to trigger ADC (setup done in Halcogen)
rtiInit();
rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
rtiStartCounter(rtiCOUNTER_BLOCK0);
_enable_IRQ();
in the adc1Group0Interrupt I simulate the FIFO data access and test overrun flag:
for (i=0;i<32;i++){
val = (uint8)( adcREG1->GxBUF[0].BUF0 & 0xFFU);
}
//sleep(10000000);
// test overrun flag and output a debug message
if (adcREG1->GxINTFLG[0]&0x2U){
// overrun - output a message
}else{
// no overrun
}
The problem here is that even if I uncomment the sleep (approx 1sec) the following overrun test does not verify overrun, but clearly it should because during sleep, at the current frequency (1KHz) the FIFO buffer must be fullfilled.
Where is the error?
There is something more to do to enable overrun flag?
thank you