ソースを参照

open dcdc need wait dcdc pwr good

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 5 年 前
コミット
b21bb762b9
2 ファイル変更5 行追加1 行削除
  1. 4 0
      Application/bsp/gpio.c
  2. 1 1
      Application/bsp/gpio.h

+ 4 - 0
Application/bsp/gpio.c

@@ -70,6 +70,10 @@ void enable_mcu_power(void){
 	rcu_periph_clock_enable(RCU_GPIOA);
 	gpio_mode_output(GPIOA, GPIO_PUPD_NONE, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_11);
 	gpio_bit_write(GPIOA,GPIO_PIN_11,SET);
+	//DC-DC power good indicat
+	rcu_periph_clock_enable(RCU_GPIOF);
+	gpio_mode_input(GPIOF, GPIO_PUPD_NONE, GPIO_PIN_7);
+	while(!IS_DCDC_POWER_GOOD());
 }
 
 static void enable_exti4_15_irq(int enable){

+ 1 - 1
Application/bsp/gpio.h

@@ -16,7 +16,7 @@ void gpio_init(void);
 /*switch for larger current DCDC  */
 #define DCDC_VOL_OPEN(x) gpio_bit_write(GPIOA,GPIO_PIN_11,(bit_status)(x))
 /* DCDC output power good detect */
-#define IS_DCDC_POWER_GOOD() gpio_input_bit_get(GPIOF, GPIO_PIN_7)
+#define IS_DCDC_POWER_GOOD() (gpio_input_bit_get(GPIOF, GPIO_PIN_7) == RESET)
 /*detect for charger in/out */
 #define IS_CHARGER_IN() !gpio_input_bit_get(GPIOB,GPIO_PIN_10)
 /*spi chip select for ml5238*/