1 Reply Latest reply on Jun 6, 2017 2:01 AM by userc_38582

    ADC - FRT Timer + Scan Conversion Mode

      Hi everyone,


      i'm trying to implement a PWM, which is interconnected with the ADC. The idea is to start the conversion of the ADC in the middle of every pulse of the PWM.


      For this task i use the Multi-Function-Timer Unit (MFT) and coupled the Free Run Timer (FRT) to the ADC i want to trigger. Everything works fine so far, until i start to trigger the ADC more often as i fetch the value.


      The FRT runs with 10kHz and the Compare-Value of the ADCMP-Unit is set to the maximum value of the FRT, to trigger the ADC at the Peak of the FRT. FRT is configured to use the Up/Down Counter Mode.


      The main-program asks the ADC with 1kHz, if a value is present, fetches the value and clears the Interrupt-Flag and the Fifo:


      if (Adc_GetIrqFlag((psAdc0), (AdcScanIrq)))
        adcVal = Adc_GetScanData((psAdc0), (Adc_ReadScanFifo(psAdc0));
        Adc_ClrIrqFlag((psAdc0), (AdcScanIrq));


      In my terminal-application i can see, that the SCIF-Bit of the ADCR-Register is not being set, which is checked by Adc_GetIrqFlag, but i don't understand why. I would assume that with every call of Adc_ClrScanFifo the bit should be set after the next Conversion, which is being triggered by the FRT (The Fifo-depth is set to 1 in the Adc-Unit). If i stop the connection between the FRT and the ADC and trigger the ADC a few times by Software with Adc_SwTriggerScan and then execute the code above, it also works (SCIF-Bit is being set).


      Sure, i can just get the value of the ADC after every conversion by using the ADC-interrupt and this works just fine. But to keep the CPU-time as low as possible, i don't want the calls of the Interrupt-Subroutine with a a frequency of 10kHz. I want to get the value, when i need it and until then, the conversion should be in the background without using any CPU-time.


      Has anyone had similar issues? Any idea where the origin of the problem could be?


      Best regards