I am testing the boot mode of STM32G070 with Nucleo-G070RB board, using an IAR I-iet emulator. Thanks.
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();
}
