Hello,
I am trying to program my TI launchXL-F280039C launchpad from PLECS (version 4.9.9 with TI C2000 version 2.2.3 on Windows 11 Pro) to have a PWM switching frequency, and overall control loop frequency, of 200kHz. I’ve attached my simple model here:
Luterbach_launchpad_functionaltesting_20260924.plecs (18.5 KB)
I am getting the following error when I try to build it: “Error from ‘Luterbach_launchpad_functionaltesting_20260924’: Sample time for task 0 on CPU 0 too small - raise sample time or system clock rate.”
This error exists for any switching frequency I try above 140kHz. I have programmed this same launchpad from TI’s CCS and it worked at 200kHz, but I wanted to try using PLECS for the drag-and-drop features. My system clock frequency is 120 MHz.
My question is: Is 140kHz a known control/switching frequency limit when programming this launchpad from PLECS?
If I can provide any more information that would be helpful, please let me know.
Thank you,
JT
I just found a similar limit for using “External Mode,” but at 100kHz. For the same model I shared above, if I lower the switching frequency to 90kHz I can connect to it with external mode no problem (I had to add a scope measuring the modulation index to get rid of an error), but at 100kHz I get an error saying:
“Communication error for system ‘Luterbach_launchpad_functionaltesting_20260924’: Wrong port or no response from target.”
Are these limits (140kHz to build, 100kHz to connect to external mode) a known thing for this launchpad or for the TI C2000 target support package in general?
Thank you,
JT
Hi JT,
From a PWM switching frequency perspective, the maximum switching frequency will ultimately be limited by the MCU hardware. A 200 kHz switching frequency should be feasible with the F280039x, although you may need to utilize the high-resolution PWM functionality. I would recommend referring to the device technical reference manual and datasheet to determine what is appropriate for your application.
Please also see CPU Overruns and CPU Usage - A Debugging Guide for a detailed overview of PLECS code generation and some guidelines for avoiding CPU overruns.
For your application, the main question to consider is whether you really need to execute the controller at 200 kHz, or whether a lower control rate would be sufficient. For example, if your application can meet its performance requirements with a controller running at 50 kHz and a PWM switching frequency of 200 kHz, you could configure it as follows:
-
Set an initialization parameter f_sw = 200e3.
-
Set a trigger divider parameter trigDiv = 4.
-
Calculate the ISR period as T_isr = trigDiv/f_sw.
-
Use T_isr in the Scheduling tab to ensure the control discretization occurs at the desired controller rate.
With this configuration, the generated code will use a 200 kHz PWM switching frequency while running the controller at 50 kHz. Since no Control Task Trigger is defined in the model, the controller ISR will be triggered by a timer module.
If you need the control task to execute at a known point relative to the PWM carrier, you can instead use an explicit Control Task Trigger component from the library. In the PWM peripheral, enable the task trigger to occur at underflow and set the Task Trigger Divider to trigDiv. A task port will then appear on the PWM peripheral, which you can connect to the Control Task Trigger component.
This is just one example, and there are several different ways to configure the system depending on the requirements of your design. You will need to determine which approach works best for your application.
Hope this helps!