Skip to main content
Visitor II
January 12, 2022
Question

How to update firmware through uart using STM32G050k8 controller

  • January 12, 2022
  • 4 replies
  • 8416 views

Hi,

I am new to bootloader and firmware update concept. I would like to program bootloader and update firmware using UART. I have gone through datasheet and reference manual and understand that there are boot pin and nboot1 bit, nboot_sel bit and nboot0 bit. I don't want to consider Boot0pin. I want to use only option bits so that I could update firmware.

My question is how to program bootloader and application code. Do I need to use two development board, one for application and one for bootloader connecting via UART protocol. I hope for guidance.

Thank You

Regards,

Ashwinee

    This topic has been closed for replies.

    4 replies

    Super User
    January 12, 2022

    You can use the built-in bootloader or you can create your own. The built-in bootloader is described in this document:

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

    If you create your own bootloader, you are of course free to choose whatever scheme you want.

    There are many examples on how to erase/program the FLASH on the STM32G0. Here is one of them:

    https://github.com/STMicroelectronics/STM32CubeG0/blob/c6c0046d9278a7107261c6bf38327345df4c3efd/Projects/NUCLEO-G070RB/Examples/FLASH/FLASH_EraseProgram/Src/main.c

    Ajadh.1Author
    Visitor II
    January 13, 2022

    Thanks.

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

    Above documents explain different commands. I need to send those command through uart and then I can update firmware if I will get required feedback from stm32g0 board.

    Then I can download firmware update code including uart commands is that like this.

    Till now I understand there is one bootloader code and one is application code. first i will download bootloader code in stm32g0 then what should I do?

    How I will update firmware, does that firmware has uart communication command given in this document.

    Please give me clear idea.

    Thank You

    Graduate II
    January 12, 2022

    >>Do I need to use two development board, one for application and one for bootloader connecting via UART protocol. I hope for guidance.

    No you'd partition your own code into two parts, both would need to fit.

    You can't replace the ROM based System Loader, but you'd typically communicate with that from your Host computer, ie Windows/LINUX PC

    If you need to pull the new firmware from a remote server, over WiFi, Cellular, etc, you'd likely need to provide some way to stage the new firmware, perhaps in an external flash or SD Card.

    The UART protocol is described in AN3155.

    For your own loader consider protocols with native support in terminal applications, ie X/Y-Modem, etc.

    Ajadh.1Author
    Visitor II
    January 13, 2022

    Thanks.

    I want to ask how to configure boot mode without using BOOT pin. And also when Bootloader mode is running and after code is updated so do I need to again change Boot mode configuration and how?

    Thank again

    Ajadh.1Author
    Visitor II
    January 13, 2022

    Hi,

    is their any sample code so that I can use and understand the things.

    Thanks

    Visitor II
    July 1, 2022

    How can I use the uart interface with a cpu uart interface