IDE:MDK5.23.0.0
MCU:STM32F103RET6
Code generate:STM32CubeMX
Q1:How to set the DBGMCU_CR register on MDK?
I tried two solutions to set DBGMCU_CR on MDK, but failed.
Solution 1
Add the conf_STM32F103RE.ini file on Options->Debug->Initialization file.
It seems the settings is invalid.
When the system run the main function first line, the DBGMCU_CR is 0x00000307.
Q2:The reason why the system run to main function theDBGMCU_CR is 0x00000307?It says the reset value is 0x00000000 in rm0008.
Solution 2
Exchange the file at DebugConfig folder and set the DbgMCU_CR from 0x00000007 to 0x00000000.
The DbgMCU_CR register value is 0x00000007 after compile.
Q3:The reason why the original DbgMCU_CR is 0x00000007?What settings on mdk caused this result?
Both two solutions failed, when the system run the main function first line, the DBGMCU_CR is 0x00000307.
I want to set the DBGMCU_CR register to 0x00000000, so the IWDG will reset the system when the system in stop mode.
If I set the DBGMCU_CR register to 0x00000000 on main function, the IWDG will reset the system when the system in stop mode.
Thanks for your attention.
Not sure which version of STM32F103 DFP you are using. If it is not the latest one with v2.3.0 then download the latest packs and check the updated .ini file or the .dbgconf file.
"Q1:How to set the DBGMCU_CR register on MDK?"
--> You can either set it in .ini file or .dbgconf file.
Q2 and Q3 are related and the simple answer is to check the last screenshot that you attached.
These settings are device-specific and not depends on the mood of the user.
I use the STM32F1xx_DFP v2.3.0.I have already set the DBGMCU_CR register in .ini file and .dbgconf file, but it seems the settings is invalid.
When the system run the main function first line in debug mode, the DBGMCU_CR register is 0x00000307.
My settings for DBGMCU_CR registerin .ini file and .dbgconf file is 0x00000000.