Communicate with AMD Zynq Boards Using UDP Protocol
This example shows how to send data from a Simulink® model running on an ARM® Cortex®-A processor in an AMD Zynq® platform to another model running on the host computer by using the UDP ethernet protocol.
Introduction
Build a Simulink model and run an executable on an ARM Cortex-A processor in an AMD Zynq® board. The model sends data to the host computer by using UDP. For more information, see User Datagram Protocol website. A companion model running on the host computer receives UDP data packets from the AMD Zynq board.
Requirements
Run UDP Communication Model on AMD Zynq Board
This task shows how to configure, build, deploy, and run the Sobel edge-detection model AMD Zynq-7000 SoC ZC702 Evaluation Kit.
1. Open the zynq_udp_server model.
The model algorithm detects the edges of an input image using the Sobel edge-detection method. The detected images get sent as UDP packets to the host computer while also receiving the threshold value from the host computer via UDP.
2. Open the UDP Send block mask. Set the Remote IP address parameter to the IP address of your host computer. Click OK.
3. Open the Image_and_Threshold subsystem block. In the Image_and_Threshold subsystem, open the UDP Receive block mask. Set the Remote IP address parameter to the IP address of your host computer. Click OK.
4. On the Hardware tab of the Simulink Toolstrip, click Build, Deploy & Start to run the model on the AMD Zynq-7000 SoC ZC702 Evaluation Kit.
5. Once started, the model sends UDP packets to port 25000 of your host computer and can receive packets from port 25001 to control the threshold of Sobel edge-detection algorithm.
6. You can stop the model running on the hardware board at anytime by entering this code at the MATLAB command prompt.
h = zynq();
stop(h,'zynq_udp_server');
Run UDP Communication Model on Host Computer
This task shows how to configure and run a model on the host computer that communicates over UDP with the model running on the AMD Zynq-7000 SoC ZC702 Evaluation Kit.
1. Open the zynq_udp_client model.
The model on the host computer receieves UDP packets from the model running on an AMD Zynq board. To set the desired threshold of the Sobel edge-detection algorithm, UDP packets can be sent to the model running on the AMD Zynq board.
2. Open the UDP Send block mask. Set the Remote IP address parameter to the IP address of the AMD Zynq board, and then click OK. To get the IP address of the AMD Zynq board, open the zynq_udp_server model.
3. On the Hardware tab, click Hardware Settings. The IP address of the AMD Zynq board is shown in Hardware Implementation > Hardware board setting > Target hardware resources > Board Parameters > Device Address.
4. Open the UDP Receive block mask. Set the Remote IP address parameter to the IP address of the AMD Zynq board. Click OK.
5. On the Simulation tab of the Simulink Toolstrip, click Run to run the model on the host computer.
6. Open the Slider Gain block mask to vary the threshold value. Observe the changes in the Video_Sobel window.
Other Things to Try
Update other Embedded Coder Support Package for AMD SoC Devices models to send and recveive data over UDP as a form of remote network control.