2024-12-01 11:55 PM
Hello All,
I am sort of new to STM32 programming, so I got confused with bootloader operation.
I am using STM32G0 series MCU. Currently I am working on a functionality to program firmware using UART. As a part of this task I am playing with the option bytes. I noticed the following: If I connect to the board using ST-Link then the option bytes have different value than if I connect using UART. Moreover, if I change option bytes in ST-Link I cannot notice those changes if I then disconnect and connect with UART. And vice versa - changing anything while connected via UART is not seen if the OPB are then read from ST-Link.
Additionally it seems that only changes made via ST-Link have real effect. What I mean is that if we are in a bootloader (nBOOT_SEL = 1, nBOOT1 = 1, nBOOT0=0) then rewriting nBOOT0=1 using ST-Link has an effect and the board starts normally. However if same is done via UART then nothing changes. It looks like we are still hanging in a bootloader.
What is funny is that I can flash the device using UART when connected. After programming I need to reset the device and then the newly flashed firmware will work as expected.
All this is confusing because I didn't find anything on ST-Link vs UART giving different OPB readout.