你好,我复制了你的代码,没有做任何改动,在我的时钟配置下波特率是9600,还是断电后不能唤醒,现象一样。
我在想是不是进入VLPS模式的代码有问题:
void enter_vlps(void){
volatile unsigned int dummyread;
/* The PMPROT register may have already been written by init code
If so then this next write is not done since
PMPROT is write once after RESET
allows the MCU to enter the VLPR, VLPW, and VLPS modes.
If AVLP is already writen to 0
Stop is entered instead of VLPS*/
SMC_PMPROT = SMC_PMPROT_AVLP_MASK;
/* Set the STOPM field to 0b010 for VLPS mode */
SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK;
SMC_PMCTRL |= SMC_PMCTRL_STOPM(0x2);
/*wait for write to complete to SMC before stopping core */
dummyread = SMC_PMCTRL;
dummyread++;
/* Now execute the stop instruction to go into VLPS */
SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;
asm("WFI");
} |