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.

phase shift control and frequency control with TMS320F28027

Other Parts Discussed in Thread: TMS320F28027

hi,

I am trying to use TMS320F28027 for an application where i need to do frequency control and phase shift control at the same time.This means that i want to change the TBPRD and TBPHS register in every cycle.i followed few examples shown in the datasheet.I used EPWM2 to generate a SYNCOUT signal at CTR=0.This signal was used to as SYNCIN for EPWM3. TBPRD is same for both EPWM2 and EPWM3 and is updated every cycle at CTR=0. EPWM3 is phase shifted from EPWM2.

Following are my observations:

1)when i tried to change both TBPRD and TBPHS. I observed that EPWM2 works properly by showing proper duty cycle while EPWM3 at some instances shows a low for several cycles on EPWM3A and a high on EPWM3B even when both EPWM2 and EPWM3 have same duty cycles and switching frequency

2)when i change TBPRD but keep TBPHS constant,i see the same problem

3)when i keep both TBPRD and TBPHS constant,i see a proper phase shift between EPWM2 and 3 and no instances where EPWM3A goes low for several cycles which means every thing works properly.

Can you suggest where am i going wrong?or what extra i can do to avoid this problem?Can this chip be used to do change frequency and phase  both at the same time?

Thanks

Misha

  • Hi Misha,

    Please go through this doc, this will clear all your doubts!

    http://www.ti.com/lit/ug/spruge9e/spruge9e.pdf

    Regards,

    Gautam

  • hi,

    Thanks for your reply.I have gone through the ePWM reference guide several times but havent found an example where  frequency (TBPRD) and the phase(TBPHS) are changed at the same time.Can you please point at one particular example?

    Also,what is the difference between writing EPwm2Regs.TBPHS=300 and EPwm2Regs.TBPHS.half.TBPHS=300??(as written in an example on pg 99 of the above document)

    Thanks

    Misha

  • Hi Misha,

    I have gone through the ePWM reference guide several times but havent found an example where  frequency (TBPRD) and the phase(TBPHS) are changed at the same time.

    -> TBPRD is setting the period and TBPHS is phase differentiation. You can use them simultaneously, no issues. May be there might be no sample code but can implement them. 

    eg. 

    EPwm2Regs.TBPRD = 450;                                        // Period = 900 TBCLK counts
    EPwm2Regs.TBPHS.half.TBPHS = 300;                 // Phase = 300/900 * 360 = 120 deg

    hat is the difference between writing EPwm2Regs.TBPHS=300 and EPwm2Regs.TBPHS.half.TBPHS=300??

    -> Here is an example:

    1. EPwm2Regs.TBPHS.half.TBPHS = 300;                 // Phase = 300/900 * 360 = 120 deg

    2. EPwm2Regs.TBPHS = 1200-300;                           // Set Phase reg to 300/1200 * 360 = 90 deg

    I hope your doubts are clear!

    Regards,

    Gautam

  • Hi,

    I am sorry.May be the question was not clear enough.I meant to ask what does it mean when you write in C code

    EPwm2Regs.TBPHS.half.TBPHS = 300 and

     EPwm2Regs.TBPHS = 1200-300;

    In other words what is the difference when you write TBPHS.half.TBPHS and just TBPHS?Why sometimes EPwm2Regs.TBPHS.half.TBPHS = 300 is written and sometimes   EPwm2Regs.TBPHS = 1200-300;is written??

    Also,are you saying that TBPRD and TBPHS can be simultaneously updated in every interrupt cycle?I know that they can be simultaneously configured once in initialization

    Can you please post an example code where TBPRD and TBPHS are simultaneously updated in code?

    Thanks

    Misha                   

  • Hi Misha,

    As you mentioned, TBPRD and TBPHS can be updated only during initialization.  Updating them in every interrupt cycle, I've never seen such examples.  

    Using  TBPHS.half.TBPHS and just TBPHS depends upon your implementation; though the results are the same! So use whichever you feel like.

    Regards,

    Gautam