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.

ePWM signal and ADC data Synchronization

Other Parts Discussed in Thread: TMS320F28335

Hi, I am using a DSC TMS320F28335.

I have used the ePWM to provide a sinewave. Now have to sample with the ADC another sinewave and multiply them together.

These two sinewaves are not in phase, and before multiply them I need that they have to be in phase. How could I do?

( I am refering to the app note http://www.ti.com/lit/an/spra946/spra946.pdf but it use the PWM instead of ePWM)

Thank you.

  • Is the phase between the sine waves fixed? 

    If the phase offset is fixed, you can set the ADC to sample at the same point (in terms of phase) on each sine wave.  This is because you know the timing of the PWM modules so you can set the ADC sampling point exactly.

  • Thank you very much for your reply!

    Yes, it is  fixed, but I would like check every period if I am doing the multiply in phase, becouse I don't want that an error could being accumulate every period.

    To do this I have in mind the following method:

    I am generating the first sinewave that I have to multiply from the ePWM. I want to start a conversion every time that I am in the ePWM ISR. So I know the phase of the first sinewave.

    The second sinewave, that is connected to the ADC, has the same frequency of the first one, but is sampled with a phase shift (in late). I can wait every period that the second sinewave cross the zero, so I know directly where I am.

    Is it a good idea for you?

  • Alessandro,

    FYI, regarding your original post, the PWM mentioned in the document referrs to the ePWM module found on the C2000 MCU devices. 

    After your explanation, I see what I suggested does not apply to you.  What I suggested works best when both sine waves are generated by the ePWM module, which is not your situation.

    In your situation, the second sine wave is a signal you want to sample with unknown phase delay.  Using the zero-crossing point to determine the phase delay is certainly one way. 

    I took a closer look at the app note and the software and algorithms discussed in the document all apply to the F28335 device as well.  Both the F2812 and F28335 are C2000 devices and are code compatible.

    Regards,
    Daniel

  • If you are interested, I can have the author send you the code he used.

  • Thank you very much for your interest, I have already asked the code and I have had, I have tried it, but it doesen't compile!

    So I am re-writing it! I don't understand if the author of the article do the same as I want to do, that is wait a zero-crossing to understand every time the phase shift.

    Have you understood his method for reveal the phase shift?