cancel
Showing results for 
Search instead for 
Did you mean: 

Copy firmware from one STM32 MCU to another using STM32_Programmer_CLI.exe

kumar_b
Associate II

Hello Everyone,

We have a requirement to flash firmware from One STM32G0B1 MCU1 to Second STM32G0B1 MCU2 via UART.

The STM32_Programmer_CLI will be connected to MCU1 via UART. The MCU1 and MCU2 will be connected together via a different UART for flashing. 
The MCU1 should act as a mediator between STM32 Programmer and MCU2 for flashing.

Is it possible to achieve the above requirement? 
If It is possible, could anyone share the reference documents or reference software for the same.

We really appreciate your support. 

Thanks in Advance,

Best Regards,
Naveen

5 REPLIES 5
SirineST
ST Employee

Hello @kumar_b 

You can refer to STM32CubeProgrammer software description document specifically section 3_ STM32CubeProgrammer command line interface (CLI) for MCUs. it details the available commands through various protocols ( I2C, UART, USB, ...) .

With regards

If your question is answered, please close this topic by clicking "Accept as Solution"
mƎALLEm
ST Employee

Hello,

As I understood you need to make an UART to UART bridge to update a second MCU.

Yes it's possible and I did it years ago but unfortunately I don't have the code to share.

You need to enable the UART Rx interrupts, the data received from CubeProgrammer will be retransmitted over the second UART and vice versa.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hello @mƎALLEm ,

Thanks for the response.

Yes, you are understanding is correct. we are trying to make first MCU as UART to UART bridge while updating firmware in Second MCU.

Normally the First MCU has its own application which will be running, only while flashing the second MCU it has to act as UART to UART bridge between Cube programmer and Second MCU.

To achieve this, should we develop a custom bootloader for first MCU1 and configure the UART interrupts?

As per our understanding the for the CubeProgrammer to connect to first MCU1, it should be in boot mode.

Best Regards,
Naveen


@kumar_b wrote:

Hello @mƎALLEm ,
To achieve this, should we develop a custom bootloader for first MCU1 and configure the UART interrupts?


It's only a bridge. The data sent from CubeProgrammer will be mirrored by the MCU1 and re-sent to the MCU2.

Same thing, the acknowledge byte and the reading from MCU2 will be mirrored with MCU1 that will be re-sent to the CubeProgrammer.

So you don't need to develop any custom bootlader as the bootlaoder is available on the MCU2.

You need just to add a GPIO on MCU1 that will control Boot pin on MCU2 and may be a second GPIO to drive the reset pin.

Hope it's clear now.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

So this:

 CubeProgrammer                 MCU1                     MCU2
+--------------+            +-----------+            +-----------+
|              |            |           |            |           |
|              |            |    UART TX+----------->+RX UART    |
|     PC       +<==========>+           |            |           |
|              |            |    UART RX+<-----------+TX UART    |
|              |            |           |            |           |
+--------------+            +-----------+            +-----------+

 


@kumar_b wrote:

should we develop a custom bootloader for first MCU1


It doesn't need to be a bootloader - just something which can pass the commands/data from CubeProgrammer to MCU2, and pass the responses back.

Possibly the simplest is to simply pass through whatever comes from CubeProgrammer direct to MCU2 and, similarly pass everything from MCU2 back through to CubeProgrammer.

Thus MCU1 operates as an entirely transparent "pipe"
 

PS:

So this:

 CubeProgrammer                        MCU1                         MCU2
+--------------+            +----------------------+            +-----------+
|              |            |                      |            |           |
|        COM TX+----------->+RX UARTa ---> UARTb TX+----------->+RX UART    |
|              |            |                      |            |           |
|        COM RX+<-----------+TX UARTa <--- UARTb RX+<-----------+TX UART    |
|              |            |                      |            |           |
+--------------+            +----------------------+            +-----------+