cancel
Showing results for 
Search instead for 
Did you mean: 

Using pre-programmed bootloader on STM32G0B0RE

Tiboww
Associate II

hello

I am developping on a STM32G0B0RE, I've learned after finishing my board and everything that boot pin can be used by default.

It is not a problem since I have ST-Link for production but I would like to be able to do firmware update through bootloader.

 

The issue is, since nBOOT_SEL is set to '1' by default I need to change it to 0 so I go in bootloader if my pin PA14-BOOT0 is tied up at startup. I find how to change it in STM32CubeProgrammer but I would like to do it in my firmware so the flashing process is not too complicated in factory.

 

I've tried this but it does not have any effect : 

Tiboww_0-1729088556950.png

Best Regards

Thibaud HABRAND

16 REPLIES 16

Hello 

Thank you

Are you sure about the reset with HAL_FLASH_OB_Launch() ? Because I am doing this, and my application is never launching after I flashed it, I have to flash the application twice.

 

 

/* USER CODE BEGIN Init */

FLASH_OBProgramInitTypeDef initboot;

HAL_FLASHEx_OBGetConfig(&initboot);

if (initboot.USERConfig != 0x67f6000)

{

HAL_FLASH_Unlock();

HAL_FLASH_OB_Unlock();

initboot.USERConfig = 0x67f6000; //set bit to 0

//initboot.USERConfig = 0x77f6000; //set bit to 1

HAL_FLASHEx_OBProgram(&initboot);

//start_timer_cmd()

HAL_FLASH_OB_Launch();

// WIll never reach here

HAL_FLASH_OB_Lock();

HAL_FLASH_Lock();

HAL_FLASHEx_OBGetConfig(&initboot);

}

/* USER CODE END Init */

 

Thibaud

I've also tried to do like you and both times I need to flash my board twice.

 

Tiboww_0-1729608516546.png

 

FLashing twice or do a Power Reset.

setting the OB_LAUNCH Bit should generata a reset, as descripted in the RM044 (for my MCU) in capter 3.4.2

 

MHoll2_0-1729609047965.png

 

Thank you I missed this part in the RM044. 

But if OBL_LAUNCH generates a reset why do I have to do a 2nd flashing or a Power Reset after i flashed my board with the nBOOT_SEL bit test ?

 

Thibaud

Sorry, cant help You with this.

I don't remember if this was the case with my HW, but as the function get's called only on the first installation of the Application I did not investigate a lot.

Martin

Hello 

No problem, may be @SofLit could answer  ?

 

Best Regards

Thibaud