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.

TMS320F2800157-Q1: Phase shift direction will influence shift time

Part Number: TMS320F2800157-Q1

Hi experts,

 

Good day! I am asking for customer.

My customer is testing F2800157 with launchpad and found that EPWM phase shift direction will influence shift time.

Here is the test description:

The EPWM3 zero point generates a synchronous signal, EPWM1 and EPWM2 has phase shift based on EPWM3 sync signal. The EPWM1 phase shift value is 48 and the EPWM2 phase shift value is 40 

 

Test1: 

EPWM1: phase shift 48 , Count down after sync event

EPWM2: phase shift 40 , Count up after sync event

EPWM1->EPWM3: 418ns

image.png

EPWM2->EPWM3:314

image.png

 

Test 2: 

EPWM1: phase shift 48 , Count down after sync event

EPWM2: phase shift 40 , Count down after sync event

 

EPWM1->EPWM3: 418ns

image.png

 

EPWM2->EPWM3: 352ns

image.png

 

From the above test, it can be seen that when the shift values are the same but the shift direction is different, the results of the shift will be different. "Count down direction" will cost 4.5 cycles then "Count up direction".

Customer has following questions:

  1. Why the phse shift direction will cause time difference based on EPWM2 result?
  2. How is the phase shift time calculation formula with different directions?

I attach the test code here. You can use this for testing. 2800157_PhaseShiftTest.zip 

Best Regards

Kita

  • Hi Kita,

    What I am seeing here is expected. Please refer to the below diagram. 

    Yes the results of the shift are different due to the direction in which the counter will start counting from. If counting up after sync vs counting down after sync.

    Below is the theoretical waveform when the following assumption is made.

    All ePWM's in up/down counter mode

    TBPRD is 500

    CMPAU = 250, CMPAD = 250 (symmetric waveform)

    Counter direction for ePWM1A is count down after sync event.

    Counter direction for ePWM3A is count up after sync event.

    Test1: 

    EPWM1: phase shift 48 , Count down after sync event

    EPWM2: phase shift 40 , Count up after sync event

    EPWM1->EPWM3: 418ns

    As you can see the difference between ePWM1A and ePWM3A is going to be 48 + 2(delay) = 418ns which they have documented.

    Trying to attach an image, apologize if it's too small.

    Best regards,

    Ryan Ma

  • Hi Ryan,

    My question is on EPWM2 result. 

    phase shift 40 , Count up after sync event: EPWM2->EPWM3:314

    phase shift 40 , Count down after sync event: EPWM2->EPWM3: 352ns

    I am still not clear why phase direction will cause 4 cycle difference with same phase shift value. Could you help to explain the root cause? And what's shift time calculation formula with different phase shift direction?

    Best Regards

    Kita

  • Hi Kita,

    Assuming TBPHS = 40 for both ePWM1/2.

    If ePWM2 is count up after sync then you should see something close to TBPHS - 2(since there is the sync delay). 

    So time between ePWM2A's rising edge to ePWM3A's rising edge should be ~= 316.7 ns (You are seeing 314 ns) 

    Because it's count up after sync, the counter will start incrementing technically from TBPHS + 2 (delay of sync) and cause the edge to actually happen earlier. To account for this, set TBPHS = 38 instead. 

    IF ePWM2 is counting down after sync event then you should see something close to TBPHS + 2 again because of the delay.

    So time between ePWM2A's rising edge to ePWM3A's rising edge should be 40 + 2 ~= 350ns.

    Because it's count down after sync, the counter will start incrementing technically from TBPHS + 2 (delay of sync) and cause the edge to actually happen later. To account for this set TBPHS = 42. (42, 41, 40 etc)

    This is why you're seeing delta of 4ns.

    So to fix this, ensure you're accounting for the 2 cycle delay occurring on count up or count down respectively.

    Best regards,

    Ryan Ma