Why am I receiving "XCP internal error: Invalid length for protocol frame" when using external mode?

I am trying to run a Simulink model in external mode on a hardware board. I am logging around 10 signals.
I have tried an example model provided by MathWorks, and the example works fine, but when I try to use my model, I get the following error:
Error:External Mode Open Protocol CheckData command failed
Caused by:
Multiple errors detected.
XCP error: XCP internal error: Invalid length for protocol frame.
Error detected while trying to disconnect Simulink from target application.
XCP error: XCP internal error: Invalid length for protocol frame.
Why am I getting this error, and how do I fix it?

 Accepted Answer

One possible cause for this error is exceeding the available bandwidth of the XCP connection. There are a few ways to work around this:
  1. Decrease the number of signals you are logging at the same time.
  2. Increase the baud rate of the hardware board connection. This can be changed from Configuration Parameters, though exact details will vary depending on your board.
  3. Increase the clock speed of the hardware board. The exact steps for this will depend on the board. Note that you may also need to reconfigure scalars and timer constants.
  4. Split the model into two parts. Use one model to perform any heavy computation work, and deploy this using code generation. This model will forward signal data to a second Simulink model running in external mode to log those signals.
For examples showing how to do the last option, please see the following links:

More Answers (0)

Products

Release

R2023b

Community Treasure Hunt

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

Start Hunting!