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

60 次查看(过去 30 天)
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.

回答(2 个)

Jemima Pulipati
Jemima Pulipati 2020-7-8
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 2024-10-2
可能heap不够用

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by