AnsweredAssumed Answered

ADC_16 conversion occassionally fails to complete, gets stuck in waiting for COCO.

Question asked by Rande Newberry on Oct 7, 2016
Latest reply on Oct 10, 2016 by Rande Newberry

Using a custom board with MK02FN64VLH10 controller, KSDK 1.3, PE 10.6.

I have set up the ADC in the 16 bit differential mode, trigger the ADC from a PIT interrupt (every 62uS), The  Interrupt code is shown below: I take samples and stores them in arrays, as long as the arrays are not full. While samples are being taken and stored in 1 array, I am taking an FFT on the filled array. This works fine the vast majority of the time...

Problem is that after some time between 1 and 10 minutes of continuous good operation, the program gets stuck in the

ADC16_HAL_GetChnConvCompletedFlag

routine and seems to stay there. The interrupt continues to occur, so code is running OK. Since the buffers are now full, it just skips the ADC conversion and returns right back to ADC16_HAL_GetChnConvCompletedFlag  waiting for a conversion to complete...I assume.

Does anyone see anything wrong with the above code or the implementation of starting a conversion, waiting for completion, and getting the value? I tried to manually wait for the COCO bit to set, and that works OK, but has the same problem...

 

Any help would be greatly appreciated!

 

 

Thank you,

 

Outcomes