cancel
Showing results for 
Search instead for 
Did you mean: 

How to update firmware through uart using STM32G050k8 controller

Ajadh.1
Associate II

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

6 REPLIES 6
TDK
Guru

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

If you feel a post has answered your question, please click "Accept as Solution".

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

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

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

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.1
Associate II

Hi,

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

Thanks

SLin.5
Associate

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