This is more of an "is this possible" kind of question, I'm not looking for a detailed step by step, more of a go ahead before I pull the trigger on all of the parts.
I am in the design stage of a project where there are multiple STM32 MCUs acting as slaves to a main controller, Teensy 4.1. The STM32 MCUs are heavily embedded in my design so accessing individual ones for software updates is not ideal.
I would like to be able to connect my laptop to the teensy 4.1 and send a "program sequence" which will take files from the laptop and write them to the designated STM32 MCU slave and Teensy. (Files and slaves are determined by a simple GUI on the PC).
A little background:
The STM32 MCUs control stepper motors with absolute position encoders. They are connected to the main Teensy 4.1 via a Master/slave bus ethernet TCP/IP connection using static IPs. Each STM32 unit is its own subnet: Lets say, Teensy 4.1 - IP address : 192.168.1.21 STM 32 Motor 1 - IP address : 192.168.1.100 STM 32 Motor 2 - IP address : 192.168.1.101 STM 32 Motor 3- IP address : 192.168.1.103
The idea is to eventually have each of these Teensy 4.1 and motor controllers be an individual robotic arm controlled by a Easpberry Pi ect.
Each Teensy would have a different IP address but each STM32 motor controller will have the same host address as above. This allows a PC to ping individual arms and their slaves easily.
A couple of thoughts/problems have turned up:
I'd want a way to differentiate (programming mode) from (production mode). I think this can be solved by a simple handshake -> the Teensy accepts a socket connection form the PC and then entered "programming mode". When the connection is terminated the teensy will power cycle(reboot) itself and the slave MCUs. Then the Teensy boots up again in (production mode).
Id also like to have a way to visualise all the slaves connected at a particular IP address. Ie if I set up a socket to 192.168.1.21 I'd want to see if Motor 1, Motor 2, Motor 3 are connected. - could this be done by just pinging the host address of Motor 1 once the socket connection to the teensy at 192.16.1.21 is established?
This would be to check the each motor is connected physically, the cables might come loose during movement impact etc.
Type of response expected:
- yes this is possible, simply create a script which loads each individual software update file onto the memory of the teensy with an address for it to be sent to. Use (x) to write the file to the STM32.
- this is possible but other solutions are better, look into (x)
- this is impossible, you'rw going to have to connect to each individual micro controller to update, unless you want to implement an embedded Linux(ROTS) to distribute the software update (overkill)
Thank you :)
192.168.1.100
and192.168.1.101
are not different subnets. Ethernet is a bus without any concept of master/slave, all nodes are equal peers. TCP/IP is a point-to-point protocol layered on top of Ethernet; it has concepts of client/server or initiator/listener, but is not a bus. There are other protocols in the same suite as TCP, such as UDP, that support multicast and broadcast, but TCP is strictly unicast. Ping requires implementing another protocol in the suite: ICMP. \$\endgroup\$