// File: PY32F033xx_DBGMCU.ini // Version: 1.0.0 /* variable to hold register values */ define unsigned long DbgMCU_CR; define unsigned long DbgMCU_APB_Fz1; define unsigned long DbgMCU_APB_Fz2; // <<< Use Configuration Wizard in Context Menu >>> // Debug MCU configuration register (DBGMCU_CR) // DBG_STOP Debug stop mode // DBG_SLEEP Debug sleep mode // DbgMCU_CR = 0x00000003; // Debug MCU APB freeze1 register (DBG_APB_FZ1) // Reserved bits must be kept at reset value // DBG_LPTIM1_STOP LPTIM1 stopped when core is halted // DBG_I2C1_SMBUS_TIMEOUT I2C1_SMBUS TIMEOUT frozened when core is halted // DBG_IWDG_STOP Independent watchdog stopped when core is halted // DBG_WWDG_STOP Window watchdog stopped when core is halted // DBG_RTC_STOP RTC stopped when core is halted // DBG_TIM3_STOP TIM3 counter stopped when core is halted // DBG_TIM2_STOP TIM2 counter stopped when core is halted // DbgMCU_APB_Fz1 = 0x00000000; // Debug MCU APB freeze2 register (DBG_APB_FZ2) // Reserved bits must be kept at reset value // DBG_TIM17_STOP TIM17 counter stopped when core is halted // DBG_TIM16_STOP TIM16 counter stopped when core is halted // DBG_TIM14_STOP TIM14 counter stopped when core is halted // DbgMCU_APB_Fz2 = 0x00000000; // <<< end of configuration section >>> /*---------------------------------------------------------------------------- Setup_DBGMCU() configure DBGMCU registers *----------------------------------------------------------------------------*/ FUNC void Setup_DBGMCU (void) { _WDWORD(0x4002103C, _RDWORD(0x4002103C) | 0x08000000); // Set RCC_APBENR1.DBGMCUEN _WDWORD(0x40015804, DBGMCU_CR); // Set DBGMCU_CR _WDWORD(0x40015808, DbgMCU_APB_Fz1); // Set DBG_APB_FZ1 _WDWORD(0x4001580C, DbgMCU_APB_Fz2); // Set DBG_APB_FZ2 } /*---------------------------------------------------------------------------- OnResetExec() Executed after reset via uVision's 'Reset'-button *----------------------------------------------------------------------------*/ FUNC void OnResetExec (void) { Setup_DBGMCU(); } Setup_DBGMCU(); // Debugger Setup