cancel
Showing results for 
Search instead for 
Did you mean: 

I am testing the boot mode of STM32G070 with Nucleo-G070RB board, using an IAR I-iet emulator. Thanks.

CChen.16
Associate II

I try to use UART to download firmware to the board with STM32CubeProgrammer, UART 1 was connected to the PC. 

I added the following code trying to set the MCU to boot mode, but after run this code, my I-jet emulator stop working, cannot talk to the CPU any more. Now nothing works with the board, my questions are:

1. How can I recover? 

2. Is there any other way to check the status of the MCU? 

void set_to_boot_mode(void)

{

 FLASH_OBProgramInitTypeDef OBInit;

 uint32_t config = 0;

 

 /* Unlock tha User Flash area */

 HAL_FLASH_Unlock();

 HAL_FLASH_OB_Unlock();

 /* Get the Dual boot configuration status */

 HAL_FLASHEx_OBGetConfig(&OBInit);

 

 config = OBInit.USERConfig;

 

 OBInit.USERConfig = OB_BOOT0_FROM_OB | OB_BOOT1_SYSTEM | OB_nBOOT0_SET;

 

 HAL_FLASHEx_OBProgram(&OBInit);

 

 HAL_FLASH_OB_Launch();

 // reset

 HAL_NVIC_SystemReset();

}

2 REPLIES 2
JVerv.948
Associate

Hi, I appear to have done the same mistake you have. On my STM32G031 Nucleo-32 I configured the MCU to use the external Boot0 pin but now it does not appear to boot at all. It is no longer recognized by the onboard ST-Link and no matter if I set Boot0 to High or Low it does not appear to be running. Did you ever determine what you issue was and, if so, how to fix it?

Antoine Odonne
ST Employee

​Hello,

I am afraid that you don't keep the config of previsouly programmed user options.

And would then rewrite them with 0 in your sequence. (Leading to setup of RAM parity check and Hardware watchdog starting)

Using CubeProgrammer or ST-Link Utility you should be able to connect to target under reset, and modify those OB afterward back to default values.