Showing results for 
Search instead for 
Did you mean: 

Program huge amount of microcontrollers at the same time

Victor Dominguez
Posted on July 12, 2018 at 14:14

I am developing a system that includes a master and 140 slaves connected through an USART or I2C bus and I am wondering how can I program all the slaves at the same time.

Tjank you!

Posted on July 12, 2018 at 16:25

I don't think there is any easy way to program them while they are 'factory new'; but the first thing to program into them (one-by-one) may be a custom bootloader, which works out from the same I2C or USART interconnection they are connected for the 'working' purposes.


Jack Peacock_2
Senior III
Posted on July 12, 2018 at 19:40

In a commercial environment one approach is to program all the controllers on a separate bulk programmer with a tape reel feed, using a re-reeler to place them back on the tape reel for the pick and place pass through the SMT assembly line.  This requires a 'one image fits all' firmware binary where something unique to the PCB helps to configure the controller for its intended operating mode and node address.

Most bulk programmers have the ability to insert a unique serial number or MAC address into the firmware image.  You can use that feature to assign node numbers.

As an example I have a panel of 20 PCBs with an STM32L4 controller.  Each L4 has 5 pins connected to a unique shunt resistor placement (on if installed, off if DNP) so that each panel comes out of the pick and place with the 20 unique nodes for the RS-485 network ready for final assembly.  All PCBs use the same image, which auto-configures according to the PCB node address.

If you have the opportunity you can be more sophisticated in the approach.  For instance, using CAN instead of RS-485 you can use NMT services (CANopen protocol) to auto-configure all node addresses, by using the 96-bit unique ID as the identity system data object.  Of if you have Ethernet each controller has a unique MAC already assigned, no need for dedicated pins.

Remote bootloaders are nice if you have an external comm port that can easily be accessed.  That's often an expensive luxury on mass-produced devices and impractical if the target market doesn't have the support staff to manage it.  Plus it takes time to load all those nodes during final assembly, an avoidable expense that slows down the production line.

  Jack Peacock