C2000 CMPSS to ePWM Trip Zone / Digital Compare connection

22 次查看(过去 30 天)
I need to configure Ti C2000 MCU (Delfino F28377S) for the overcurrent protection. I need to shut the ePWM if any of the 4 ADC channels I have connected to 4 CMPSS channels exceed their thersholds. I can see the ADC to CMPSS part working by observing Cmpss1Regs.COMPSTS.COMPHSTS register.
The configuration for the ePWM module I found on page 3-36 of this document C2000 Microcontroller Blockset User's Guide is not sufficient to make the MCU work as expected. There are several pages of configurations for CMPSS and ePWM in Target Hardware resources under Model Settings and also two tabs, Trip Zone unit and Digital Compare in each of the ePWM Type 1-4 block. Please point me to the document that has better explanation how to make the MCU shut the PWM generation (one-shot) when ADC measures counts higher than the set threshold. I will then use software reset to restart PWM when overcurrent condition is cleared.
Thanks.

回答(2 个)

Umar
Umar 2025-9-17,1:20

Hi @Valeriy,

Thank you for your detailed question regarding overcurrent protection on the Delfino F28377S MCU using CMPSS and ePWM peripherals.

Based on your description, you have successfully set up the ADC to CMPSS path, confirmed via the `Cmpss1Regs.COMPSTS.COMPHSTS` register. The next step is to configure the ePWM module to shut down PWM generation immediately when any CMPSS comparator output signals an over-threshold condition and subsequently allow software to reset the PWM once the fault clears.

Recommendations for Your Configuration

1. CMPSS Comparator Setup The Comparator Subsystem (CMPSS) consists of two comparator modules (COMPH and COMPL) which generate digital outputs based on voltage thresholds applied either externally or internally via DACs. You are correctly monitoring these digital outputs for fault detection. This usage aligns with the “Using Comparator Subsystem (CMPSS) for Voltage Compare” example, where CMPSS outputs are used as trip signals to ePWM peripherals (refer to pp. 6-62 to 6-64).

2. ePWM Trip Zone Configuration for One-Shot Shutdown The ePWM module’s Trip Zone feature is designed to immediately shut down PWM outputs when a fault condition occurs, such as an overcurrent detected by CMPSS. You should configure the Trip Zone unit to monitor CMPSS outputs as digital trip inputs. This allows one-shot PWM shutdown upon fault detection, which remains latched until cleared by software. This configuration is detailed in the Trip Zone section, pp. 3-19, along with Digital Compare on pp. 3-29 of the User’s Guide. The overall ePWM submodules, including Time-Base and ActionQualifier, are on pp. 3-2 to 3-18 for reference.

3. Software Reset for PWM Restart After the fault clears (CMPSS output returns to normal), you need to clear the Trip Zone flags and reset the ePWM module in software to restart PWM generation. This is a common fault-handling pattern for TI C2000 devices.

4. Peripheral Timer Sharing Considerations Remember that ePWM and CMPSS peripherals can share underlying timer resources, which may require careful configuration to avoid conflicts (refer to the peripheral timer sharing notes in the guide).

Summary

  • Use CMPSS digital outputs as trip signals for ePWM Trip Zone inputs.
  • Configure ePWM Trip Zone for one-shot PWM shutdown on CMPSS trip (pp. 3-19).
  • Use software to clear Trip Zone and restart PWM after fault clearance.
  • Review ePWM submodules for comprehensive configuration (pp. 3-2 to 3-29).

References

  • MathWorks, C2000 Microcontroller Blockset User’s Guide* provided by you
* Submodules of ePWM Type 1-4, pp. 3-2
* Time-Base, pp. 3-3
* Counter Compare, pp. 3-14
* ActionQualifier, pp. 3-18
* Trip Zone, pp. 3-19
* Digital Compare, pp. 3-29
* Using Comparator Subsystem (CMPSS) for Voltage Compare, pp. 6-62 to 6-64

Hope this helps.


Valeriy
Valeriy 2025-9-18,18:26
Umar,
I am not sure my EPWM X-BAR is configured correctly to take signals from 4 channels (SMPSS1, SMPSS4, SMPSS6 and SMPSS8) and pass them to TRIPIN4, TRIPIN5, TRIPIN7 and TRIPIN8. What configurations do I use to set these parameters and how can I verify that they work?
I was trying this Simulink setting but do not see that my signal from CMPSS is routed to the ePWM properly:
Next as I follow diagram on pp. 3-29 of the User’s Guide I need to route the TRIPIN signals to Digital Compare Submodule. I do not understand where in Simulink can I set DCTRIPSEL to value of 0XF as described in technical reference:
Thanks.
  3 个评论
Valeriy
Valeriy 2025-9-19,12:37
Umar,
I am not finding "Trip combination input" setting 4. to be able to set "Trip combination input" to "Enable" as you mentioned in your unswer 3. DCTRIPSEL Configuration in Simulink .
Here is my Digital Compare tab:
What am I missing?
Umar
Umar 2025-9-19,13:19
编辑:Umar 2025-9-19,13:22

Hi @Valeriy,

I've reviewed the official MathWorks C2000 documentation and your screenshots. You're absolutely correct that there's no " Trip combination input" setting visible in your Digital Compare tab. Let me provide the correct solution based on the current MathWorks C2000 Microcontroller Blockset documentation.

Reference Sources:

The Real Issue The "Trip combination input" parameter mentioned in my previous response does not exist in the current Simulink interface. This was incorrect information. Based on the official MathWorks documentation, the DCTRIPSEL = 0xF functionality is achieved through a different configuration approach.

