C-Script Blocks Prevent DSP Flashing on LAUNCHXL-F28379D

Hi everyone,

I am using PLECS Coder with a LAUNCHXL-F28379D. My PWM outputs and SPI-A block work when I use fixed constant inputs, and I can see the SPI signals on the oscilloscope.

However, when I replace the constants with C-Script blocks, the model no longer builds/programs to the DSP. The C-Scripts work in offline simulation, but the DSP cannot be flashed when they are included.

Are there specific restrictions for using C-Scripts with the TI C2000 target?

Thanks.

Yes there are restrictions regarding C-Scripts. For example, the use of absolute time via the CurrentTime macro will by default generate an error. However there are many more possible reasons.

You will need to post a representative model and a description of the error message for more specific guidance.

I will try to provide more details. I do not receive any errors after flashing, but the flashing was unsuccessful because the signals I am probing are dead


So here, it works, and I can view the CLK signal from an oscilloscope. However, once I use a C-script to generate the same output, it doesn’t work.

You can attach PLECS models to your post. The contents of your C-Script and overall setup of your model are important details.

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