Project

General

Profile

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.

View table of content.

The Benefit

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.

The Software

In order to make UDP blocks work, we need to add two blocks,

  1. Ethernet Link, with corrected profile setting (e.g. for STM32F4 Discovery, we use Profile#1)
  2. Ethernet App, with available IP specified (assigned to each MCU)

The two main blocks for this DEMO are;

  1. Target UDP Send. 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.
  2. Target UDP Receive. 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

Model File:

  1. target_udp_demo1
  2. target_udp_demo2

The Hardware

The bear minimum hardware requirement is;

  1. Two STM32F4 Discovery + USB cables for power
  2. Two aMG F4 Connect
  3. Two aMG Ethernet INF + Lan Cables
  4. 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 DEMO

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.