cancel
Showing results for 
Search instead for 
Did you mean: 

Command sequence for USART bootloader on stm32G4 MCU

shraddhs10
Associate II

Hello,

 

I am trying to flash the MCU with USART bootloader

I am using the command codes from below link, but are not working for me

Can someone help me validate of the command codes are correct for STM32G4

https://www.st.com/resource/en/application_note/cd00264342-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf

 

Current setup:

I have connected the STM32 USART4 to my R PI device. It gets enumerated as /dev/ttyUSB0

Below is the serial code using python

 

import serial
 
ser = serial.Serial(
        port='/dev/ttyUSB0',
        baudrate=57600,
        parity=serial.PARITY_EVEN,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        timeout=10
)
 
# Command to select the USART bootloader
ser.write(b'\x7F')
ser.read(1) # Reading 1 byte of data to check ACK from the MCU

TIA

2 REPLIES 2

Going to be as described in AN2606 for the pins and AN3155 for the UART

Pretty sure UART4 has NO involvement, read and understand expectation from AN2606..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Nice catch @Tesla 

Even you didn't mention the exact G4 part number but UART4 is not used for G4 bootloader.

You can refer to the AN2606 tables Table 99 / Table 101 / Table 103: Only USART1, 2 and 3 are used for bootloader.

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.