cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0* Leave DFU mode with BOOT0 HIGH

mhelms100
Associate

Motivation: Release a product (STM32F072RBT) with no buttons or toggles on the PCB and allow customers to flash and interact with their product over USB serial interface

Requirement: Keep BOOT0 held high so the STM32 is in DFU mode upon initial connection to computer. The computer software can either flash or leave immediately to 0x08000000 running the flash program. 

Issue: The DFU leave command does not work while BOOT0 is held high. 

Potential Solutions: Users have solved this issue on STMF4 products due to it having a Cortex-M3/M4 https://community.st.com/t5/stm32-mcus-embedded-software/leave-dfu-while-boot0-is-high-stm32f4/td-p/556307

Uncommenting this line could potentially solve this on those products as well. 

#define USER_VECT_TAB_ADDRESS

 However I haven't found resources with a step by step solution for Cortex-M0 (STM32F072RBT)

1 ACCEPTED SOLUTION

Accepted Solutions

There is no vector-table-remap register (SCB_VTOR) on Cortex-M0, and the vector table is always assumed to be at address 0x0000'0000, where the System memory is remapped when reset with BOOT0 high. So before enabling any interrupt in the user program, you have to remap FLASH to address 0x0000'0000 through SYSCFG_CFGR1.MEM_MODE (or remap RAM and copy vector table at the beginning of RAM, in the same register-field).

I am not sure if leaving BOOT0 has no other side effects other than the System Memory being remapped at 0x0000'0000 at reset.

JW

View solution in original post

2 REPLIES 2

There is no vector-table-remap register (SCB_VTOR) on Cortex-M0, and the vector table is always assumed to be at address 0x0000'0000, where the System memory is remapped when reset with BOOT0 high. So before enabling any interrupt in the user program, you have to remap FLASH to address 0x0000'0000 through SYSCFG_CFGR1.MEM_MODE (or remap RAM and copy vector table at the beginning of RAM, in the same register-field).

I am not sure if leaving BOOT0 has no other side effects other than the System Memory being remapped at 0x0000'0000 at reset.

JW

mhelms100
Associate

This works! Placing this in "system_stm32f0xx.c"

void SystemInit(void) {
	SYSCFG->CFGR1 &= ~(0x1 << 5);
}

I had tried this prior however something in my app code was causing this to fail. This totally works from a blank project. You're a life-saver!