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.

LAUNCHXL-F28027F: How to stop a PWM signal by forcing the outputs to zero and how to synchronize a phase shift delay

Part Number: LAUNCHXL-F28027F
Other Parts Discussed in Thread: C2000WARE

Hello, I don't know how to stop "ePWMx" in "Idle" mode by forcing the output pins to zero and how to synchronize a phase-shift delay.

Can anyone help me ?

Bellow is my code :

1- In "B" active task, I run,

      CLK_enablePwmClock(myClk, PWM_Number_1);
      CLK_enablePwmClock(myClk, PWM_Number_2);
      CLK_disableTbClockSync(myClk);
      initEPWM1();

      initEPWM2();

             ==> in this routine, the phase-shift is imposed as follows :

                       //
                       // Set-up TBCLK
                       //
                      PWM_setPeriod(myPWM2, EPWM_PERIODE);
                      PWM_setSwSync(myPWM2);
                      PWM_setSyncMode(myPWM2, PWM_SyncMode_EPWMxSYNC);
                      PWM_setPhase(myPWM2, PhShift);
                      PWM_setCount(myPWM2, PhShift);
                      PWM_setSocAPulseSrc(myPWM1,PWM_SocPulseSrc_CounterEqualZero);
                      PWM_setSocAPulseSrc(myPWM2,PWM_SocPulseSrc_CounterEqualCmpAIncr);

==> the phase shift does not start at the same time during the infinite loop sequence.

      CLK_enableTbClockSync(myClk);

2- In "C" active task, I run,

CLK_disablePwmClock(myClk, PWM_Number_1);
CLK_disablePwmClock(myClk, PWM_Number_2);

That's the only way I found to stop the PWM, but the ePWM outputs are in HIGH or LOW state randomly ==> I would like to set them to zero.

 

Many thanks in advance for your help.

Bruno

  • Bruno,

    Please take some time and explore the Technical Reference Manual, C2000Ware, this forum, the workshop, and the following video.

    The action qualifier and the trip-zone submodules both have software controlled force conditions. The action qualifier will not work to force ePWMxA and ePWMxB low if you are using the Dead-Band module in a complementary mode, one will always remain high. In this case please use the trip-zone.

    Phase shifts are implemented by using the time-base submodule. You can connect the different instances of the PWM module with the sync chain and enable loading of the TBCTR of each module once or periodically. The exact phase shift is contained within the respective TBPHS register. All this information is detailed in the reference manual.

    Regards,
    Cody 

  • Dear Cody,

    Thank you very much for your kind advice whch is very useful to me (sorry, I am far from being an expert in these complex mechanisms).

    I found in the paragraph  "3.3.9 Controlling Zero Voltage Switched Full Bridge (ZVSFB) Converter" of the Technical Refernce Manual, a typical example of what I am looking for.

    Do you think that by using the proposed code, I will obtain the desired behavior which is :

    1- ePW1A  and ePW1B outputs low side in Idle mode,

    2- Right synchronisation of all signals in working mode.

    I don't really understand your sentence : "In this case please use the trip-zone" ; does the proposed code use this "trip-zone" ?

    Once again, thank you very much for your wise advice.

    Best regards.

    Bruno

  • Bruno,

    The code in the TRM is not intended to be compiled and ran they are only give as an general guideline. Please reference the code in C2000Ware and the Digital Power SDK.

    I don't really understand your sentence : "In this case please use the trip-zone" ; does the proposed code use this "trip-zone" ?

    If you use the dead-band submodule,  which I suspect you will, then yes please use the Trip-zone force the output to zero. If you do not use the dead-band submodule then you can use either the Action qualifier or the Trip-zone, the choice is yours.

    Regards,
    Cody 

  • Dear Cody,

    Based on your advice, I coded a new version of sofware and everything is working much better now, thank you.

    One last thing is still missing for me : how to use the "Trip-zone" operation to switch to idle mode and force the outputs to zero : have you any guideline description on this specific topic ?

    Thanks in advance for your help.

    Best regards.

    Bruno

  • Bruno,

    The tripzone software force should work for your purpose. "TZFRC" is described in the Technical reference manual. It can be used to force an event to happen once you setup the event you want to control your output.

    Please note that if you are using the TZ submodule please make sure to change all actions in the TZ to "do nothing", they default to "high-z". This can cause unexpected issues.

    Additionally you may find this post helpful: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/761550/tms320f28375s-tzctl---are-trip-zone-configurations-redundant 

    The above post is for another device with a few new features, but the problem can happen on F28027 as well when setting it up.

    Regards,
    Cody 

  • Hello Cody,

    I tried to make a "TZT interrupt software" work, without success. I guess the problem is that I'm already using a hardware TZT interrupt in my application and I suppose I cannot cumulate "software" and "hardware" interrupts on the same module (is my interpretation correct ?).

    But I ended up solving the problem in the following way :

    1- I created a "User software interrupt":

    • PieVectTable.USER1 = &user1_ISR;(This interrupt can be called at anytime with the command : __asm(" TRAP #20");

    2- The content of the ISR routine is as follows:

    • __interrupt void user1_ISR(void)
      {
      temp1++;
    • EPwm1Regs.DBCTL.bit.OUT_MODE = 0; // fully disable the dead-band submodule of ePWM1
                                                                          // ==> clear the output ePWM1B
      EPwm2Regs.DBCTL.bit.OUT_MODE = 0; // fully disable the dead-band submodule de ePWM2
                                                                          // ==> clear the output ePWM2B
      EPwm1Regs.CMPA.half.CMPA = 0;          // set 0% fixed duty for EPWM1A
      EPwm2Regs.CMPA.half.CMPA = 0;          // set 0% fixed duty for EPWM2A
      }

     By doing this, all the ePWMx outputs are well set to zero in Idle mode.

    Thanks again for your time and advice.

    Best regards.

    Bruno