This experiment uses the "WKUP" button and "LED" on the MM32F103 development board to test "standby wakeup". I. Experimental resources 1. MM32F103 development board; 2. KEIL 5.25.2; 3. J-LINK V9; 4. Development routines provided by New Driving Force; 5. Multimeter; II. Experimental process 1. Knowledge preparation and hardware connection. From the user manual, we can learn that the
MM32F103C8T6 chip using the ARM Cortex M3 core also has three low-power modes in terms of power management, namely: 1. Sleep mode (CPU stops, all peripherals including CPU peripherals, such as NVIC, system clock (SysTick) , etc. are still running); 2. Stop mode (all clocks are stopped); 3. Standby mode (1.5V power is turned off);
From the above table, we can see that among the three low-power modes, the "standby mode" has the lowest power consumption performance. In the experiment, the condition for waking up from the "standby mode" utilizes the "rising edge of the WKUP pin". According to the schematic diagram, connect the "WKUP" button to "VDD". When a rising edge appears on PA0 (WKUP), the system will wake up from the "standby mode".
2. Implementation of the program. The program is modified based on the official routine. When the system is powered on, D2 lights up for 3 seconds and then goes out, and the system enters "standby mode". Then the system begins to monitor the status of the "WUKA" button. When the "WKUP" button is pressed and a rising edge appears on PA0 (WKUP), the system wakes up from "standby mode", and D2 lights up for 5 seconds and then enters "standby mode" again, waiting for the next "wake-up". The following is the main program code: - int main(void) { u8 i; delay_init(); /* Set interrupt priority group 2*/ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); LED_Init(); WKUP_Init(); //External interrupt wake-up standby initialization for(i=0; i<3; i++)//D2 lights up for 3 seconds after power-on and then goes out; { LED = 0; delay_ms(1000); } LED = 1; Sys_Standby(); //Enter standby mode while(1) { if(Check_WKUP()==1)//Wait for the WKUP key to be pressed to wake up { for(i=0; i<5; i++) { LED = 0; delay_ms(1000); } } else Sys_Standby();//After working for 5 seconds, enter standby state and wait for the next wake-up } }
复制代码3. Experimental results. Remove the P13 jumper cap and connect the multimeter in series. Here, the "20mA" position is used. One for standby; one for wakeup;
4. The problem that occurred during the process is as shown in the figure below:
I checked online and found that the chip should be asleep in "standby mode". According to the method I thought of: first press "RESET" and then "Download", and when it is almost time, release "RESET" and it will work normally. It takes some time to release "RESET", but it is not difficult to try a few times. 3. Experimental summary The first time I experienced "standby mode", I just did a simple test based on the routine. Many internal things are still unclear. I will study the code carefully and learn from the manual.