MATLAB: Do I get an ‘ext_comm’ error when I try to run a model in External mode on a Zynq board with Embedded Coder

Embedded Coderzc702zc706zedboardzynq-7000

I am using the Embedded Coder Support Package for Xilinx Zynq Platform. I can successfully build a Simulink model on my Zynq board. However, when I try to run the model in External mode by changing the dropdown box from "Normal" to "External", and then going to Simulation > Connect to Target, I observe the following error:
Error occurred while executing External Mode MEX-file 'ext_comm':
Failed to connect to the target. Possible reasons for the failure:
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.
Caused by:
An error occurred attempting to open an rtIOStream.
More detail may be reported in the MATLAB command window
I have verified that the board is switched on, that it is connected to my host machine, and that the application for the model is running on the target. How can I further troubleshoot this error?

Best Answer

This error message indicates that Simulink is unable to communicate with the Zynq board over the Ethernet connection. If you have already checked the three suggestions from the error message, the most probable cause of this error is that the first 3 numbers in the board's IP address do not match those from the host computer's IP address.
Please apply the steps below:
1) To determine the IP address for the host computer, you can use the IPCONFIG command at a DOS prompt for a Windows machine, or IFCONFIG at a shell for a MacOs/Linux machine.
2) To determine the IP address for the Zynq board, you can use a terminal program such as PuTTY. Please follow the steps given in the documentation page below:
3) To resolve the 'ext_comm' error, you can change the IP address of the Zynq board to match the first three numbers in the IP address of the host computer. Once you have logged into the Zynq board over a serial connection, you can use the the IFCONFIG command to change the static IP address:
zynq> ifconfig eth0 192.168.1.10
Here, change the '192.168.1.10' to the desired IP address, which should match the first three numbers for the host computer. Once you have done this, you should also make sure that you change the IP address in the model's Configuration Parameters, under Hardware Implementation > Target Hardware Resources > Board Parameters > Device Address.