Error occurred while executing External Mode MEX-file 'ext_comm': ExtTargetPktPending() call failed while checking for target pkt

60 views (last 30 days)
Hello,
I am trying to execute a simulink model on arduino UNO/Mega 2560 model.
While doing so after the code is built, I am getting an error as below always while using the standarad servo motor read and write block
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
And only 1 or 2 times I received an another error:
Error occurred while executing External Mode MEX-file 'ext_comm':
Failed to connect to the target. A time-out occurred while waiting for the connection response from the target. Possible reasons for the time-out:
a) The target is not switched on.
b) The target is not connected to your host machine.
c) The application for the model is not running on the target. You might have clicked the Stop button. If the Run button is not dimmed, click it. Otherwise, click the Build button, which downloads and runs your application on the target.
I have checked solutions online where it is specifies to change the set baud rate using the commands as shown in the below link.
It doesnt work. Besides, in Serial properties tab in hardware settings the max baud rate supported is shown to be 115200.
I am using Matlab 2020a version and windows 10 along with arduino uno R3 and Mega 2560.
For other blocks like analog read and digital write, the model with same settings and hardware(only change in pin connections and sensors change) the model runs well.

Answers (2)

Jemima Pulipati
Jemima Pulipati on 8 Jul 2020
Hello,
This error message indicates that Simulink was unable to communicate with the target board. One of the main reasons this can occur during run time of an external mode simulation is that the communication bandwidth usage is very high and communication can be momentarily lost.
The following answer from the community has suggestions on how to deal with the errors you mentioned.

achim
achim on 2 Oct 2024
可能heap不够用

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!