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.

ADC result does not follow real output

Hi,

I am using a F28027 Piccolo Launchpad and the ISR frequency I selected is 10kHz. I then interface a motor phase to one of the ADCs to convert motor voltage into digital form. I use the graph tool in CCS to observe the measured waveform. The shape of the waveform is exactly the same as measured by oscilloscope, but the period of the waveform is somehow wrong. In the grapg tool, I use a buffer of size 800 and the sampling rate is 10000 to correspond to the ISR frequency. Are there any possible reason that would cause the error?

Thank you.

Jingzhe

  • Hi Jingzhe,

    Can you be a little more specific with exactly how the period of the graphed waveform differs from expectation?  Is it just nonsense, or off by say a factor of 2?

    One thing you might check is whether the sample rate is as expected.  If using an ePWM timer, you could enable the ePWM output to a pin and observe the frequency on a scope.  Alternately, you could toggle a GPIO in the ISR.  

  • Hi Devin,

    Thanks for the reply. The period of the waveform I expected is 30ms but when I plotted in CCS, it became 18ms, therefore it is scaled by a factor of 0.6. The only reason I can think of is that the real ISR frequency is 6kHz rather than 10kHz as I thought.

    I thought the ISR frequency is 10kHz is because in Project-Settings.h, I set the variable ISR_FREQUENCY to be 10kHz, but obviously the real ISR frequency is not determined by this variable. How can I tell the actual ISR frequency? It should be determined by some registers in ePWM, where should I look at?

    Thanks.

    Jingzhe

  • Hi Devin,

    I re-examined the codes. Presumably the ISR is triggered by EPWM and the interrupt frequency is determined by  EPwmxRegs.TBPRD = pwm.PeriodMax.

    PeriodMax  is then defined by        pwm.PeriodMax = SYSTEM_FREQUENCY*1000000*T/2.

    SYSTEM_FREQUENCY in my case is 100MHz and T is determined by ISR_FREQUENCY = 10kHz.

    It is weird since I already defined the ISR interrupt frequency is 10kHz, why is the graph output does not look like 10kHz?

    My device is F28027. Is the SYSTEM_FREQUENCY wrong in my case?

    Jingzhe

  • Jingzhe,

    I don't think system frequency is 100MHz. The max speed F28027 is rated for is 60MHz.