I need to use PG10-NRST as a GPIO. So I check the Reference manual to find out how to do it. I find that it can be done if I modify the field NRST_MODE to 2 and I really do this. But it doesn't work.The mcu still reset when PG10-NRST comes a low leve
Here is my code in main() to config field NRST_MODE:
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
gFlashOBST.OptionType = OPTIONBYTE_USER;
gFlashOBST.USERType = OB_USER_NRST_MODE;
gFlashOBST.USERConfig = FLASH_OPTR_NRST_MODE_1;
HAL_FLASHEx_OBProgram(&gFlashOBST);
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
I find the NRST_MODE changes from 3 to 2 in the SFRs window after my code when I run it online. Then I ground PG10-NRST directly and the mcu goes to reset.
I connect mcu to STM32CubeProgrammer and read the NRST_MODE, it is 3. I change it to 2 and run my code, I find the mcu no longer reset when PG10-NRST comes to low level even though I will change NRST_MODE to 3 in my project which means PG10-NRST will work as a reset pin.
I guess that the field NRST_MODE will follow the factory setup which is 3 when mcu power up, then it modified by the user code.
1.But why it still reset when I modify the NRST_MODE to 2 in my project?
2.How to config PG10-NRST as a GPIO by user code, because I can't change it using STM32CubeProgrammer one by one when there is a mass production?