METHODS FOR DATA SYNCHRONIZATION BETWEEN A SENSOR HUB AND AN APPLICATION PROCESSOR AND APPARATUSES USING THE SAME
20190243411 ยท 2019-08-08
Inventors
- Jiangze Chen (Shanghai, CN)
- Dongxing Wu (Shanghai, CN)
- Deming Gu (Shanghai, CN)
- Guixiang HE (Shanghai, CN)
- Kangning Zhu (Shanghai, CN)
Cpc classification
H04Q9/00
ELECTRICITY
H04Q2209/823
ELECTRICITY
H04Q2209/845
ELECTRICITY
G01D9/285
PHYSICS
H03K5/135
ELECTRICITY
International classification
H04Q9/00
ELECTRICITY
H03K5/135
ELECTRICITY
Abstract
A method provides data synchronization between a sensor hub and an application processor, which contains at least the following steps: generating and adding a plurality of absolute time stamps in a sensor-data stream; and generating and adding a plurality of pieces of sensor data and a plurality of relative time stamps in the sensor-data stream between the moments of generating each two adjacent absolute time stamps, wherein each relative time stamp is associated with one piece of sensor data.
Claims
1. A method for data synchronization between a sensor hub and an application processor, comprising: reading an ID (identifier) from a sensor-data stream; determining whether the ID is a time ID; when the ID is the time ID, reading an absolute time stamp from the sensor-data stream and storing the absolute time stamp in the application processor; and when the ID is not the time ID, reading sensor data and a relative time stamp from the sensor-data stream, generating a recovered time stamp according to the absolute time stamp and the relative time stamp and converting the recovered time stamp to a value of an RTC (Real-time Counter) of the application processor.
2. The method of claim 1, wherein the sensor data and the converted value are sent to an application, thereby enabling the application to generate a control signal accordingly and complete a designated function according to the control signal.
3. The method of claim 1, wherein the recovered time stamp is generated by using an Equation as follows:
TS.sub.rc=TS.sub.a+TS.sub.b, wherein TS.sub.rc represents the recovered time stamp, TS.sub.a represents the absolute time stamp and TS.sub.b represents the relative time stamp, and the converted value is generated by using an Equation as follows:
TS.sub.cnv=f(TS.sub.rc), wherein TS.sub.cnv represents the converted value, TS.sub.rc represents the recovered time stamp and f( ) represents a conversion function.
4. The method of claim 1, comprising: after issuing an interrupt to the sensor hub, reading a first up-to-date value of an RTC of the sensor hub; and calculating a bias according to the first up-to-date value and a second up-to-date value corresponding to a prior interrupt.
5. The method of claim 4, wherein the bias is calculated by using an Equation as follows:
=TS.sub.p(f(TS.sub.t)f(TS.sub.t-1)), wherein represents the bias, TS.sub.p represents a counter value of an interrupt period, TS.sub.t represents the first up-to-date value, TS.sub.t-1 represents the second up-to-date value and f( ) represents a conversion function.
6. The method of claim 5, wherein the recovered time stamp is generated by using an Equation as follows:
TS.sub.rc=TS.sub.a+TS.sub.b, wherein TS.sub.rc represents the recovered time stamp, TS.sub.a represents the absolute time stamp and TS.sub.b represents the relative time stamp, and the converted value is generated by using an Equation as follows:
TS.sub.cnv=f(TS.sub.rc)+, wherein TS.sub.cnv represents the converted value, TS.sub.rc represents the recovered time stamp, f( ) represents a conversion function and represents the bias. the sensor hub.
7. An apparatus for data synchronization between a sensor hub and an application processor, comprising: a memory storing a sensor-data stream; a sensor hub, coupled to a micro-sensor and the memory, generating and adding a plurality of first absolute time stamps in the sensor-data stream; and generating and adding a plurality of pieces of first sensor data and a plurality of first relative time stamps in the sensor-data stream between the moments of generating each two adjacent first absolute time stamps, wherein each first relative time stamp is associated with one piece of first sensor data; and an application processor, coupled to the memory, reading an ID (identifier) from the sensor-data stream; determining whether the ID is a time ID; when the ID is the time ID, reading a second absolute time stamp from the sensor-data stream and storing the second absolute time stamp in the application processor; and when the ID is not the time ID, reading one piece of second sensor data and a second relative time stamp from the sensor-data stream, generating a recovered time stamp according to the second absolute time stamp and the second relative time stamp and converting the recovered time stamp to a value of an RTC of the application processor.
8. The apparatus of claim 7, wherein the piece of second sensor data and the converted value are sent to an application executed by the application processor, thereby enabling the application to generate a control signal accordingly and complete a designated function according to the control signal.
9. The apparatus of claim 7, wherein, after issuing an interrupt to the sensor hub, the application processor reads a first up-to-date value of an RTC of the sensor hub; and calculates a bias according to the first up-to-date value and a second up-to-date value corresponding to a prior interrupt.
10. The apparatus of claim 9, wherein the bias is calculated by using an Equation as follows:
=TS.sub.p(f(TS.sub.t)f(TS.sub.t-1)), wherein represents the bias, TS.sub.p represents a counter value of an interrupt period, TS.sub.t represents the first up-to-date value, TS.sub.t-1 represents the second up-to-date value and f( ) represents a conversion function.
11. The apparatus of claim 10, wherein the recovered time stamp is generated by using an Equation as follows:
TS.sub.rc=TS.sub.a+TS.sub.b, wherein TS.sub.rc represents the recovered time stamp, TS.sub.a represents the second absolute time stamp and TS.sub.b represents the second relative time stamp, and the converted value is generated by using an Equation as follows:
TS.sub.cnv=f(TS.sub.rc)+, wherein TS.sub.cnv represents the converted value, TS.sub.rc represents the recovered time stamp, f( ) represents a conversion function and represents the bias.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0008] The present invention can be fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
[0009]
[0010]
[0011]
[0012]
[0013]
DETAILED DESCRIPTION
[0014] The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
[0015] The present invention will be described with respect to particular embodiments and with reference to certain drawings, but the invention is not limited thereto and is only limited by the claims. It will be further understood that the terms comprises, comprising, includes and/or including, when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
[0016] Use of ordinal terms such as first, second, third, etc., in the claims to modify a claim element does not by itself connote any priority, precedence, or order of one claim element over another or the temporal order in which acts of a method are performed, but are used merely as labels to distinguish one claim element having a certain name from another element having the same name (but for use of the ordinal term) to distinguish the claim elements.
[0017]
[0018] The sensor hub 110 contains an RTC (Real-Time Counter) 115 that may use i bits, such as 64, 32 bits, etc., to count time. In some implementations, a time stamp is attached before every sensor-data for indicating at which moment the sensor-data corresponding to one of the micro-sensors 130_0 to 130_n is generated.
[0019] The ring buffer 171 contains two pointers, a read pointer and a write pointer. The read pointer points to the start address of the first time unit 310 or the first data unit 330 of the ring buffer 171 that has not been read by the application processor 150. The write pointer points to the beginning address of available space of the ring buffer 171.
[0020] Embodiments of the invention introduce methods for writing a sensor-data stream that generate and add absolute time stamps 310b in the sensor-data stream periodically, and generate and add multiple pieces of sensor data 330b and relative time stamps 330c in the sensor-data stream between the moments of generating any two adjacent absolute time stamps 310b, where each of the relative time stamps is associated with one piece of sensor data 330b.
[0021]
TS.sub.rc=TS.sub.a+TS.sub.b(1)
where TS.sub.rc represents a recovered time stamp, TS.sub.a represents a absolute time stamp and TS.sub.b represents a relative time stamp. Next, since an application is operated based on the system time generated by the RTC 155 of the application processor 150, the application processor 150 converts the recovered time stamp to a value of the RTC 155 of the application processor 150 (step S575). In step S575, the converted value may be generated by using the Equation as follows:
TS.sub.cnv=f(TS.sub.rc)(2)
where TS.sub.cnv represents a converted value, TS.sub.rc represents a recovered time stamp and f( ) represents a conversion function. The design of the conversion function may vary with different types of the RTC 155 of the application processor 150 and the RTC 115 of the sensor hub 110. It should be understood that the sensor ID 330a read in step S510, the sensor data 330b read in step S571 and the value converted in step S575 may be sent to a relevant application, thereby enabling the application to generate control signals accordingly and complete designated functions according to the control signals.
[0022] In some embodiments, the RTC 155 of the application processor 150 may use more bits to count time than the RTC 115 of the sensor hub 110. For example, the RTC 155 uses 64 bits to count time while the RTC 115 uses 32 bits to count time. Since the precision of the RTC 155 is higher than that of the RTC 115, a certain degree of bias between them is accumulated after a period of time has elapsed. The memory 170 may allocate space 173 for writing the current value of the RTC 115 by the sensor hub 110. The application processor 150 may periodically set an interrupt register 190 to issue an interrupt to the sensor hub 110. After receiving the interrupt, the sensor hub 110 writes the current value of the RTC 115 in the memory space 173 immediately, thereby enabling the application processor 150 to read the current value of the RTC 115 from the memory space 173. After reading the value of the RTC 115 from the memory space 173 at this interrupt moment t, the application processor 150 may calculate the bias by using the Equation as follows:
=TS.sub.p(f(TS.sub.t)f(TS.sub.t-1))(3)
where represents a bias, TS.sub.p represents a counter value of an interrupt period between two interrupt moments, TS.sub.t represents a value read from the memory space 173 at an interrupt moment t, TS.sub.t-1 represents a value read from the memory space 173 at the prior interrupt moment t1 and f( ) represents a conversion function. Furthermore, in order to take the bias into account in the conversion, in step S575, the converted value may be generated by using the Equation as follows instead:
TS.sub.cnv=f(TS.sub.rc)+(4)
where TS.sub.cnv represents a converted value, TS.sub.rc represents a recovered time stamp, f( ) represents a conversion function and represents a bias.
[0023] Although the embodiment has been described as having specific elements in
[0024] While the invention has been described by way of example and in terms of the preferred embodiments, it should be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.