Uart-based wake-up from sleep method and device
Abstract
Disclosed is a universal asynchronous receiver/transmitter (UART)-based wake up from sleep method. The method comprises: when no data is to be transmitted, a first device notifying via a tx signal line of the UART of self a second device in communication with the first device; when the second device receives the notification and the second device has no data to be transmitted to the first device, notifying the first device via the tx signal line of the UART of self, and putting the UART of self into sleep state; when the first device receives the notification, putting the UART of self into sleep state; the first device and the second device regularly inspect the output state of rx signal lines of selves, when the output state of the rx signal lines of selves is determined to be having data to be received, waking up the UART of selves. Also disclosed is a UART-based wake up from sleep device. Employment of the method and the device allows for reduced power consumption on the device and reduced use of GPIO resource of the device.

Term
No projected expiry on record.
- Priority
- Filed
- Published
- Today
10 claims: 2 independent, 8 dependent
- 1权利要求书 1、 一种基于通用异步接收 /发送装置(UART ) 的睡眠唤醒方法, 其特 征在于, 该方法包括: 当没有数据发送时, 第一设备通过自身 UART的 tx信号线通知与所述 第一设备进行通信的第二设备; 所述第二设备收到通知后且自身没有数据发送给所述第一设备时, 通 过自身 UART的 tx信号线通知所述第一设备,并使自身的 UART进入睡眠 状态; 所述第一设备收到通知后, 使自身的 UART进入睡眠状态; 所述第一设备及所述第二设备定时检测自身 rx信号线的输出状态, 确 定自身 rx信号线的输出状态为有数据接收时, 唤醒自身的 UART。
- 22、 根据权利要求 1所述的方法, 其特征在于, 所述第一设备通过自身 UART的 tx信号线通知与第一设备进行通信的第二设备, 为: 所述第一设备将自身的 tx信号线设置为中断(break )模式。
- 33、 根据权利要求 2所述的方法, 其特征在于, 所述通过自身 UART的 tx信号线通知所述第一设备, 为: 所述第二设备将自身的 tx信号线设置为 break模式。
- 44、 根据权利要求 1、 2或 3所述的方法, 其特征在于, 所述定时检测 自身 rx信号线的输出状态,确定自身 rx信号线的输出状态为有数据接收时, 唤醒自身的 UART, 为: 设置定时检测自身 rx信号线引脚状态的函数, 并在定时检测函数的唤 醒处理中增加 UART恢复函数, 通过定时检测函数, 检测设备自身 rx信号 线的输出状态, 并在确定设备自身 rx信号线的电平值为高时, 通过 UART 恢复函数唤醒设备自身的 UART。
- 55、 根据权利要求 1、 2或 3所述的方法, 其特征在于, 所述定时检测 自身 rx信号线的输出状态,确定自身 rx信号线的输出状态为有数据接收时, 唤醒自身的 UART, 为: 设置 rx中断,并在中断处理中增加 UART恢复函数,设备自身 rx信号 线的电平值不为低时, 触发所述 rx中断, 并通过 UART恢复函数唤醒设备 自身的 UART。
- 66、 根据权利要求 1、 2或 3所述的方法, 其特征在于, 所述定时检测 自身 rx信号线的输出状态,确定自身 rx信号线的输出状态为有数据接收时, 唤醒自身的 UART, 为: 设置通用输入输出 (GPIO ) 中断, 并在中断处理中增加 UART恢复函 数, 设备检测到边沿或电平值为高时, 触发所述 GPIO中断, 并通过 UART 恢复函数唤醒设备自身的 UART。
- 77、 根据权利要求 1、 2或 3所述的方法, 其特征在于, 所述确定自身 rx信号线的输出状态为有数据接收时的时机为: 数据发送方发送事先约定的字符; 或者, 数据发送方发送脉沖信号, 延时后再向数据接收方发送事先约定的字 付。
- 88、根据权利要求 7所述的方法,其特征在于,在唤醒自身的 UART后, 该方法进一步包括: 向数据发送方返回表示已唤醒的字符。
- 99、 一种基于 UART的睡眠唤醒装置, 其特征在于, 该装置包括: 第一 设备及第二设备; 其中, 第一设备, 用于当没有数据发送时, 通过自身 UART的 tx信号线通知 第二设备; 并在收到第二设备的通知后, 使自身的 UART进入睡眠状态; 并定时检测自身 rx信号线的输出状态,确定自身 rx信号线的输出状态为有 数据接收时, 唤醒自身的 UART;第二设备, 用于收到第一设备发送的通知后, 且自身没有数据发送给 第一设备时, 通过自身 UART的 tx信号线通知所述第一设备, 并使自身的 UART进入睡眠状态; 并检测自身 rx信号线的输出状态, 确定自身 rx信号 线的输出状态为有数据接收时, 唤醒自身的 UART。
- 1010、 根据权利要求 9所述的装置, 其特征在于, 所述第一设备, 还用于睡眠后当有数据发送给第二设备时, 唤醒自身 的 UART, 并通过自身的 tx信号线发送事先约定的字符给第二设备, 并接 收第二设备返回的表示已唤醒的字符; 所述第二设备, 还用于收到第一设备发送的字符后, 通过自身的 tx信 号线向第一设备返回表示已唤醒的字符; 或者, 所述第二设备, 还用于睡眠后当有数据发送给第一设备时, 唤醒自身 的 UART, 并通过自身的 tx信号线发送事先约定的字符给第一设备, 并接 收第一设备返回的表示已唤醒的字符; 所述第一设备, 还用于收到第二设备发送的字符后, 通过自身的 tx信 号线向第二设备返回表示已唤醒的字符。
Independent claims10
72 paragraphs in 1 section, as filed
TECHNICAL FIELD
The present invention relates to the field of wireless communications, particularly based refers to a universal asynchronous receiver / transmitter device
(UART, Universal Asynchronous Receiver / Transmitter) sleep wake method and apparatus. Background technique
Serial also called a serial communication interface, serial communication Due to the use of simple lines can achieve a strong signal transmission function, transmission speed and wide range of advantages, in recent years has become the most widely used communication interface. Which, due to having more types of such a wide range of serial transmission speed; serial interface types include: UART, serial peripheral interface (SPI, Serial Peripheral Interface), and a universal serial bus (USB, Universal Serial BUS) and the like. Wherein, UART Because of low power consumption, communication control is simple, does not require drivers, as well as in the absence of data transmission can be closed data port, etc. Therefore, in practical application, many devices as the primary interface to the UART communication.
Currently, when you use UART communication between devices, the main use of four-wire (tx, rx, cts, and rts) and two lines (rx and tx) connection. Among them, the four-wire connection, using cts and rts can control the flow of data, this connection may also be referred to as connection flow control, the use of flow control connections can be inconsistent at both sides of communication transmission rate case to ensure that no data is lost. In practical application, if not as a UART modem (modem) port to use when it is not necessary to use a four-wire connection, using a two-wire connection is completely meet the demand. This is because: most of the current applications, just as a simple UART communication port, such as: simple interaction performed only AT commands and not as a dial-up modem port to use; In addition, with equipment such as: Application Processor ( increase in AP, Application Processor) peripheral devices, chip general purpose input output (GPIO, General Purpose input Output) and other resources will become increasingly strained due to a two-wire flow control used alternately as GPIO, if a two-wire connection, you can save two GPIO resources, so that AP is more flexible, and more control for simplicity, which can not only improve efficiency, but also reduce resource intensive.
Currently, when inter-AP devices connected to the use of UART communication, the presence of several sleep wake-up methods:
(1) UART has been open only when the AP tasks executed and no sleep, the UART sleep, and when there are tasks to perform AP, then wake up again UART, UART when due or need to perform tasks regardless AP, UART are awake state, and so it will increase the AP power consumption is not conducive AP design.
(2) through a custom sleep and wake-up signal indicating achieve bidirectional UART wake-up due to the custom of sleep and wake-up signal indicating the need to occupy AP GPIO resources, so it will increase the AP of resource utilization.
(3) the two lines as flow control using multiplexed into GPIO, the use of two-way flow control role wake, which applies only to the four-wire connection mode, and the method will also increase the occupancy rate of the AP GPIO resources. SUMMARY
In view of this, the main object of the present invention is to provide a method and apparatus based on sleep wake UART, and can reduce the power consumption of the device, and can reduce the use of GPIO resources.
To achieve the above object, the present invention is implemented as follows:
The present invention provides a method of sleep wake UART based, the method comprising: when no data is sent, the first device informs the second device in communication with the first device through its UART the tx signal line;
Upon receipt of the notification and the second device itself when no data is sent to the first device, the first device through its own notify the UART tx signal line, and the UART itself to sleep; The first device after notification, to make their own UART to sleep; the first device and the second device output state itself rx timing detection signal line, to determine the status of the output signal line is itself rx data Upon receipt, the wake itself UART.
The above-described embodiment, the first device by a signal line tx notify the first device of its own UART second communication device for:
The first device itself tx interrupt signal line (break) mode.
The above-described embodiment, the through its own UART signal line tx of the first notification device, as follows: the second device itself tx break mode is set to the signal line.
The above-described embodiment, the situation at the timing detection output signal line rx, rx itself determines the state of the output signal lines for receiving data, the wake-up itself UART, is:
Set the timing detection signal line itself rx pin state functions, and wake-up timing detection function recovery process to increase UART function by timing detection function detects the device itself rx signal line output state, and determining the device itself rx signal line the level is high, the recovery function via UART wake the device itself UART.
The above-described embodiment, the situation at the timing detection output signal line rx, rx itself determines the state of the output signal lines for receiving data, the wake-up itself UART, is:
Setting rx interrupts and interrupt handling increase UART recovery function, the device itself level value rx signal line is not low, triggering the rx interrupt and resume function through UART wake the device itself UART.
The above-described embodiment, the situation at the timing detection output signal line rx, rx itself determines the state of the output signal lines for receiving data, the wake-up itself UART, is:
Setting GPIO interrupt, and interrupt handling increased UART recovery function, the device detects the edge or level is high, triggering the GPIO interrupt, and the UART recovery function wakes up the device itself UART.
When the above-described embodiment, the determination signal output line rx own status data is received at the Machine is:
Data sent by the sender prior agreement of character; or
Data sent by the sender pulse signal delay after receiving the data sends word prior agreement to pay.
The above-described embodiment, the wake-up after the UART itself, the method further comprising:
Returns to the data indicates that the sender wake characters.
The present invention also provides a wake-up device based on a UART sleep, the apparatus comprising: a first device and a second device; wherein,
The first device for, when no data is sent to inform the second device through its UART tx signal line; and after notification of the second device, make their own UART goes to sleep; and the timing detection signal line itself rx output state, determine the output state itself rx signal lines for data reception, wake itself UART;
After the second device, the first device to send notification for receipt, and did not send itself to the first device, the first device through its own notice of tx UART data signal lines, and the UART itself to sleep; and the detection output signal line rx state itself, determine the output state itself rx signal line for data reception, wake itself UART.
The above-described embodiment, the first device, also used to sleep after when data is sent to a second device, wake own UART, and through its own tx signal lines previously agreed to send a character to the second device, and receives the first returned indicates that the second device to wake the character;
After the second device, the first device transmits the character also for receiving, through its own tx signal line indicates that the device returns to the first wake-up character; or
The second device, also used when there is sleep after sending data to the first device, wake own UART, prior agreement and send a character through its own tx signal line to the first device, the first device to receive and return It represents the awakened character;
After the first device, the second device is also sent to the character received a letter through its own tx Return line to the second device indicates wake characters.
Based on the present invention provides apparatus and methods for waking sleep UART when no data is transmitted, the first device informs the second device in communication with the first device through the UART itself tx signal line; the second device receives after the notice and the data itself is not sent to the first device, the first device through its own notify the UART tx signal line, and the UART itself to sleep; the first device after receiving the notice, to make their own the UART sleep; the first device and the second device state timing detection output signal line itself rx, rx itself determines the output state of the signal line for data reception, the wake-up itself UART, thus, can be reduced power equipment, and also reduce the use of equipment GPIO resources. BRIEF DESCRIPTION
Figure 1 is a schematic diagram based on the process flow UART sleep wake;
Figure 1 of the present invention is based on how the device is connected to the UART communication between the schematic diagram; Figure 3 is a schematic view of apparatus of the invention based on the structure of the sleep wake UART. detailed description
Below in conjunction with the accompanying drawings and specific embodiments of the present invention is further described in further detail.
The method of the present invention is based on the sleep wake up the UART, shown in Figure 1, comprising the following steps: Step 101: When there is no data transmission, a first notification device to communicate with the first device through its UART of second signal lines tx equipment;
Here, FIG. 1 of the present invention the first device and the second communication device connection diagram can be seen from Figure 2, the first device and the second device via the two-wire connection communication, namely: a first signal line tx said device is a signal line of said second device rx, rx of the first device the signal line for the signal line tx second device, wherein, tx signal line for transmitting data, rx for receiving a data signal line; Furthermore, in order to ensure the stability of the transmission signal, the signal can also increase the GND line, the table between the first device and the second device Shows the ground;
Since the present invention uses two-wire connection, no GPIO can assist, therefore, when the first device is not transmitting data, must be notified to the second device through the tx signal line;
Based on RS232 agreement: during data transmission, in order to make the data block transmission can be spaced apart in the process of sending the signal line tx can be set to break mode, namely: that the level of the signal line tx value is zero; therefore the specific implementation of this step may be:
When no data is sent, the first device itself tx signal line is set to break mode; wherein the break is set to the same mode specific processing of the prior art specific process flow, not repeat them here; to after the break mode, the level value of the first device signal line tx is zero, so in order to inform the second device does not transmit the data;
The first device and the second device can be any protocol follows the RS232 communication device based on a UART, the first device may be a particular AP, or a personal computer (PC, Personal Computer), etc. Accordingly, the second device may be an AP, or PC and other devices that communicate using the UART.
Step 102: Upon receipt of the notification and the second device itself when no data is sent to the first device, the first device through its own notify the UART tx signal line, and the UART itself to sleep;
Here, the first signal line tx apparatus after break mode, the second device detects the level value of said first signal line tx apparatus has continued to zero, the second device may thus determining that the first device sends no data; therefore, the second device receives the notification of the specific implementation, may be:
The second device is detected duration reaches a predetermined level value of the long first device signal line tx is zero, it indicates that the device includes UART first sleep condition;
Wherein, in the practical application, the second device detects the signal of the first device tx After the level value of zero line, you can start a timer after the timer expires, if the level value of the first device tX signal line continued to zero in the timer length of time, is considered the first UART devices have a sleep condition; duration of the timer can be set according to need, such as: 50ms, 100ms, etc.;
The notification through its own UART signal line tx of the first device, specifically: the second device itself tx break mode is set to the signal line; wherein, break mode is set to the specific process flow in the prior art specific process flow is identical, not repeat them here; if the second device receives the notification itself and also when data is transmitted to the first device does not send any information to the first device;
The second device to make their own UART to sleep with the specific process is identical to the process of the prior art, no further explanation.
Step 103: After receiving the notification of the first device, to make their own UART sleep; when the level reaches a predetermined length corresponding to the value, the first device to the second device to detect tx signal line is zero after a long time, it can be considered the second device includes UART sleep conditions;
Wherein, in the practical application, the first device in the level value detection device to the second signal line tx is zero, you can start a timer after the timer expires, if the second device level value tx signal line continued to zero in the length of time the timer is considered the second device includes UART sleep conditions; duration of the timer can be set according to need, such as: 50ms, 100ms, etc;
The first device to make their own UART to sleep with the specific process is identical to the process of the prior art, no further explanation.
Step 104: the first device and the second device state timing detection output signal line itself rx, rx itself determines the state of the output signal lines for receiving data, the wake-up itself UART.
Here, since the UART communication based, without any external hardware terminals can benefit Use, therefore, can only be detected and wake UART by way of software; in particular, can be: to set the timing detection function itself rx pin state of the signal line, and to increase UART function recovery process in the wake of the timing detection function by timing detection function detects the device itself rx signal line output state, and the device itself rx level determination signal line is high, the recovery function via UART wake the device itself UART; wherein the timing length of time can be set based on the need , tested by the test risk, timing duration may be any value between 50 ~ 500ms, such as: 100ms, etc;
In practical applications, devices communicating with the AP typically comes rx interrupt detection mechanism, therefore, if the device has a built-in communication rx interruption, the specific implementation of this step can also: Set rx interrupt, and interrupt processing increase UART recovery function, as long as the device itself detected level value rx signal line is not low, that is: when the level value is not zero, triggering the rx interrupt, so as to awaken the device itself UART;
In practical application, if the first device and / or the second device comes with a GPIO interrupt, the implementation of this step can also:
Setting GPIO interrupt, and interrupt handling increased UART recovery function, as long as the device detects an edge or level is high, the GPIO interrupt is triggered, so as to awaken the device itself UART;
Wherein, if the data sender tx signal lines multiplexed with GPIO, this time, the sender through its own tx signal line that is the recipient of the rx signal line is transmitted pulse signal can be set to trigger by detecting the edge or level value GPIO interrupt, if the sender of the signal line tx no longer used as GPIO, this time sent by the sender is a character, is set by detecting the edge triggered GPIO interrupts; detected edge may be rising or falling concrete; in practice the application can choose to detect rising and falling edges to trigger any one GPIO interrupt;
In practical application process, the first device and the second device can select the three detection methods and wake any one; Here, the first device and the second device using the above-described other side has been notified in advance which method detects and wakes UART; the first device and the second device determines the output state of the signal line itself rx is the reception data when the timing is: the other device has data to send at this time, the other device to wake itself UART, after the two sides agreed in advance to send a character, so that the data receiver can wake up its own UART, wake up and then send the data;
Specifically, if the recipient uses to set the timing detection function, or operating mode rx interrupt wake-own UART, communication between the parties, namely: the first device and the second device send to each other prior agreement good characters and other feedback indicates wake characters when transmitting data, the sender 先向 prior agreement of the recipient to send the characters, etc. upon receipt of the returned indicates wake of characters, and then send the data; for example after, for a device to communicate with the AP and, when sending data to the device needs to communicate with the AP, the communication device sends AP give an aT, the communication device receives its wake aT UART, returns OK to AP , AP then sends the received data to the device in communication OK, if the AP does not receive a return of a communication device within a predetermined length OK they can then transmit the communication device an aT, and so on, until the receipt of a communication device return OK so far; when the device is in communication needs to send data to the AP, the device sends a communication give AP OK, AP received OK to wake itself UART, the communication device transmits return to aT, the communication device receives aT and then send the data to the AP, if the device does not receive a communication in a predetermined AP returned aT length of time, you can send an AP again OK, so the cycle until it receives AP until the return of aT; wherein a predetermined length of time can be based on need to be set, for example: 50ms;
When the recipient uses to set GPIO interrupt wake-own UART, if the sender tx signal lines multiplexed with GPIO, at this time, the sender first sends a pulse signal, when the recipient receives the pulse signal to wake itself UART, to ensure that the receiver has to wake itself UART, such as may be after a certain interval of 40ms, send characters to the prior agreement of the receiving side, and so upon receipt of the returned indicates wake of characters, and then send the data; for example, for the AP and its Communication equipment, and if the AP uses to set GPIO wake-up interrupt its UART, and with the tx signal line communication apparatus AP multiplexed into GPIO, when the device needs to communicate with the AP to the AP sends data communication equipment AP sends a pulse signal delay after 40ms, again AP sends an OK, after AP receives a pulse signal to wake itself UART, and after receiving the OK, the communication device returns the device aT, give a communication received aT and then send data to the AP, if the device has not received communication AP aT returned within a predetermined length, you can send an AP again OK, so the cycle until it receives AP until the return of aT; wherein the predetermined length can based on the need to set, such as: 50ms;
If the sender of the signal line tx no longer used as GPIO, this time, since the receiver can not detect level value, so that the recipient's condition is triggered GPIO interrupts: edge detection, namely: rising or falling edge is detected, in practical applications, can be set to detect rising or falling edge detection to trigger GPIO interrupt, before sending data, the receiver sends the prior agreement of the characters, and so receive any return, said after the awakened character, then send the data; for example, for the AP and its communication equipment, and if the AP uses to set GPIO interrupt wake-own UART, and with the tx signal line AP communication equipment no longer used as GPIO, when communication with the AP when the device needs to send data to the AP, the AP sends a Xianxiang OK, AP after receiving the OK to wake itself UART, return device to device communication aT, aT communications received before sending data to the AP, if the communication device AP received no return within a predetermined length of aT, you can send an AP again OK, so the cycle until it receives AP until the return of aT; wherein the length can be set according to the needs specified, such as: 50ms;
It should be noted that: due to inter apparatus of the invention is based on the UART for two-wire connection, so any character, the pulse signal, and the data sent by the sender of a communication connection to the receiving etc through its own signal line tx party accordingly, any characters, the pulse signal receiving direction return to the sender, and the like were also returned by the data itself tx signal line to the sender. To achieve the above-described method, the present invention also provides a wake-up device based on UART sleep, as shown in Figure 3, the apparatus comprising: a first device 31 and second device 32; wherein,
The first device 31 and second device 32 includes UART module;
The first device 31 for when there is no data to send, through its own UART notify the tx signal lines of the second device 32; and upon receipt of notification of the second device 32, so that its UART goes to sleep; and timing detection itself rx line status output signal to determine the state of their own rx output signal line for data reception, wake itself UART.
After the second device 32, the notification sent by the first device 31 for receiving and transmitting the data itself is not the first device 31 to notify the first device 31 through the UART tx signal line itself, and make its own UART goes to sleep; and detecting the state of its own output signal line rx, rx itself determines the output state of the signal line for data reception, the wake-up itself UART.
It should be noted that: a first device 31 and second device 32 using two-wire connection to communicate.
Wherein the first device 31, is also used to sleep there after when data is sent to the second device 32, Wake own UART, and through its own tx signal line transmitting the prior agreement of the character to the second device 32, and receives the second device 32 is returned indicates wake of characters;
After the second device 32, the first device 31 is also used to send characters received, through its own tx signal line 31 is returned to the first device indicates the awakened character; or
The second device 32 is also used to sleep after 31 when data is sent to the first device, wake itself UART, and through its own tx signal line transmitting the prior agreement of the character to the first device 31 and receives a first return device 31 indicates the awakened character;
After the first device 31, a second device 32 is also used to send characters received, through its own tx signal line 32 returns to the second device indicates wake characters.
Here, the specific process of the apparatus of the present invention, the first device and the second device has been reviewed above, will not repeat them. The above is only the preferred embodiments of the present invention only, not intended to limit the scope of the present invention, any modifications within the spirit and principles of the present invention made, equivalent replacement and improvement, etc., should be included in within the scope of the present invention.
2 sheets
Sheet 1 Sheet 2
Every citation, both ways
| Document | Relation | Office | Category | Cited during |
|---|---|---|---|---|
| CN111198776A | Cited by | China | – | Search report |
| CN114338530A | Cited by | China | – | Search report |
| CN116028391A | Cited by | China | – | Search report |
| US10101797B2 | Cited by | United States of America | – | Search report |
| US2016091959A1 | Cited by | United States of America | – | Pre-grant |
| CN101242607A | Cites | China | Y | International search |
| CN101504565A | Cites | China | Y | International search |
| CN102096649A | Cites | China | XP | International search |
3 members in 2 offices
Priority claims5
| Document | Office | Kind | Date |
|---|---|---|---|
| 201110035873 | China | A | |
| 201110035873 | China | A | |
| 2011100358732 | – | – | – |
| CN20111035873 | – | – | – |
| CN2011135873 | – | – | – |
Members3
| Document | Office | Kind | |
|---|---|---|---|
| CN102096649A | China | A | |
| WO2012106973A1This record | World Intellectual Property Organization (WIPO) | A1 | |
| CN102096649B | China | B |
3 legal events, as 2 offices reported them to INPADOC
Over the term
Point at a mark for the eventEvents
| Event | Code | Office | |
|---|---|---|---|
| Ep: pct application non-entry in european phase122 | 122 | WO | |
| Non-entry into the national phaseNENP | NENP | DE | |
| Ep: the epo has been informed by wipo that ep was designated in this application121 | 121 | WO |
Numbers
- Publication
- 2012/106973
- Publication, DOCDB
- 2012106973
- Publication, EPODOC
- WO2012106973
- Application
- 84682
- Application, DOCDB
- 2011084682
- Application, EPODOC
- WO2011CN84682
Titles2
- English
- UART-BASED WAKE-UP FROM SLEEP METHOD AND DEVICE
- French
- RÉVEIL FONDÉ SUR UN CIRCUIT UART À PARTIR D'UN PROCÉDÉ ET D'UN DISPOSITIF DE MISE EN SOMMEIL
Classification
- CPC, 2
- G06F1/3278
- Y02D10/00
- IPC, 1
- G06F13 38
Designated states4
- Regional, 4
- Zimbabwe
- Turkmenistan
- Türkiye
- Togo