cancel
Showing results for 
Search instead for 
Did you mean: 

DFU issue after flashing STM32G0B0VET

Sander_V
Associate

Hey, 

 

I am using the STM32G0B0VET (16MHz HSE) with a virtual com port over USB. 

The virtual com port is working fine but as a backup I would love to be able to let the user reflash the device. 

I was thinking of using the DFU for this since then the user would only need a standard USB cable (consumer electronics hopefully high volume). I exposed a button that can pull BOOT O high (small reprogram button you have to push). 

(Normally in the field updates are not needed but I would like to have this as a backup).

 

Now I have the following problem when I boot the device (that is flashed) when pressing the button (keeping BOOT 0 high) my PC sees the virtual COM port and not the DFU device. It is thus running the usual code and not entering the bootloader. 

If I erase the STM32 with the ST link I can access the DFU just fine with the boot button.

 

Does anybody have a fix for this? 

 

Best regard and thanks already for the help.  

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

It sounds like it's not booting up into the bootloader.

See AN2606 for how to enter the bootloader. For this chip, it's:

TDK_0-1767881532311.png

The default settings for these are in the reference manual. They are:

nBOOT0_SEL = nBOOT0 = nBOOT1 = 1.

So the BOOT0 pin is ignored by default. Your button does nothing (by default).

 

You can change the option bytes in STM32CubeProgrammer on the OB tab. Set nBOOT0_SEL=0 to have the BOOT0 pin sampled on startup.

 

Edit: also be aware that on a fresh (i.e. not yet programmed) chip the bootloader will always run since the main flash is empty.

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

View solution in original post

2 REPLIES 2
TDK
Super User

It sounds like it's not booting up into the bootloader.

See AN2606 for how to enter the bootloader. For this chip, it's:

TDK_0-1767881532311.png

The default settings for these are in the reference manual. They are:

nBOOT0_SEL = nBOOT0 = nBOOT1 = 1.

So the BOOT0 pin is ignored by default. Your button does nothing (by default).

 

You can change the option bytes in STM32CubeProgrammer on the OB tab. Set nBOOT0_SEL=0 to have the BOOT0 pin sampled on startup.

 

Edit: also be aware that on a fresh (i.e. not yet programmed) chip the bootloader will always run since the main flash is empty.

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

Hi @Sander_V & welcome to ST Community

Your target's behavior regarding entering the system bootloader as mentioned @TDK depends on the option byte nBOOT0_SEL:

  • By default, nBOOT0_SEL = 1, which means the BOOT0 pin is ignored at reset, and the device boots the user application regardless of BOOT0 pin state.
  • When the chip’s flash memory is erased (empty), the MCU automatically boots into the system bootloader by default. It determines this by checking the initial stack pointer value at address 0x08000000; if this value is invalid, the MCU assumes no valid application is present and runs the bootloader from system memory to allow programming via interfaces like USB DFU or USART. If the flash is programmed, the MCU boots either the user application or the bootloader depending on the BOOT0 pin state and option byte settings.

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.




Best regards,
FBL