C2000 CMPSS to ePWM Trip Zone / Digital Compare connection

34 Ansichten (letzte 30 Tage)
Valeriy
Valeriy am 16 Sep. 2025 um 21:04
Kommentiert: Valeriy vor etwa 19 Stunden
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.

Akzeptierte Antwort

Valeriy
Valeriy vor etwa 16 Stunden
It appears that ePWM X-Bar configurations have limited functionality in the R2024b version of C2000 Blockset. I was able to achieve the desired result by configuring the registers directly.

Weitere Antworten (2)

Umar
Umar am 17 Sep. 2025 um 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 am 18 Sep. 2025 um 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.
  6 Kommentare
Umar
Umar vor etwa 9 Stunden

Hi @Valeriy,

I just saw your latest update about getting the overcurrent protection working on your F28377S. Honestly, your approach of going straight to the registers makes complete sense given the limitations you encountered with the MATLAB blockset interface.

It's frustrating when the high-level tools don't expose all the functionality you need, especially for something as critical as overcurrent protection. The fact that you had to reverse-engineer the configuration (verify in C first, then check what MATLAB should have done) really highlights a gap in the R2024b C2000 blockset.

Your solution of using direct register programming for the ePWM X-Bar to OR the four channels is actually quite elegant. Sometimes the manual approach gives you better control and transparency over what's actually happening at the hardware level. Plus, you can see exactly which registers are being set and verify the configuration matches your requirements.

I'm curious - when you checked how MATLAB configured the registers, did you find any discrepancies between what the blockset was trying to do versus your working C implementation? It might be worth documenting those differences for future reference or potentially reporting them to MathWorks if there are actual bugs in the blockset.

The image you attached showing the register read/write blocks suggests you're now using a hybrid approach - keeping some of the MATLAB/Simulink framework while manually handling the critical X-Bar configuration. That's probably the most practical solution until the blockset catches up with the full hardware capabilities.

Thanks for sharing your solution. This kind of real-world problem-solving is exactly what helps other engineers who run into similar limitations with the tools.

P.S. - Your experience would make a great case study for when to bypass the high-level tools and go direct to hardware. The fact that you got it working reliably this way proves the hardware is capable, even if the software abstraction isn't quite there yet.

Valeriy
Valeriy vor etwa 19 Stunden
Umar,
I really can’t answer your question about any differences between the blockset and the C code because honestly, the settings are pretty confusing to figure out. My biggest issue with using the C2000 blockset is that the documentation just isn’t clear. There’s no reference that shows which register gets changed by each option in the blockset tab. One thing I do know: the ePWM X-BAR configuration doesn’t fully work in the ePWM Type1-4 module.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by