Ver código fonte

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 anos atrás
pai
commit
e735b34829

+ 4 - 1
Application/bsp/bsp.c

@@ -8,12 +8,15 @@ const char iap_board_name[] __attribute__((at(0x08002800))) = "SP600";
 #endif
 #endif
 const char iap_fw_version[] __attribute__((at(0x08002A00))) = "1.0";
 const char iap_fw_version[] __attribute__((at(0x08002A00))) = "1.0";
 const char iap_fw_name[] __attribute__((at(0x08002C00))) = "App";
 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
 //all board's low level init is here
 void bsp_init(void){
 void bsp_init(void){
 	wdog_start(4);
 	wdog_start(4);
 	gpio_init();
 	gpio_init();
 	DCDC_VOL_OPEN(1);
 	DCDC_VOL_OPEN(1);
+	system_clock_config(); //after dcdc open, MCU can run on full speed
+	SystemCoreClockUpdate();
 }
 }
 
 
 void wdog_start(int timeout){
 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 */
 #endif /* __SYSTEM_CLOCK_8M_HXTAL */
 
 
 /* configure the system clock */
 /* configure the system clock */
-static void system_clock_config(void);
+void system_clock_config(void);
 
 
 /*!
 /*!
     \brief      setup the microcontroller system, initialize the system
     \brief      setup the microcontroller system, initialize the system
@@ -189,12 +189,12 @@ void SystemInit (void)
     RCU_ADDINT = 0x00000000U;
     RCU_ADDINT = 0x00000000U;
     
     
     /* configure system clock */
     /* configure system clock */
-    system_clock_config();
+    //system_clock_config();
     
     
 #ifdef VECT_TAB_SRAM
 #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
 #else
-    // nvic_vector_table_set(NVIC_VECTTAB_FLASH,VECT_TAB_OFFSET);
+    nvic_vector_table_set(NVIC_VECTTAB_FLASH,VECT_TAB_OFFSET);
 #endif
 #endif
 }
 }
 
 
@@ -204,7 +204,7 @@ void SystemInit (void)
     \param[out] none
     \param[out] none
     \retval     none
     \retval     none
 */
 */
-static void system_clock_config(void)
+void system_clock_config(void)
 {
 {
 #ifdef __SYSTEM_CLOCK_8M_HXTAL
 #ifdef __SYSTEM_CLOCK_8M_HXTAL
     system_clock_8m_hxtal();
     system_clock_8m_hxtal();