Skip to main content
DWelc
Associate
March 1, 2019
Question

Has anyone gotten the boot0 pin to work on an STM32G071? (SOLVED)

  • March 1, 2019
  • 11 replies
  • 6526 views

It goes into the bootloader only with a virgin part, once programmed once (using the bootloader) asserting boot0 during a power on or reset runs the application code not the bootloader.

This topic has been closed for replies.

11 replies

Andreas Bolsch
Lead III
March 1, 2019

Verify nBOOT0, nBOOT1, nBOOT_SEL settings according to section 2.5 in the RM.

DWelc
DWelcAuthor
Associate
March 1, 2019

why wouldnt they default in a new part to function like every other stm32? will try to look.

DWelc
DWelcAuthor
Associate
March 1, 2019

why wouldnt they default in a new part to function like every other stm32 part?

Andreas Bolsch
Lead III
March 1, 2019

Because one major point of the G familiy is not to sacrifice any pin ... Only one pair of supply pins, no BOOT pin (by default).

The production value of 'User and read protection option bytes' at 0x1FFF7800 is 0xFFFFFEAA, i. e. nBOOT0, nBOOT1, nBOOT_SEL all default to '1'. And description reads:

Bit 24: nBOOT_SEL

0: BOOT0 signal is defined by BOOT0 pin value (legacy mode)

1: BOOT0 signal is defined by nBOOT0 option bit

So, by default, BOOT0 pin is 'don't care' regarding boot mode.

DWelc
DWelcAuthor
Associate
March 1, 2019

I see the legacy mode thing. And do see that BOOT0 is shared with an SWD pin. kinda sad but think it is related to IoT security.

nBOOT_SEL was set from the factory so once cleared then the B00T0 pin works as desired. Fortunately I have the tools to do this (swd debugger and was able to get in and run a program in ram as using openocd mdw commands does not work).

So step one on a virgin part if you only have/want to use the debugger uart/other interface is to have the first program loaded be one that clears the nBOOT_SEL pin, do a power cycle, then you can get back in with BOOT0.

OKrau.1
Visitor II
November 13, 2021

For those who come along here, I have created a hex file, which does this job: https://github.com/olikraus/stm32g031/tree/main/enable_boot0

Coratron
Associate III
November 14, 2021

Thank you @OKrau.1​ - I was just writing a post about all this but decided to do some extra research, came to the same conclusion and was about to do exactly that. I will test on a STM32G071 nucleo and let you know if it works as confirmation for your repo.

CChen.16
Associate II
May 9, 2019

Hi,

Actually I am trying to ask a question about the BOOT0 pin on G070RB here. I am using a Nucleo-G070RB board, changed the nBOOT_SEL to 0 through debugger, but BOOT0 pin still does not work. The board is always go to the main flash, no matter the pin is high or low.

The FLASH->OPTR value is 0xDEFFE1AA, FLASH->SECR is 0

Do you know why? I am so frustrated with this problem, any help is appreciated.

Thanks.

Andreas Bolsch
Lead III
May 9, 2019

The OPTR value seems to be correct, SECR too (although officially the G070 hasn't got the SECR register at all).

Note that there is a conflict on PA14/BOOT0 pin: It's used for SWCLK after reset and for BOOT0, too. To set the pin value properly, the debugger must be disconnected, i. e. jumpers on CN4 have to be removed on the nucleo board.

CChen.16
Associate II
May 9, 2019

Thank you so much. After I removed the jumps on CN4, the BOOT0 pin works.

SPrab.1
Visitor II
January 13, 2020

Hi,

what is the code to be written for option bytes?

lorenzo meneghello_2
Associate III
February 6, 2020

Hi,

have you solved? I've also this problem.. I've flashed 0x3A40EAAA at address 0x1FFF7800(FLASH->OPTR) and 0 at address 0x1FFF7870 (FLASH->SECR) but now I've the ST stuck, I see it via SWD but If I try to erase all flash it block me. Thanks.

JHerw.1
Associate
February 13, 2020

Hi, I have more or less the same problem. Generated code using STMCubeMX. PA14/BOOT0 defined as SWCLK, but can't reach the device using ST_LINK utility, so I can't program it any more. Anyone an idea what can be wrong here and how I can recover from this?

Marco Del Fiasco
Visitor II
December 3, 2020

I am working on a nucleo board to begin testing for a new project for one customer. I can confirm that after setting nBOOT_SEL=0 the BOOT0 pin is functional but you are able to enter the system memory bootloader only when the flash is blank. When application firmware is flashed then it always starts regardless BOOT0 pin state.

Help is needed, please.