Other Parts Discussed in Thread: HALCOGEN
I am using TMS570 Hercules Dev Kit.
I am fighting with ADC (one channel), data acquisition frequency is determined by RT (e.g. 1-50kHz) and FATfs library for data acquisition (SD card slot). Everything looked fine but than I started tests with sinewaves from generator.... and .... wait where are my samples? ;/
The problem is, every 256 samples (it is constant value and it is independent from acquisition frequency) some samples are missing. I do not have any other interrupts. I checked time of code inside my interrupt and the max value is 7,0us. (rtiGetCurrentTick = 70, with closk 10M).
Here is my example data:
and my code:
if (notification == rtiNOTIFICATION_COMPARE0) { /* ADC conversion */ adcStartConversion(adcREG1, adcGROUP1); while(!adcIsConversionComplete(adcREG1, adcGROUP1)); adcGetData(adcREG1, adcGROUP1, adc_data_ptr); //Store conversion into ADC pointer value = (uint16_t)((*adc_data_ptr).value); // Convert uint16_t data into 2x BYTE dataBufferPtr[0] = (value >> 8) & 0xFF; dataBufferPtr[1] = value & 0xFF; /* Write file */ f_write(&fsrc, &dataBuffer, bufferSize, &bw); bufferFIlledCount = bufferFIlledCount + 1; dataBufferPtr = &dataBuffer; /* Check if number of conversion reached number required */ if (bufferFIlledCount == buffersToBeSaved) { /* Close the file */ res = f_close(&fsrc); } }
Where could be a problem? If it can help I can also add screenshots from my HalCoGen project.