Skip to main content
Visitor II
May 13, 2024
Solved

Command sequence for USART bootloader on stm32G4 MCU

  • May 13, 2024
  • 1 reply
  • 1732 views

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

    This topic has been closed for replies.
    Best answer by mƎALLEm

    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.

    1 reply

    Graduate II
    May 13, 2024

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

    mƎALLEmAnswer
    Technical Moderator
    May 13, 2024

    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.