Просмотр исходного кода

when mcu power on, we can not set the max run speed(84MHz), must after dcdc is open ,then we can set the mcu running on 84MHz

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 лет назад
Родитель
Сommit
e735b34829
2 измененных файлов с 9 добавлено и 6 удалено
  1. 4 1
      Application/bsp/bsp.c
  2. 5 5
      Librarys/CMSIS/GD32F3x0/Source/system_gd32f3x0.c

+ 4 - 1
Application/bsp/bsp.c

@@ -8,12 +8,15 @@ const char iap_board_name[] __attribute__((at(0x08002800))) = "SP600";
 #endif
 const char iap_fw_version[] __attribute__((at(0x08002A00))) = "1.0";
 const char iap_fw_name[] __attribute__((at(0x08002C00))) = "App";
-
+extern void system_clock_config(void);
+extern void SystemCoreClockUpdate(void);
 //all board's low level init is here
 void bsp_init(void){
 	wdog_start(4);
 	gpio_init();
 	DCDC_VOL_OPEN(1);
+	system_clock_config(); //after dcdc open, MCU can run on full speed
+	SystemCoreClockUpdate();
 }
 
 void wdog_start(int timeout){

+ 5 - 5
Librarys/CMSIS/GD32F3x0/Source/system_gd32f3x0.c

@@ -122,7 +122,7 @@ static void system_clock_8m_irc8m(void);
 #endif /* __SYSTEM_CLOCK_8M_HXTAL */
 
 /* configure the system clock */
-static void system_clock_config(void);
+void system_clock_config(void);
 
 /*!
     \brief      setup the microcontroller system, initialize the system
@@ -189,12 +189,12 @@ void SystemInit (void)
     RCU_ADDINT = 0x00000000U;
     
     /* configure system clock */
-    system_clock_config();
+    //system_clock_config();
     
 #ifdef VECT_TAB_SRAM
-    // nvic_vector_table_set(NVIC_VECTTAB_RAM,VECT_TAB_OFFSET);
+    nvic_vector_table_set(NVIC_VECTTAB_RAM,VECT_TAB_OFFSET);
 #else
-    // nvic_vector_table_set(NVIC_VECTTAB_FLASH,VECT_TAB_OFFSET);
+    nvic_vector_table_set(NVIC_VECTTAB_FLASH,VECT_TAB_OFFSET);
 #endif
 }
 
@@ -204,7 +204,7 @@ void SystemInit (void)
     \param[out] none
     \retval     none
 */
-static void system_clock_config(void)
+void system_clock_config(void)
 {
 #ifdef __SYSTEM_CLOCK_8M_HXTAL
     system_clock_8m_hxtal();