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.

CCSTUDIO-C2000: Sampling and nyquist criterion in C2000 MCU with PWM triggered ADC samples

Part Number: CCSTUDIO-C2000

Hello again!

In many examples in C2000, I have noticed that the ADC's are set to use the PWM signals that are output, as triggers to take new samples. 

AdcaRegs.ADCSOC1CTL.bit.CHSEL = 2; // SOC1 will convert ADCINA2
AdcaRegs.ADCSOC1CTL.bit.ACQPS = 19; // SOC1 will use sample duration of 20 SYSCLK cycles
AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 5; // SOC1 will begin conversion on ePWM1 SOCA

My question is, if we take a sample only once every PWM cycle, is it possible we would run into aliasing issues, since we are not sampling at the required twice every switching period? 

Is there some way in software we can define the number of samples that are taken on every PWM signal, so we can sample 2-3x faster than this? 

Thanks!
Joel

  • Hi Joel,

    That's a very good question. I can give you an example corresponding to this. Say we have a DC DC converter with switching frequency 10kHz and output frequency of 50/60Hz. You sample the output current which will be at a much lower frequency than the switching frequency. In that case, this configuration will not end up creating any issues.

    For any other application where you have a problem that you run into aliasing, you can always use 2 PWM outputs, one for sampling the ADC and other for operating the switches.

    Thanks,

    Aditya

  • Hi Aditya, 

    Thanks for your response. I am unsure what you mean with the above points, since a DC/DC converter will not have an output frequency of 50/60Hz - maybe you mean an inverter? But I agree with the sentiment.

    With regard to the second point, in this arrangement the signal of interest is still only sampled at the switching frequency, unless we run one of the PWM outputs at twice the switching frequency. But at that point, we may as well just set-up a free timer to generate an interrupt to sample the ADC's at twice the frequency of the PWM and save that extra module.

    I apologise if my question was unclear!

  • Hi Joel,

    Really sorry. You caught that absolutely right. I meant to convey about an inverter. Slight smile

    With regard to the second point, in this arrangement the signal of interest is still only sampled at the switching frequency, unless we run one of the PWM outputs at twice the switching frequency. But at that point, we may as well just set-up a free timer to generate an interrupt to sample the ADC's at twice the frequency of the PWM and save that extra module.

    Yes, sure. Timer also will work perfectly fine. Anyways CPU won't be used up using either of the modules, PWM/TIMER. It depends on what application you use. For your case, both should satisfy the need. 

    Thanks,

    Aditya

  • Hi Joel,

    Since we haven't heard back from you, I believe this query has been resolved. I am marking this thread as resolved for now. Incase, you still have any questions, feel free to mark it as not resolved and continue the thread. If this thread locks, you can ask a new question.

    Thanks,

    Aditya