C-Script Blocks Prevent DSP Flashing on LAUNCHXL-F28379D

If you test a simple model with a reasonable step size with the latest target support package release you should notice that the behavior is the same whether the C-Script or constant blocks are used. The problem only arises in the context of your complete model.

Your actual model has a CPU overrun when the C-Script is included. The C-Script block has more overhead than a basic constant block. However, your code was likely marginal to begin with as the discretization step size is 10 usec (100 kHz).

There is a support article further describing this issue and suggested next steps. These changes to your model are important as it looks like you ultimately want to add even more logic to your C-Scripts.

Another point is that you are doing the carrier compare in the model using PLECS blocks and then connecting to a GPIO. You should be using the PWM blocks which use the ePWM peripheral that generates the carrier in hardware. This will greatly improve the PWM resolution.

1 Like