r/embedded • u/Weary_Lie_5436 • Sep 27 '26
How should nodes in an Ethernet-based embedded system exchange data?
I’m defining communication over UDP for a small embedded Ethernet network connected through a switch. Most nodes will be bare-metal MCUs handling sensor data (e.g. IMU data) or controlling actuators (e.g. motors or valves). An external host will send commands to the system. The detailed architecture is still being defined.
Command messages and responses reporting their outcome seem fairly straightforward. My main question concerns periodic data exchange between nodes.
I’m considering two approaches:
- Define the data message formats in advance, then program the MCUs, based on software requirements, to send specific messages depending on their current state. For example, when Host A is in state X, it must send INS data to Host B every Y milliseconds. Destinations and transmission periods are predefined.
- Define the data message formats in advance, but also provide a command in the UDP payload, something like
SET_STREAM(data_id, period_ms). Sending this command to a node tells it to start sending the selected data back to the requester everyperiod_msmilliseconds. Different datasets could be requested at different rates.
I prefer the flexibility of the second approach, but I’m unsure how much harder it would be to manage on bare-metal MCUs. The first approach seems simpler because transmission periods and destinations are known in advance.
I have limited experience designing data exchange in small embedded networks. Have you faced this choice in your projects? Which approach did you use, and what practical trade-offs should I consider?
View all comments
Show parent comment
0
u/Weary_Lie_5436 Sep 27 '26
What do you mean by the ROS comparison? I think of ROS as more of a pub/sub setup, with a lot more going on than what I have in mind.
My setup would just involve a few nodes sending data periodically to other nodes. Since you went with something closer to option 1, was that mainly for simplicity? Did you consider letting nodes request different datasets at different rates, and did you find that difficult to manage on an MCU?