2025-03-25 2:25 AM - last edited on 2025-03-25 3:18 AM by Andrew Neil
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
2025-03-25 4:01 AM - edited 2025-03-25 4:02 AM
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
2025-03-25 4:01 AM - edited 2025-03-25 4:08 AM
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.
2025-03-26 3:25 AM
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
2025-03-26 3:36 AM - edited 2025-03-26 3:46 AM
@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.
2025-03-26 3:38 AM - edited 2025-03-26 3:47 AM
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 | | | | | | | +--------------+ +----------------------+ +-----------+