External Mode sample rate limitations on Zynq platform

2 views (last 30 days)
I have deployed an interface model to the ARM CPU on my Xilinx Zynq Ultrascale+ ZCU102 Evaluation Kit. I am running the application in external mode to tune some parameters.
However, I noticed external mode is not stable when running at a sample time of 10e-9. Very often I get error messages such as:
Error occurred while executing External Mode MEX-file 'ext_comm':
ExtTargetPktPending() call failed while checking for target pkt
Error occurred while executing External Mode MEX-file 'ext_comm':
ExtSetTargetPkt() call failed on CLOSE.
Ensure target is still running.
External mode is terminating because Simulink received an unexpected incoming packet from target.
I also get the following error very soon after startup:
Error returned by XCP master: XCP Master TCP/IP error: socket receive error
After decreasing the sample rate to 10e-5, the application is now more stable. I have the following questions regarding this:
1) What is the scheduling policy in the application?
2) Why do I have to decrease the sample rate? If I leave it at 10e-9, shouldn't it just read as fast as possible?
3) Why am I seeing the above error messages?
4) Is there a sample time limit for External Mode?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Sep 2020
1) The generated application uses SCHED_FIFO scheduling policy for the main thread, which is a real-time scheduling policy. Hence it preempts every other task including kernel threads and makes the other tasks to go into starvation. Please find more info about SCHED_FIFO policy here:
2) Yes, the application should read as fast as possible, but since it has preempt the other kernel threads including network services running on CPU core 0 and makes the Ethernet down, resulting into MATLAB losing the connection with hardware board and external mode gets interrupted.
3) If you see sporadic errors when operating at a high data rate, this might be happening when the generated application and network services would be running on different CPU cores. If the generated application runs on CPU 1, 2, 3, then it won't preempt the kernel threads running on core 0, hence it won't preempt the network services and keeps reading data as fast as possible.
4) There is no sample rate limit for ExternalMode. This may differ from processor to processor and will depend on the CPU speed.

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!