FR8008GP进入sleep异常
-
进入sleep后自动复位,是什么原因
-
有以下原因
1、不能关闭串口0
2、使用最新版本sdk确保user_entry_after_sleep_imp里面调用了pmu_calibration_start这个函数
attribute((section("ram_code"))) void user_entry_before_sleep_imp(void)
{
pmu_calibration_stop();uart_putc_noint_no_wait(UART0, 's'); co_delay_100us(1); pmu_set_pin_to_PMU(GPIO_PORT_A, (1<<GPIO_BIT_0)); pmu_set_pin_dir(GPIO_PORT_A, (1<<GPIO_BIT_0), GPIO_DIR_IN); pmu_set_pin_pull(GPIO_PORT_A, (1<<GPIO_BIT_0),GPIO_PULL_NONE);
}
/*********************************************************************
-
@fn user_entry_after_sleep_imp
-
@brief After system wakes up from sleep mode, user_entry_after_sleep_imp()
-
will be called, MCU peripherals need to be initialized again,
-
this can be done in user_entry_after_sleep_imp(). MCU peripherals
-
status will not be kept during the sleep.
-
@param None.
-
@return None.
*/
attribute((section("ram_code"))) void user_entry_after_sleep_imp(void)
{
pmu_set_pin_to_CPU(GPIO_PORT_A, (1<<GPIO_BIT_0));system_set_port_mux(GPIO_PORT_A, GPIO_BIT_0, PORTA0_FUNC_UART0_RXD);
system_set_port_mux(GPIO_PORT_A, GPIO_BIT_1, PORTA1_FUNC_UART0_TXD);
uart_init(UART0, 1152);
fr_uart_enableIrq(UART0, Uart_irq_erbfi);/* RC calibration start. Ensure the accuracy of sleep wake time */
pmu_calibration_start(PMU_CALI_SEL_RCLFOSC, LP_RC_CALIB_CNT);uart_putc_noint_no_wait(UART0, 'w');
co_delay_100us(1);NVIC_EnableIRQ(PMU_IRQn);
}
-
-
@mars 这样配置了还不行,已经把按键设置成了唤醒源,按键配置时需要配置普通输入模式还是外部中断模式,目前配置成普通输入模式后设置成唤醒源,进入sleep后,按按键打印freqchip
-
sleep之后gpio会掉电,要使用pmu开控制io口有对应的
pmu_set_pin_to_PMU
pmu_set_pin_mux
pmu_set_pin_dir
然后对应的中断在pmu_isr
还有疑问请联系我的qq:1063246644