UDP — Direct communication between MCUs via network¶
This demo will demonstrate how you can send data back-and-fourth between MCUs, via Local Network using UDP Blocks. The UDP blocks are available since Waijung 13.11a, and allow you to communicate between target MCU and host PC. UDP can also be used to communicate between MCUs.
UDP protocol provides fast communication between multiple units within local Network. It makes use of available network infrastructure, giving flexibility in terms of location and distance. The cabling is easy to manage. Lastly, UDP can be used to communicate between MCUs and PCs, and MCUs and MCUs.
In order to make UDP blocks work, we need to add two blocks,
- , with corrected profile setting (e.g. for STM32F4 Discovery, we use Profile#1)
- with available IP specified (assigned to each MCU)
The two main blocks for this DEMO are;
- You need to provide the destination IP and Port. One Send block is needed when sending data to one destination IP, you can send data to multiple targets using multiple Send blocks.
- You just need to provide the matched receiving data structure. Only one Receive Block is needed per one MCU.
In this demo, we send signals of two push buttons to the other MCU to light up two LEDs. The following picture show Block Diagram for both MCUs;
Block Diagram for Simulink Model
The bear minimum hardware requirement is;
- Two STM32F4 Discovery + USB cables for power
- Two aMG F4 Connect
- Two aMG Ethernet INF + Lan Cables
- Local Network
The following photo shows the hardware used and their configuration;
Two set of STM32F4 Discovery, F4 Connect, aMG Ethernet INF connected to the same network
The demonstration clip showing real-time communication between MCUs via Network using UDP. When you push buttons on one board, that will signal LEDs on on the other board, and vice versa.