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.
C2000 CMPSS to ePWM Trip Zone / Digital Compare connection
34 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
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.
0 Kommentare
Valeriy
am 18 Sep. 2025 um 18:26
6 Kommentare
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.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!