GD32F4xx_Demo_Suites里的PMU_Sleep_Wakeup示例没有展示如何从串口从deepsleep状态唤醒
官方应用笔记中的sleep相关的串口唤醒也是有uart WAKEUP功能的串口器件,没有GD32F103或GD32F4XX系列的串口deepsleep唤醒示例
我尝试了几次,deepsleep后从串口输入字符,灯没有闪,都没有成功,请问GD32官方论坛的研发人员如何解决该问题
下面是大概的代码框架, 串口RX是PA10(EVAL_COM0)
void prepare_sleep()
{
usart_disable(EVAL_COM0);
usart_interrupt_disable(EVAL_COM0, USART_INT_RBNE);
usart_deinit(EVAL_COM0);
gpio_mode_set(EVAL_COM0_GPIO_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP,EVAL_COM0_RX_PIN);
gpio_output_options_set(EVAL_COM0_GPIO_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,EVAL_COM0_RX_PIN);
nvic_irq_enable(EXTI10_15_IRQn, 2U, 0U);
syscfg_exti_line_config(EXTI_SOURCE_GPIOA, EXTI_SOURCE_PIN10);
exti_init(EXTI_10, EXTI_INTERRUPT, EXTI_TRIG_RISING);
exti_interrupt_flag_clear(EXTI_10);
exti_interrupt_enable(EXTI_10);
}
void do_sleep()
{
rcu_periph_clock_enable(RCU_PMU);
pmu_to_deepsleepmode(PMU_LDO_NORMAL, PMU_LOWDRIVER_DISABLE, WFI_CMD);
while (1) {
toggle_alarmled(); //灯没有闪
delay_ms(500);
}
}
void EXTI15_10_IRQHandler()
{
if(exti_interrupt_flag_get(EXTI_10) != RESET){
do_wakeup_irq();
exti_interrupt_flag_clear(EXTI_10);
}
}
void do_wakeup_irq()
{
SystemInit();
SystemCoreClockUpdate();
systick_config();
}
int main()
{
//闪灯初始化,略
//串口初始化,略
prepare_sleep();
do_sleep();
}
|