Rewiring PF2-NRST to GPIO - Does this brick SWD debugging?
Hello, I need the PF2-NRST pin on the STM32G0C1 chip as an MCO.
Thus, I had to change the user flash to use the pin in GPIO mode. While I had doubts about this approach's validity since we are fiddling with the NRST, I still went ahead with it.
Now the pin is in GPIO mode, but surprise, reflashing new software with the ST-Link doesn't work anymore.
Error in ST-Link: The interface firmware FAILED to reset/halt the target MCU
Is there any possibility of unbricking this by booting from the embedded SRAM or the system memory?
Kind regards for any help.
This was the code I used to create a paperholder:
void ConfigureNRSTasGPIO(void)
{
FLASH_OBProgramInitTypeDef OBInit; // Option Bytes configuration structure
// Unlock the Flash Control Register
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
// Configure the Option Bytes
HAL_FLASHEx_OBGetConfig(&OBInit); // Get the current configuration
// Set the NRST mode to GPIO
OBInit.USERType = OB_USER_NRST_MODE;
OBInit.USERConfig = FLASH_OPTR_NRST_MODE_1;
// Write the Option Bytes configuration
HAL_FLASHEx_OBProgram(&OBInit);
// Launch the option byte loading
HAL_FLASH_OB_Launch();
// Lock the Flash Control Register
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
}