Correct Configuration Method According to the official MathWorks documentation (specifically the Digital Compare section at

( https://www.mathworks.com/help/ti-c2000/ug/sub-modules-of-epwm-type-1-4.html#mw_54aa1f37-6ab4-49b5-b88f-d73ee6e46b7d )

here's the proper way to configure multiple TRIPIN signals for your overcurrent protection:

Step 1: Verify Your X-BAR Configuration (Already Correct) Your Target Hardware Resources configuration is correct: * TRIP4 MUX: CMPSS1_CTRIPH * TRIP5 MUX: CMPSS4_CTRIPH * TRIP7 MUX: CMPSS6_CTRIPH * TRIP8 MUX: CMPSS8_CTRIPH

Step 2: Digital Compare Configuration (The Correct Approach) Looking at your Digital Compare tab screenshot, you need to configure it as follows:

Source Configuration:

1. Source for digital compare A high signal (DCAH): Select TRIPIN4 (for CMPSS1) 2. Source for digital compare A low signal (DCAL): Keep as GPTRIPSEL or Don't care 3. Source for digital compare B high signal (DCBH): Select TRIPIN5 (for CMPSS4) 4. Source for digital compare B low signal (DCBL): Keep as GPTRIPSEL or Don't care

Event Configuration:

5. Digital compare output A event 1 selection (DCAEVT1): Select appropriate option like DCAEVT1 with sync 6. Digital compare output B event 1 selection (DCBEVT1): Select appropriate option like DCBEVT1 with sync

Step 3: The Key Insight - Multiple Digital Compare Events

Here's the critical point from the MathWorks documentation

( https://www.mathworks.com/help/ti-c2000/ug/sub-modules-of-epwm-type-1-4.html#mw_54aa1f37-6ab4-49b5-b88f-d73ee6e46b7d ):

You don't need DCTRIPSEL = 0xF to combine multiple trip inputs. Instead, you should:

1. Configure multiple Digital Compare events separately (DCAEVT1, DCBEVT1, etc.) 2. Use the Trip Zone configuration to combine these events

Step 4: Trip Zone Configuration

In your Trip Zone tab, enable:

  • Enable one-shot digital compare A event 1 (DCAEVT1): check mark
  • Enable one-shot digital compare B event 1 (DCBEVT1): check mark
  • Trip action for ePWMA: Force Low
  • Trip action for ePWMB: Force Low

Step 5: Additional TRIPIN Sources

For TRIPIN7 and TRIPIN8 (CMPSS6 and CMPSS8), you have two options:

Option A: Use Additional ePWM Modules * Configure separate ePWM modules for CMPSS6 and CMPSS8 * Link them through software coordination

Option B: Use DCAEVT2 and DCBEVT2 * Configure DCAEVT2 with TRIPIN7 as source * Configure DCBEVT2 with TRIPIN8 as source * Enable these in Trip Zone as well

According to the MathWorks documentation

( https://www.mathworks.com/help/ti-c2000/ug/sub-modules-of-epwm-type-1-4.html#mw_54aa1f37-6ab4-49b5-b88f-d73ee6e46b7d ), the Digital Compare submodule is designed to:

1. Accept external signals (your TRIPIN4, TRIPIN5, TRIPIN7, TRIPIN8) 2. Generate digital compare events (DCAEVT1, DCBEVT1, etc.) 3. Feed these events to Trip Zone for combined trip action

The Trip Zone module automatically provides the OR logic functionality that combines multiple trip sources - this is the equivalent of the DCTRIPSEL = 0xF register setting, but handled automatically by the Simulink interface.

Complete Configuration Summary

Target Hardware Resources (Already correct): * TRIP4 MUX: CMPSS1_CTRIPH * TRIP5 MUX: CMPSS4_CTRIPH * TRIP7 MUX: CMPSS6_CTRIPH * TRIP8 MUX: CMPSS8_CTRIPH Digital Compare Tab: * DCAH source: TRIPIN4 * DCBH source: TRIPIN5 * DCAEVT1 source: DCAEVT1 with sync * DCBEVT1 source: DCBEVT1 with sync

Trip Zone Tab: * Enable DCAEVT1 (OST): check mark * Enable DCBEVT1 (OST): check mark * Trip action ePWMA: Force Low * Trip action ePWMB: Force Low

For TRIPIN7 and TRIPIN8 Add these to your Digital Compare configuration: * Use DCAEVT2 source: TRIPIN7 * Use DCBEVT2 source: TRIPIN8 * Enable DCAEVT2 and DCBEVT2 in Trip Zone tab

Verification You can verify this works by checking the trip zone flags in your code:

   // Monitor trip zone flags
  Uint16 tzFlags = EPwm1Regs.TZFLG.all;
  // Check individual DC events
  Uint16 dcaevt1 = EPwm1Regs.TZFLG.bit.DCAEVT1;
  Uint16 dcbevt1 = EPwm1Regs.TZFLG.bit.DCBEVT1;

The key takeaway over here is that the modern MathWorks C2000 Microcontroller Blockset doesn't expose DCTRIPSEL register directly.

Instead, it provides a higher-level interface through the Digital Compare and Trip Zone tabs that automatically handles the underlying register configuration including the OR logic for multiple trip sources.

This approach should give you the same overcurrent protection functionality where any of your four CMPSS channels can trip the ePWM when they detect an overcurrent condition.

I apologize for the confusion in my previous response. This configuration based on the official MathWorks documentation should resolve your issue.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by