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-F28379D: ePWM Trip Zone issue

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE, CONTROLSUITE

Hello,

I am trying to program the ePWM Trip Zone using a LAUNCHXL-F28379D development board. I would like to set a GPIO pin to trip the PWM outputs in case of a fault. I have set the GPIO32 pin to input and set it to feed TZ1 using Xbar. I have also enables the TZSEL.bit.OSHT1 as a one shot trip source to just trip the converter until resetting. TZCTL.bit.TZA was set to force low. However applying a High (3.3V) to input pin GPIO32 is not stopping the PWM output. I must have missed something. Can someone kindly offer some help, please?

Thanks

  • Hi,

    Trip zone is active low input.

    You can refer to example here -
    C:\ti\c2000\C2000Ware_2_00_00_03\driverlib\f2837xd\examples\cpu1\epwm
    epwm_ex1_trip_zone

  • Thanks for the reply.

    I have already seen the example. I have set all registers but still it is not working. Tried it with both active high and low inputs, and still the PWM output was not forced to low.

  • Hi,

    When you run the example as it is, does it work? Do you see any issues with example as well?

  • I have set the below registers and bits:

    For GPIO:

    GpioCtrlRegs.GPBGMUX1.bit.GPIO32 = 0;

    GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 0;

    GpioCtrlRegs.GPBDIR.bit.GPIO32 = 0;  //Set as input

    GpioCtrlRegs.GPBINV.bit.GPIO32 = 1;   //Invertered because circuit connected gives a high on fault

    Xbar:

    InputXbarRegs.INPUT1SELECT = 32;  // Feed GPIO32 to ePWM[TZ1]

    In PWM settings:

    EPwm1Regs.TZSEL.bit.OSHT1 = 1; //Enable TZ1 as one shot trip

    EPwm1Regs.TZCTL.bit.TZA = 2; // Force PWM low

    EPwm1Regs.TZEINT.all = 0x0000;  // Trip Zone Interrupt Disabled

    Did I miss something, please?

  • Subrahmanya said:

    Hi,

    When you run the example as it is, does it work? Do you see any issues with example as well?

    The example does not run since it seems that it references a lot of functions not in the project.

  • Dan8 said:

    I have set the below registers and bits:

    For GPIO:

    GpioCtrlRegs.GPBGMUX1.bit.GPIO32 = 0;

    GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 0;

    GpioCtrlRegs.GPBDIR.bit.GPIO32 = 0;  //Set as input

    GpioCtrlRegs.GPBINV.bit.GPIO32 = 1;   //Invertered because circuit connected gives a high on fault

    Xbar:

    InputXbarRegs.INPUT1SELECT = 32;  // Feed GPIO32 to ePWM[TZ1]

    In PWM settings:

    EPwm1Regs.TZSEL.bit.OSHT1 = 1; //Enable TZ1 as one shot trip

    EPwm1Regs.TZCTL.bit.TZA = 2; // Force PWM low

    EPwm1Regs.TZEINT.all = 0x0000;  // Trip Zone Interrupt Disabled

    Did I miss something, please?

    Hello,

    Anything missing in my code, please?

  • Hi,

    Dan8 said:
    Anything missing in my code, please?

    Configuration looks correct.

    That's the reason i'm suggesting you try out the example. All the dependent files should be part of the C2000Ware.

    Are you using controlSuite based code? If so, example can be found here.
    C:\ti\controlSUITE\device_support\F2837xD\v210\F2837xD_examples_Cpu1\epwm_trip_zone

  • Subrahmanya said:
    Configuration looks correct.

    That's the reason i'm suggesting you try out the example. All the dependent files should be part of the C2000Ware.

    Are you using controlSuite based code? If so, example can be found here.
    C:\ti\controlSUITE\device_support\F2837xD\v210\F2837xD_examples_Cpu1\epwm_trip_zone

    Hi,

    I am trying to debug the example. What do I need to monitor to see the code working? Also I do not think I have access to pin GPIO12 from the development board contacts.

  • Hi,

    Were you able to resolve this issue?
    As mentioned in the testcase header, You can monitor

    //! - EPWM1A is on GPIO0
    //! - EPWM2A is on GPIO2
    //! - TZ1 is on GPIO12

  • Subrahmanya said:

    Hi,

    Were you able to resolve this issue?
    As mentioned in the testcase header, You can monitor

    //! - EPWM1A is on GPIO0
    //! - EPWM2A is on GPIO2
    //! - TZ1 is on GPIO12

    Unfortunately no, I cannot access GPIO12 from my development board. In addition I would like to set TZ1 on GPIO32 but it is not working.

  • Hi,

    Xbar:

    InputXbarRegs.INPUT1SELECT = 32;  // Feed GPIO32 to ePWM[TZ1]

    This should have addressed the change needed from GPIO12 to GPIO32.
    Is there anything else on your application board driving GPIO32?

    It would be good if you can run the test (example) and have it working for easier debug. 

  • Subrahmanya said:

    Hi,

    Xbar:

    InputXbarRegs.INPUT1SELECT = 32;  // Feed GPIO32 to ePWM[TZ1]

    This should have addressed the change needed from GPIO12 to GPIO32.
    Is there anything else on your application board driving GPIO32?

    No nothing else is connected to that input.

  • Hi,

    Do you have any other hardware platform like a controlCard/docking station or so?
    Also, could you check with some other GPIO other than GPIO32?
    Since the test case configuration is pretty straightforward - I do not see any this incorrect in the code you sent above.
    How do you plan to close this? It may be easier to narrow down the problem if you get a working set up with the example as is and no additional h/w.


  • Subrahmanya said:

    Hi,

    Do you have any other hardware platform like a controlCard/docking station or so?
    Also, could you check with some other GPIO other than GPIO32?
    Since the test case configuration is pretty straightforward - I do not see any this incorrect in the code you sent above.
    How do you plan to close this? It may be easier to narrow down the problem if you get a working set up with the example as is and no additional h/w.

    Yes I tried with other GPIO inputs and it is the same.

  • Hi,

    Can you also respond to other questions in the previous post?

    Do you have any other hardware platform like a controlCard/docking station or so?
    Also, could you check with some other GPIO other than GPIO32?
    Since the test case configuration is pretty straightforward - I do not see any this incorrect in the code you sent above.
    How do you plan to close this? It may be easier to narrow down the problem if you get a working set up with the example as is and no additional h/w.

  • Subrahmanya said:

    Hi,

    Can you also respond to other questions in the previous post?

    Do you have any other hardware platform like a controlCard/docking station or so?
    Also, could you check with some other GPIO other than GPIO32?
    Since the test case configuration is pretty straightforward - I do not see any this incorrect in the code you sent above.
    How do you plan to close this? It may be easier to narrow down the problem if you get a working set up with the example as is and no additional h/w.

    I have only the Launchpad (more than one - tried them with same issue). As stated earlier I have tried with different GPIO pins and still the Trip zone does not work. To test if the change on the pin is being seen by the ucontroller, I have also enabled the interrupt caused by the Trip zone to switch off an LED on the Launch pad but it does not switches off. Meaning that the Trip zone is not being recognized.

    Regarding the sample example program, it is giving me an error on compiling due to the need of files or functions that are not available in the project. Which I cannot find in Code Composer. There is also the issue of GPIO12 which is not available on the header pins on the Launch pad, but that can be changed to another pin.

    For now I am testing without any additional hardware. I am just trying to cause a trip event by providing 3V or 0V to GPIO32 using the Launch pad header pins. In the end I need to attach the Launch pad on another PCB to operate a converter. The trip event is needed to switch off the PWM in case of a fault in the converter, causing the pin to go to high.

  • Hi,

    Dan8 said:
    Regarding the sample example program, it is giving me an error on compiling due to the need of files or functions that are not available in the project. Which I cannot find in Code Composer. There is also the issue of GPIO12 which is not available on the header pins on the Launch pad, but that can be changed to another pin.


    Starting with the example program is easier as we have the common reference for debugging.
    Could you please let me know the errors you are getting when you import the program?
    If you've used a different location for installing the software, you may need to change some path settings.
    Let's try to figure out the CCS error. Please post a screen shot of the errors.
    Also, make sure that all the path variables are correct under (right click project, Properties --> Reosurce --> Linked Resources --> Path Variables and Linked Resources).

  • Hi,

    Have you been able to capture some screenshots of the CCS error you are seeing (if you are still facing this issue)?

    Best,

    Marlyn

  • Marlyn Rosales Castaneda20 said:

    Hi,

    Have you been able to capture some screenshots of the CCS error you are seeing (if you are still facing this issue)?

    Best,

    Marlyn

    There is no errors listed, the Trip zone is not working, and I am still with the problem after weeks. Can someone offer some support, please? This is needed for a prototype.

  • Hi,

    I've checked the example again on LAUNCHXL_F28379D by changing the GPIO12--> to GPIO32 and GPIO11 --> GPIO19 as per your use and to make use of the GPIOs are available on Launch Pad. This test works as expected and PWM is tripped.

  • Subrahmanya said:

    Hi,

    I've checked the example again on LAUNCHXL_F28379D by changing the GPIO12--> to GPIO32 and GPIO11 --> GPIO19 as per your use and to make use of the GPIOs are available on Launch Pad. This test works as expected and PWM is tripped.

    I do not know what is happening. I think I have everything set up correctly. I will give it another go and get back.

  • Hi,

    Sure - please try and debug. This is fairly basic configuration and a simple test case.

  • By any chance is Trip Zone 1 TZ1 only available on GPIO12?

  • Hi Dan,

    I find it odd you are not enabling the trip zone interrupt. So how do you intend to clear the latched fault GEN condition if not by the fault INT handler?

    TM4C1294 MCU has GenModeFaultNoMinper being latched fault condition, FaultMinper rest timeout register determines how long disabled GEN output condition takes.

  • BP101 said:

    Hi Dan,

    I find it odd you are not enabling the trip zone interrupt. So how do you intend to clear the latched fault GEN condition if not by the fault INT handler?

    TM4C1294 MCU has GenModeFaultNoMinper being latched fault condition, FaultMinper rest timeout register determines how long disabled GEN output condition takes.

    I was thinking of resetting the MCU manually.

  • Hi,

    No, any GPIO can be used as trip zone input.
    If you've gone through the example code, device documentation you would notice that any GPIO can be configured via InputXbar as Trip input.
    Also I mentioned above that the example is tested with GPIO32 as well.
    Thank you.

  • Hi,

    Please look through the example code.
    Interrupts are enabled.

    Interrupt_register(INT_EPWM1_TZ, &epwm1TZISR);
    Interrupt_register(INT_EPWM2_TZ, &epwm2TZISR);

  • Was not enabled in his posted code beginning of thread. He could not get the example to compile with the F28379 as I read many times Dan tired.

  • Point is unless you have scope set on single capture you may miss the Fault event ever occurring if there is no latch enable or timeout being set for Minper.

  • EPwm1Regs.TZSEL.bit.OSHT1 = 1; //Enable TZ1 as one shot trip

    How long is the one shot fault trip set for?

  • BP101 said:
    1
    EPwm1Regs.TZSEL.bit.OSHT1 = 1; //Enable TZ1 as one shot trip

    How long is the one shot fault trip set for?

    I understood that a one shot trip is until MCU reset. Or no?

  • Hi,

    Dan8 said:
    I understood that a one shot trip is until MCU reset. Or no?


    No need to reset the device. You can clear the flag via s/w - EPwm1Regs.TZCLR.bit.OST



  • So it's a latched one shot PWM trip zone by default? Such odd syntax makes for some crazy coding in C2000, simply judging from the labs structures.

  • Hi,

    No - it's not default. you need to enable trip zone as One Shot - if that's what is intended for your application.

  • For TM4C1294 we have to specify the gen fault behavior is latched (Minper) or a timed fault auto recovery (NoMinper). I was told that had become an industry standard of ePWM modules. So C2000 PWM generators enabled one shot tip zones are NoMinper (latched), otherwise default Minper without one shot trip zone enabled?

    Anyway if trip zone is not latched in some way the event may occur so rapidly it can be easily missed via scope set to auto trigger mode.   

  • Interesting flags the ePWM has trip zones much like Minper/NoMinper. And not very well documented but it seems the fault type/mode has to be configured in each module? Perhaps TZLCTL is a key register for the fault mode? The CBC cycle by cycle seemingly is NoMinper... 

    f28004x_epwm.h

        union   TZSEL_REG                        TZSEL;                        // Trip Zone Select Register
        Uint16                                   rsvd24;                       // Reserved
        union   TZDCSEL_REG                      TZDCSEL;                      // Trip Zone Digital Comparator Select Register
        Uint16                                   rsvd25;                       // Reserved
        union   TZCTL_REG                        TZCTL;                        // Trip Zone Control Register
        union   TZCTL2_REG                       TZCTL2;                       // Additional Trip Zone Control Register
        union   TZCTLDCA_REG                     TZCTLDCA;                     // Trip Zone Control Register Digital Compare A
        union   TZCTLDCB_REG                     TZCTLDCB;                     // Trip Zone Control Register Digital Compare B
        Uint16                                   rsvd26[5];                    // Reserved
        union   TZEINT_REG                       TZEINT;                       // Trip Zone Enable Interrupt Register
        Uint16                                   rsvd27[5];                    // Reserved
        union   TZFLG_REG                        TZFLG;                        // Trip Zone Flag Register
        union   TZCBCFLG_REG                     TZCBCFLG;                     // Trip Zone CBC Flag Register
        union   TZOSTFLG_REG                     TZOSTFLG;                     // Trip Zone OST Flag Register
        Uint16                                   rsvd28;                       // Reserved
        union   TZCLR_REG                        TZCLR;                        // Trip Zone Clear Register
        union   TZCBCCLR_REG                     TZCBCCLR;                     // Trip Zone CBC Clear Register
        union   TZOSTCLR_REG                     TZOSTCLR;                     // Trip Zone OST Clear Register
        Uint16                                   rsvd29;                       // Reserved
        union   TZFRC_REG                        TZFRC;                        // Trip Zone Force Register
        Uint16                                   rsvd30[8];                    // Reserved
        union   ETSEL_REG                        ETSEL;                        // Event Trigger Selection Register

  • Hi,


    BP101 said:
    And not very well documented but it seems the fault type/mode has to be configured in each module?


    Yes - each module has individual configuraiton for the fault type/mode. This gives flexibility of trip configuration depending on the application.

    BP101 said:
    TZLCTL is a key register for the fault mode?

    Yes - TZCTL, as you can see in the TRM, determines the action on PWM output for the corresponding trip signal.