A method for using controlled deep sleep
Patent Information
- Application Number
- CN202111650239.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2041-12-30
AI Technical Summary
DDR域一直供电,不能实现开机关机功能
[0047]由此,本申请的优势在于:只增加了一个MCU就实现了其他外部信号能唤醒系统以及实现开机关机功能。方法简单,经济实用。
Smart Images

Figure CN116414466B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of system sleep and wake-up technology, and in particular to a method for controlling deep sleep. Background Technology
[0002] The existing deep sleep design utilizes the sleep process provided by the Linux system, and designs both software and hardware for hibernate-level sleep. By combining the advantages of sleep and hibernate, it achieves ultra-low power consumption during sleep and fast wake-up functionality.
[0003] During hibernation, only the RTC and DDR domains remain powered, with the DDR entering a low-power self-refresh state. All other power domains are powered down, reducing power consumption. The PLL and DDR configurations are saved before hibernation. Upon system power-on, the system jumps directly to the RTCRAM to implement the wake-up function, restoring the PLL and DDR configurations and speeding up the wake-up process. Because the DDR is in self-refresh mode, the data is preserved and not lost. Upon program wake-up, it can continue running from where it left off before hibernation, without requiring a system reboot.
[0004] However, deep sleep only implements deep hibernation and wake-up functions. Only one wake-up WKUP button is connected to the RTC; other external signals cannot wake the system. The DDR domain is constantly powered, so power-on and power-off functions are not possible.
[0005] In addition, the following are commonly used terms in the prior art:
[0006] 1. Sleep / Wake-up: A power management method provided by the Linux system.
[0007] 2. idle, sleep: Hibernation modes provided by Linux power management.
[0008] 3. Hibernate: Hibernate mode provided by Linux power management.
[0009] 4. RTC: Real-time clock.
[0010] 5. RTC RAM: A segment of RAM space in the RTC domain used to save code and data during deep sleep.
[0011] 6. DDR: Double Data Rate Dynamic Random Access Memory.
[0012] 7. PLL: Phase-locked loop.
[0013] 8. DDR self-refresh: The DDR sends a refresh command every 64ms internally, without the need for controller intervention, ensuring that data is not lost.
[0014] 9.TCSM: A segment of SRAM space.
[0015] 10. Bootrom: The startup code embedded in the chip.
[0016] 11. UART (Universal Asynchronous Receiver-Transmitter) is a universal serial data bus used for asynchronous communication. It is a low-speed, full-duplex communication data bus. UART has two data transmission lines: TX (transmit data line) and RX (receive data line). UART_RX: Receive data (Rx): External device -> (serial input) rxd -> serial input shift register -> input data buffer -> MCU core. UART_TX: Transmit data (Tx): MCU core -> output data buffer -> serial shift output register -> txd (serial output) -> external device.
[0017] 12. GPIO (English: General-purpose input / output) is an abbreviation for general-purpose input / output. Summary of the Invention
[0018] To address the aforementioned issues, this method aims to add an external MCU, enabling multiple external signals to wake the device from deep sleep mode. It also achieves both deep sleep and power-on / off functionality through communication between the MCU and the CPU.
[0019] Specifically, the present invention provides a method for controlling deep sleep, the method comprising: adding an external MCU to the application system, the MCU being connected to the CPU interface and communicating via an interface protocol; obtaining the sleep level to be executed via a serial port protocol; determining whether the CPU is powered off and controlling the power on / off of the CPU via a power interface; the MCU being connected to the power control signal of the DDR to control the power on / off of the DDR;
[0020] The WKUP wake-up button connects to both the MCU and the CPU, enabling simultaneous input and output on the MCU side.
[0021] When the wake-up button WKUP is pressed, the CPU and MCU are woken up simultaneously;
[0022] When the MCU receives other GPIO interrupts, the MCU is woken up by first pulling the WKUP_N level signal low and then high to wake up the CPU.
[0023] Any GPIO interrupt can wake up the MCU; the MCU will automatically wake up internally as soon as it receives a GPIO interrupt signal. This MCU is external, and the specific steps may vary depending on the MCU model used.
[0024] The CPU's UART8_TXD and UART8_RXD are connected to the MCU's LPUART_RX and LPUART_TX. The two communicate via a serial port protocol. The CPU informs the CPU of the sleep level to be executed. The sleep levels include: idle, idle_pd, sleep, deep sleep, and poweroff. When the CPU executes different sleep levels, the MCU performs different operations accordingly.
[0025] The CPU's PWRON pin is connected to the MCU_PA3 pin of the MCU to determine whether the CPU is powered off and to control the power on / off of the CPU.
[0026] The MCU's MCU_PC4 is connected to the DDR's power control signal and is used to control the DDR's power on and off.
[0027] The method further includes at least one signal waking up from deep sleep: the MCU has multiple GPIOs, and the signal on the development board used as the wake-up source is connected to the MCU's GPIO. When the wake-up source signal changes between high and low levels, it can trigger an interrupt in the MCU. After the MCU detects the wake-up signal from the wake-up source, it pulls MCU_PC3 low and then pulls it high, that is, MCU_PC3 is connected to the CPU's WKUP_N signal. The WKUP_N level changes from high to low and then back to high, which is the CPU's wake-up signal. Here, the MCU pulling the level of MCU_PC3 simulates the signal used to wake up the CPU. The MCU sends the WKUP_N signal to the CPU through the GPIO simulation, and the CPU receives the WKUP_N signal to wake up the application system.
[0028] For the CPU, only WKUP_N can wake it up during deep sleep; for the MCU, any GPIO interrupt can wake it up. Here, the MCU is converted. When the button signal is used as the wake-up source, when the button is pressed, the GPIO interrupt generated by pressing the button first wakes up the MCU. Then, the MCU pulls the WKUP_N signal required by the CPU through GPIO simulation to wake up the CPU.
[0029] The signals used as wake-up sources include buttons, Wi-Fi, Bluetooth, etc.
[0030] The MCU has multiple GPIOs. The signal that you want to use as a wake-up source is connected to the MCU's GPIO. Any signal connected to the MCU's GPIO can also become a wake-up source.
[0031] The method further includes: the usage process of deep sleep:
[0032] a. The CPU sends a message to the MCU via UART to tell the CPU to execute deep sleep;
[0033] b. After receiving the information from the UART, the MCU sets itself to low-power mode;
[0034] c. The CPU enters deep sleep state, pulls PWRON low (i.e., pulls down the PWRON level signal), and the hardware circuit shuts down all power channels except for RTC, DDR, and MCU.
[0035] d. When the wake-up button WKUP is pressed, the CPU and MCU can be woken up simultaneously; when the MCU receives other GPIO interrupts, the MCU is woken up by first pulling the WKUP_N level signal low and then pulling it high to wake up the CPU.
[0036] e. RTC pulls PWRON high, which means raising the PWRON level signal to restore power to each channel;
[0037] f. The CPU exits deep sleep mode, and the MCU exits low-power mode.
[0038] The method further includes: a control flow for the power on / off function:
[0039] A. The CPU sends a message to the MCU via UART to tell the CPU to shut down;
[0040] B. The CPU executes the poweroff command to enter hibernate state, pulls PWRON low, and shuts down all power channels except for DDR and RTC;
[0041] C. After the MCU detects that PWRON is pulled low, it pulls MCU_PC4 low to turn off the DDR power; then the hardware turns off the MCU power; only the RTC domain power is retained, and the system enters the shutdown state.
[0042] Once PWRON goes low, only software control is needed to pull MCU_PC4 low; other operations are handled by hardware circuitry: when MCU_PC4 goes low, MCU_PA3 goes high, and MOSFET Q19 turns off; when the DDR_VDD1_EN_N pin goes high, MOSFET Q20 turns on, the EN terminal of power chip U12 is pulled down to about 0.1V, power chip U12 turns off, and MCU_3V3 loses power.
[0043] D. When the wake-up button WKUP is pressed, the WKUP_N signal is pulled low;
[0044] After E.RTC detects a change in the WKUP_N signal, RTC pulls PWRON high to restore power to all circuits;
[0045] F. CPU boots up, MCU boots up.
[0046] The application system includes Linux.
[0047] Therefore, the advantage of this application is that it only requires adding one MCU to enable other external signals to wake up the system and to realize the power-on and power-off functions. The method is simple, economical and practical. Attached Figure Description
[0048] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.
[0049] Figure 1 This is a circuit diagram showing the connection between the MCU and CPU via I / O in this application.
[0050] Figure 2 This is a schematic diagram illustrating the usage process of deep sleep in the method of this invention.
[0051] Figure 3 This is a schematic diagram of the control flow for the power on / off function in the method of the present invention.
[0052] Figure 4 This is a circuit diagram of the MCU power-off function in the method of the present invention. Detailed Implementation
[0053] To better understand the technical content and advantages of the present invention, the present invention will now be described in further detail with reference to the accompanying drawings.
[0054] The specific implementation of this application is a control method for a custom hibernation mode based on the deep sleep design developed by Beijing Junzheng Integrated Circuit Co., Ltd. (hereinafter referred to as Beijing Junzheng). This method is applicable to Linux application systems, but not only to Linux systems. The code or program involved in this method can also be used on other operating systems; however, for ease of understanding, this embodiment is placed on Linux.
[0055] This application provides a method for controlling deep sleep, the method comprising:
[0056] An external MCU is added to the application system. The MCU is connected to the CPU interface and communicates with it through the interface protocol: the hibernation level to be executed is obtained through the serial port protocol; the power interface is used to determine whether the CPU is powered off and to control the power on and off of the CPU; the MCU is connected to the power control signal of the DDR to control the power on and off of the DDR.
[0057] The WKUP wake-up button connects to both the MCU and the CPU, enabling simultaneous input and output on the MCU side.
[0058] When the wake-up button WKUP is pressed, the CPU and MCU are woken up simultaneously;
[0059] When the MCU receives other GPIO interrupts, the MCU is woken up by first pulling the WKUP_N signal low and then pulling it high to wake up the CPU.
[0060] Any GPIO interrupt can wake up the MCU; the MCU will automatically wake up internally as soon as it receives a GPIO interrupt signal. This MCU is external, and the specific steps may vary depending on the MCU model used.
[0061] Specifically, the method can be described as follows:
[0062] (a) The MCU and CPU are connected via I / O, such as Figure 1 As shown,
[0063] 1. The CPU's UART8_TXD and UART8_RXD are connected to the MCU's LPUART_RX and LPUART_TX. They communicate via serial protocol, specifying the desired sleep level, which includes: idle, idle_pd, sleep, deep sleep, poweroff, etc. The MCU performs different operations depending on the CPU's sleep level. The degree of power-off and clock-off varies across different sleep levels. These sleep levels are all implemented within the same codebase.
[0064] 2. The CPU's PWRON is connected to the MCU's MCU_PA3, which can determine whether the CPU is powered off and control the CPU's power on / off state.
[0065] 3. The MCU_PC4 of the MCU is connected to the power control signal of the DDR and is used to control the switching power of the DDR.
[0066] 4. The WKUP button is connected to both the MCU and the CPU. The MCU can perform both input and output simultaneously. When the WKUP button is pressed, both the CPU and the MCU can be woken up at the same time. When the MCU receives another GPIO interrupt, the MCU is woken up and pulls the WKUP_N signal low to wake up the CPU. Any GPIO interrupt can wake up the MCU; it will automatically wake up internally as soon as it receives a GPIO interrupt signal. This MCU is external, and the specific configuration may vary depending on the MCU model used.
[0067] (ii) Methods to wake up deep sleep with at least one signal
[0068] The MCU has multiple GPIOs. Connect the signal you want to use as a wake-up source on the development board to one of the MCU's GPIOs. When the wake-up source signal changes between high and low levels, it triggers an interrupt on the MCU. After detecting the wake-up signal from the wake-up source, the MCU pulls MCU_PC3 low and then pulls it high, connecting MCU_PC3 to the CPU's WKUP_N signal. The WKUP_N signal, transitioning from high to low and back to high, is the CPU's wake-up signal. By simulating the WKUP_N signal on MCU_PC3, the MCU sends the WKUP_N signal to the CPU, and the CPU receives the WKUP_N signal to wake up the system.
[0069] At least one signal is needed to wake someone from deep sleep:
[0070] For the CPU, only WKUP_N can wake it up during deep sleep.
[0071] For an MCU, any GPIO interrupt can wake it up. Here, the MCU performs a conversion: when other signals are used as wake-up sources, for example, a button, when the button is pressed, first the GPIO interrupt generated by pressing the button wakes up the MCU, and then the MCU pulls the WKUP_N signal needed by the CPU through GPIO simulation to wake up the CPU.
[0072] The signals that are intended to be used as wake-up sources include buttons, Wi-Fi, Bluetooth, etc. Any signal can be connected to the MCU's GPIO.
[0073] The MCU has multiple GPIOs, and signals that you want to use as wake-up sources can be connected to the MCU's GPIOs.
[0074] (III) Deep sleep usage process, such as Figure 2 As shown:
[0075] a. The CPU sends a message to the MCU via UART to tell the CPU to execute deep sleep.
[0076] b. After receiving the information from the UART, the MCU sets itself to low-power mode.
[0077] c. The CPU enters deep sleep state, pulls PWRON low, and the hardware circuit shuts down all power channels except for RTC, DDR, and MCU.
[0078] d. When the wake-up button WKUP is pressed, the CPU and MCU can be woken up simultaneously. When the MCU receives other GPIO interrupts, the MCU is woken up by first pulling the WKUP_N signal low and then high to wake up the CPU.
[0079] e.RTC raises PWRON to restore power to all circuits.
[0080] f. The CPU exits deep sleep mode, and the MCU exits low-power mode.
[0081] (iv) Power-off function usage procedure, such as Figure 3 As shown:
[0082] A. The CPU sends a message to the MCU via UART to tell the CPU to shut down.
[0083] B. The CPU executes the poweroff command to enter the hibernate state, pulling PWRON low and shutting down all power except for DDR and RTC. The poweroff command can only be executed when the CPU is in the hibernate state; the operation corresponding to the poweroff command is to enter the hibernate state.
[0084] C. After the MCU detects that PWRON is pulled low, it pulls MCU_PC4 low to shut down the DDR power. Then, the hardware shuts down the MCU power, such as... Figure 4 As shown: After PWRON goes low, you only need to pull MCU_PC4 low via software; other operations are handled by the hardware circuitry. Figure 4The circuit in the code is used to power off the MCU. MCU_PC4 is pulled low, then MCU_PA3 goes high, and Q19 is turned off. After DDR_VDD1_EN_N goes high, Q20 turns on, the EN pin of U12 is pulled down to about 0.1V, U12 shuts down, and MCU_3V3 loses power. Only the RTC domain is powered on, entering the shutdown state.
[0085] D. When the wake-up button WKUP is pressed, the WKUP_N signal is pulled low;
[0086] After E.RTC detects a change in the WKUP_N signal, RTC pulls PWRON high to restore power to all circuits;
[0087] F. CPU boots up, MCU boots up.
[0088] In addition, this application may also involve TCSM and Bootrom:
[0089] TCSM: A segment of SRAM used in this application to store and run hibernation code. The hibernation code is placed in TCSM and is inaccessible after DDR enters self-refresh mode. Before hibernation, there is still code to execute after DDR enters self-refresh mode, so both the DDR self-refresh and hibernation code are placed in TCSM. Alternatively, all hibernation code could be placed in TCSM; the current approach is to place it all in TCSM. Bootrom: Boot code embedded in the chip. Upon wake-up, when the CPU powers on, the program's PC pointer first jumps to the Bootrom to execute the program. The Bootrom checks if the system is in deep sleep. If it is in deep sleep, it jumps to RTC RAM to perform the wake-up operation. If it is not in deep sleep, the system proceeds with the normal boot process.
[0090] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations can be made to the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for controlling deep sleep, characterized in that, The method includes: An external MCU is added to the application system. This MCU connects to the CPU via an interface and communicates through an interface protocol: the desired sleep level is obtained via a serial port protocol, and the sleep level includes: idle. The MCU controls whether the CPU is powered off and controls the CPU's power on / off state via the power interface. The MCU is connected to the DDR's power control signal to control the DDR's power on / off state. The WKUP wake-up button connects to both the MCU and the CPU, enabling simultaneous input and output on the MCU side. When the wake-up button WKUP is pressed, the CPU and MCU are woken up simultaneously; When the MCU receives another GPIO interrupt, the MCU is woken up, and the GPIO is first pulled low and then pulled high. The signal is used to wake up the CPU.
2. The method for controlling deep sleep according to claim 1, characterized in that, The CPU and Connecting to MCU and The two parties communicate via a serial port protocol, with the CPU informing the CPU of the desired sleep level. The MCU performs different operations depending on the sleep level the CPU executes.
3. The method for controlling deep sleep according to claim 1, characterized in that, The CPU's PWRON pin is connected to the MCU. The pin is used to determine whether the CPU is powered off and to control the power on / off of the CPU.
4. A method for controlling deep sleep according to claim 1, characterized in that, The MCU The pin is connected to the DDR power control signal and is used to control the DDR's power on and off.
5. A method for controlling deep sleep according to claim 1, characterized in that, The method further includes waking the person from deep sleep by at least one signal: The MCU has multiple GPIOs. The wake-up signal from the development board is connected to one of the MCU's GPIOs. When the wake-up signal changes between high and low levels, it triggers an interrupt in the MCU. After detecting the wake-up signal from the wake-up source, the MCU pulls it low. The pin level is then pulled high, i.e. Connected to the CPU on signal; The voltage level changes from high to low and then back to high; this is the CPU wake-up signal, which is pulled by the MCU. The voltage level simulates the signal used to wake up the CPU; the MCU sends the signal through GPIO simulation. The signal is sent to the CPU, and the CPU receives it. Signal wake-up of application systems.
6. A method for controlling deep sleep according to claim 5, characterized in that, For the CPU, only during deep sleep... Able to wake up the CPU; For an MCU, any GPIO interrupt can wake it up. Here, we've implemented a conversion using the MCU: when a button signal is used as the wake-up source, pressing the button first generates a GPIO interrupt that wakes up the MCU. Then, the MCU uses GPIO simulation to pull the necessary CPU signals. Signal to wake up the CPU; The signals used as wake-up sources include buttons, Wi-Fi, and Bluetooth. The MCU has multiple GPIOs. The signal you want to use as a wake-up source is connected to the MCU's GPIO. Any signal connected to the MCU's GPIO can also become a wake-up source.
7. A method for controlling deep sleep according to claim 1, characterized in that, The method further includes: the usage process of deep sleep: a. The CPU sends a message to the MCU via UART to tell the CPU to execute deep sleep; b. After receiving the information from the UART, the MCU sets itself to low-power mode; c. The CPU enters deep sleep state, pulls PWRON low (i.e., pulls down the PWRON level signal), and the hardware circuit shuts down all power channels except for RTC, DDR, and MCU. d. When the wake-up button WKUP is pressed, the CPU and MCU can be woken up simultaneously; when the MCU receives other GPIO interrupts, the MCU is woken up by first pulling it low and then pulling it high. The level signal is used to wake up the CPU; e. RTC pulls PWRON high, which means raising the PWRON signal level to restore power to all channels; f. The CPU exits deep sleep mode, and the MCU exits low-power mode.
8. A method for controlling deep sleep according to claim 1, characterized in that, The method further includes: a control flow for the power on / off function: A. The CPU sends a message to the MCU via UART to tell the CPU to shut down; B. The CPU executes the poweroff command to enter hibernate state, pulls PWRON low, and shuts down all power channels except for DDR and RTC; C. After the MCU detects that PWRON has been pulled low, it pulls it low. Power off the DDR; then power off the MCU via hardware; power is left on only the RTC domain, and the system enters shutdown mode. Once PWRON decreases, you only need to control the pull-down. Other operations are performed by hardware circuitry: that is... Pull down, then When the voltage rises, MOSFET Q19 turns off. When the pin goes high, MOSFET Q20 turns on, the EN terminal of power supply chip U12 is pulled down to about 0.1V, and power supply chip U12 turns off. Power outage; D. When the wake-up button WKUP is pressed. The signal was pulled low; E. RTC detected After the signal changes, the RTC pulls PWRON high to restore power to all circuits; F. CPU boots up, MCU boots up.
9. A method for controlling deep sleep according to claim 1, characterized in that, The application system includes Linux.
Citation Information
Patent Citations
Dormancy wakeup control method and system of wireless communication equipment
CN104411003A
DCM (Door Control Module) dormancy quiescent current control system, and control method
CN110244595A