This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F28379D: ADC and CLA synchronization

Part Number: LAUNCHXL-F28379D

Hello,

i am trying to write a Program where a sample is taken which then gets analyzed by the cla and controls the duty cycle of the ePWM module. I am trying to get as fast as possible while maintaining stable execution.

Since i am not an expert at dsp programming i use MATLAB and Simulink to create the code.

At the moment, ePWM1 is used to trigger the SOC of the ADC. The EOC event triggers the CLA and another ISR in the cpu which writes the ADC result to the CPUtoCLA register. The CLA then reads the result from CPUtoCLA register and updates the duty cycle of ePWM3. I guess the mistake here is that the CLA should read the ADC result directly without using the CPUtoCLA register. But other than that it seems like a good solution to me. Could anybody confirm this please?

I think a good advantage would be that the CLA can run in parallel for the first half of the ADC acquistion time so a higher accuracy can be achived without additional delay?

Am i right that the ADC aquisition runs parallel to the cpu so that the cpu is able to execute other tasks? So in the above scenario, with direct access for the CLA to the ADC result, the cpu would only have to deal with the ePWM1 interrupt for SOC of the ADC?

And one last question where i havent found any info yet, is there any advantage or is it even possible to start SOC inside the CLA and wait for the result before further processing? I don´t think this is a good solution but can it be done?

Thank you!

Best Regards

Martin R.

  • Martin Reus32 said:
    At the moment, ePWM1 is used to trigger the SOC of the ADC. The EOC event triggers the CLA and another ISR in the cpu which writes the ADC result to the CPUtoCLA register. The CLA then reads the result from CPUtoCLA register and updates the duty cycle of ePWM3. I guess the mistake here is that the CLA should read the ADC result directly without using the CPUtoCLA register. But other than that it seems like a good solution to me. Could anybody confirm this please?

    Martin,

    Yes, the CLA can read the ADC result directly.  There is no reason to go through the C28x CPU. 

    Martin Reus32 said:
    I think a good advantage would be that the CLA can run in parallel for the first half of the ADC acquistion time so a higher accuracy can be achived without additional delay?

    Having the CLA read the result register directly will reduce the delay.  The CLA is typically idle and waiting for a task to be triggered.  Whereas the C28x may be busy and not start an interrupt for a given time.  Reading the result directly will also avoid the context save on the C28x plus copying to the shared RAM. 

    The ADC offers the option to generate an early interrupt pulse at the start of a sample conversion. If this option is used to start an ADC-triggered CLA task, the user may use the intervening cycles, until the completion of the conversion, to perform preliminary calculations or loads and stores before finally reading the ADC value.  This is described in the CLA chapter of the Technical Reference Manual (TRM) (ref: ADC Early Interrupt to CLA Response).

    Martin Reus32 said:
    Am i right that the ADC aquisition runs parallel to the cpu so that the cpu is able to execute other tasks? So in the above scenario, with direct access for the CLA to the ADC result, the cpu would only have to deal with the ePWM1 interrupt for SOC of the ADC?

    Yes, correct.  The ADC, C28x and CLA all run in parallel.  Note that the SOC can be started directly from the ePWM, the CPU doesn't have to do anything. Refer to the ADC chapter in the TRM (ref: Trigger Operation)

    Martin Reus32 said:
    And one last question where i havent found any info yet, is there any advantage or is it even possible to start SOC inside the CLA and wait for the result before further processing? I don´t think this is a good solution but can it be done?

    I suggest having the PWM trigger the SOC directly.  Then the ADC triggers the CLA. 

    Regards

    Lori

  • Thank you very much for this perfect answer. For some reason i can´t mark it resolved but this definitly did answer my question.

    I now have ePWM triggering the ADC SOC which then triggers the CLA. CLA reads the ADC result directly withut any CPU interaction. CPU is completly free for communication.