2024-11-23 03:31 PM
Hello,
I am programming STM32G491, while I need to use nRST as GPIO (MCO). I am using a code that you can see below. The problem is that when I am debugging a program, the debugger is disconected after HAL_FLASH_OB_Launch(); (this should reset MCU, am I right?). What can I do with that? I do not have a UART on my board, so SWV is my only option here...
Thank you for response.
SystemClock_Config();
/* USER CODE BEGIN SysInit */
HAL_Delay(5000);
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
OBInit.OptionType = OPTIONBYTE_USER;
OBInit.USERType = OB_USER_NRST_MODE;
OBInit.USERConfig = FLASH_OPTR_NRST_MODE_1;
HAL_FLASHEx_OBProgram(&OBInit);
HAL_FLASH_OB_Launch();
HAL_FLASH_OB_Lock();
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_SPI1_Init();