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 : STM 32 Motor 1 - IP address : STM 32 Motor 2 - IP address : STM 32 Motor 3- IP address :

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 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 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:

  1. 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.
  2. this is possible but other solutions are better, look into (x)
  3. 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 :)

  • \$\begingroup\$ That can't really be answered without further info. Which STM32 MCUs are those, what is the exact type? How much flash memory they have, how much is the firmware size and can you reserve space for custom bootloader that can update the non-bootloader space from Ethernet? \$\endgroup\$
    – Justme
    Nov 14, 2021 at 22:00
  • \$\begingroup\$ Your Teensy has an Ethernet port for you to use to connect to it using TCP/IP. Do your STM32 devices also have Ethernet ports? If not, how will you connect to them or even assign them IP addresses? Are you intending for your Teensy to behave as a router between the network you've connected to its Ethernet port and the other devices? \$\endgroup\$
    – brhans
    Nov 15, 2021 at 0:42
  • \$\begingroup\$ @brhans Im thinking of using the STM32F103C8T6 Blue pill for development purposes. Im using a W5500 spi to ethernet adaptor to deal with the IP addresses and data transfers to the STM32 MCUs. \$\endgroup\$
    – Wscott
    Nov 15, 2021 at 12:00
  • \$\begingroup\$ The STM32 Blue pill based on the shows to have 64 Kb of flash and a 72Mhz clock speed. I intend to run simple encoder value decoding and some basic interpolation( access/deccel motor when moving from point to point) I believe the 64kb of flash should be enough and the 72Mhz clock should provide enough overhead for the maths and the coms processes. I read somewhere that STM32 have DFU could this work? \$\endgroup\$
    – Wscott
    Nov 15, 2021 at 12:32
  • \$\begingroup\$ So much of the networking description here is just impossible. and 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\$
    – Ben Voigt
    May 30, 2022 at 21:58

1 Answer 1


Since ​STM32F103 supports only UART DFU, with only Ethernet-SPI bridge you'll have to implement your own bootloader. Or pick a different MCU to use SPI DFU, e.g. from STM32F4 series. Refer to AN2606 application note for a complete list and other details.

The main pattern to enter STM32's DFU mode is using dedicated boot pins, this would require addtional wiring or lathces. Software entry is possible, but I've never tried it, perhaps this question could help in further development.

In either case, on the Teensy board you'll have to implement host-side bootloader code

  • \$\begingroup\$ Thank you, I didn't realise id need a host side boot loader this was very helpful. \$\endgroup\$
    – Wscott
    Nov 26, 2021 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.