Asynchronous data sampling method, device, server and storage medium

By using the integer and decimal of the clock frequency division coefficient to calculate the sampling center point in asynchronous data communication, the problem of sampling error in asynchronous data communication is solved and the sampling accuracy and efficiency are improved.

CN114513282BActive Publication Date: 2024-09-20ZHEJIANG KERUI MICROELECTRONICS TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210014208.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-06
Publication Date
2024-09-20
Estimated Expiration
2042-01-06

AI Technical Summary

Technical Problem

In the existing asynchronous data communication, when continuous multi-bit data is sampled, there is an error between the sampling clock generated after the local clock is divided and the communication baud rate, resulting in a high probability of sampling error.

Method used

By obtaining the clock division coefficient according to the local clock frequency and communication baud rate before asynchronous communication, including clock integer and clock decimal, when sampling each data bit, the sampling center point is obtained based on the clock integer and clock decimal, and data sampling is performed using The clock decimal is calibrated to the clock integer to accurately obtain the sampling center point.

Benefits of technology

It reduces the cumulative error of the sampling clock, improves the position accuracy of sampling, reduces the probability of sampling errors, and improves the efficiency of asynchronous data communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114513282B
    Figure CN114513282B
Patent Text Reader

Abstract

The present invention discloses an asynchronous data sampling method. Before asynchronous communication, a clock frequency division coefficient is obtained according to the local clock frequency and the communication baud rate, wherein the clock frequency division coefficient includes a clock integer and a clock decimal. During the asynchronous communication process, when sampling each data bit, the sampling center point of the current data bit is obtained according to the clock integer and the clock decimal. Data sampling is performed according to the sampling center point obtained each time to obtain sampled data. The asynchronous data sampling method, device, server and storage medium disclosed by the present invention can effectively reduce the error accumulation generated when sampling multiple bits of data continuously, and reduce the probability of sampling errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to an asynchronous data sampling method, device, server and storage medium. Background Art

[0002] With the rapid development of communication technology, asynchronous data communication means that the communication transceiver does not use a synchronous clock for data sampling, and asynchronous data communication requires at least two data lines to achieve full-duplex data communication. It has the advantages of simple interface and signal line saving, making asynchronous data communication widely used in the fields of Internet of Things and industrial control.

[0003] In the prior art, as the amount of communication data increases, more and more applications have put forward higher requirements on the communication rate of asynchronous data communication. However, the existing asynchronous data communication, such as the UART communication standard, uses local clock division to generate asynchronous data bits for sampling clock. Since there is an error between the sampling clock generated after the local clock division and the communication baud rate, errors will accumulate when sampling multiple bits of data continuously, resulting in a high probability of sampling errors. Summary of the invention

[0004] The embodiments of the present specification provide an asynchronous data sampling method, device, server and storage medium, which can effectively reduce the error accumulation generated when sampling continuous multi-bit data and reduce the probability of sampling errors.

[0005] In a first aspect, an embodiment of the present specification provides an asynchronous data sampling method, including:

[0006] Before asynchronous communication, a clock frequency division coefficient is obtained according to the local clock frequency and the communication baud rate, wherein the clock frequency division coefficient includes a clock integer and a clock decimal;

[0007] In the asynchronous communication process, when sampling each data bit, the sampling center point of the current data bit is obtained according to the clock integer and the clock decimal;

[0008] Data sampling is performed according to the sampling center point obtained each time to obtain sampling data.

[0009] Optionally, in the asynchronous communication process, when sampling each data bit, obtaining the sampling center point of the current data bit according to the clock integer and the clock decimal includes:

[0010] In an asynchronous communication process, if the asynchronous communication includes M data bits, when sampling the 1st data bit, the sampling center point of the 1st data bit is obtained according to the clock integer; and when sampling the (i+1)th data bit, the (i+1)th calibration value is determined according to the clock decimal; the sampling center point of the (i+1)th data bit is determined according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit; wherein i is sequentially taken from 1 to (M-1), and M is an integer greater than 1.

[0011] Optionally, when the (i+1)th data bit is sampled, determining the (i+1)th calibration value according to the clock decimal comprises:

[0012] When the (i+1)th data bit is sampled, the (i+1)th calibration value and the (i+1)th accumulated value are determined according to the clock fraction and the i-th accumulated value.

[0013] Optionally, determining the (i+1)th calibration value and the (i+1)th accumulated value according to the clock fraction and the i-th accumulated value includes:

[0014] Determine whether the sum of the clock decimal and the i-th accumulated value is less than a threshold;

[0015] If the sum of the clock decimal and the i-th accumulated value is less than a preset value, determining the (i+1)th calibration value to be a first set value, and the (i+1)th accumulated value to be the sum of the clock decimal and the i-th accumulated value;

[0016] If the sum of the clock decimal and the i-th accumulated value is not less than the set value, the (i+1)th calibration value is the second set value, and the (i+1)th accumulated value is the difference between the sum of the clock decimal and the i-th accumulated value and the third set value.

[0017] Optionally, determining the sampling center point of the (i+1)th data bit according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit includes:

[0018] The number of sampling cycles is obtained according to the (i+1)th calibration value and the clock integer. The sampling center point of the i-th data bit is taken as the starting point, and the sampling cycle number is counted using the local clock to obtain the sampling center point of the (i+1)th data bit.

[0019] Optionally, performing data sampling according to a sampling center point of each data bit to obtain sampled data includes:

[0020] After each sampling center point of a data bit is obtained, the sampling center point of the data bit is sampled, and the sampling of the 1st to Mth data bits is completed in sequence to obtain the sampled data.

[0021] In a second aspect, the present invention further provides an asynchronous data sampling device, the device comprising:

[0022] A clock frequency division coefficient acquisition unit, used to acquire a clock frequency division coefficient according to a local clock frequency and a communication baud rate before asynchronous communication, wherein the clock frequency division coefficient includes a clock integer and a clock decimal;

[0023] A sampling center point acquisition unit, used for acquiring the sampling center point of the current data bit according to the clock integer and the clock decimal when sampling each data bit during the asynchronous communication process;

[0024] The sampling unit is used to perform data sampling according to the sampling center point of each data bit to obtain sampled data.

[0025] Optionally, the sampling center point acquisition unit is used to, during an asynchronous communication process, if the asynchronous communication contains M data bits, then when sampling the first data bit, obtain the sampling center point of the first data bit according to the clock integer; and when sampling the (i+1)th data bit, determine the (i+1)th calibration value according to the clock decimal; determine the sampling center point of the (i+1)th data bit according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit; wherein i is sequentially taken from 1 to (M-1), and M is an integer greater than 1.

[0026] In a third aspect, the present invention further proposes an electronic device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute operation instructions corresponding to any one of the methods provided in the first aspect.

[0027] In a fourth aspect, the present invention further proposes a computer-readable storage medium having a computer program stored thereon, characterized in that when the program is executed by a processor, steps corresponding to any one of the methods provided in the first aspect are implemented.

[0028] The above one or at least one technical solution in the embodiments of the present application has at least the following technical effects:

[0029] Based on the above technical solution, before asynchronous communication, the clock division coefficient is obtained according to the local clock frequency and the communication baud rate. During the asynchronous communication process, when sampling each data bit, the sampling center point of the current data bit is obtained according to the clock integer and the clock decimal; data sampling is performed according to the sampling center point of each data bit to obtain sampled data; at this time, since the clock division coefficient includes the clock integer and the clock decimal, and the clock division coefficient is determined according to the local clock frequency and the communication baud rate, when sampling each data bit, the clock integer is calibrated by the clock decimal, so that the accuracy of the sampling center point of the current data bit obtained is higher, so that in the continuous sampling process, the problem of low sampling position accuracy caused by the cumulative error of the sampling clock is reduced, thereby improving the sampling position accuracy and reducing the probability of sampling errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 A schematic diagram of a flow chart of an asynchronous data sampling method provided in an embodiment of the present application;

[0031] Figure 2 A structural diagram of the UART standard communication data format and communication timing provided in an embodiment of the present application;

[0032] Figure 3 A framework diagram of a UART communication controller provided in an embodiment of the present application;

[0033] Figure 4 A block diagram of an asynchronous data sampling device provided in an embodiment of the present application;

[0034] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The main implementation principles, specific implementation methods and corresponding beneficial effects of the technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0036] Example

[0037] In the first aspect, the present specification provides an asynchronous data sampling method, please refer to Figure 1 , the method comprises the following steps:

[0038] S101. Before asynchronous communication, obtain a clock frequency division coefficient according to a local clock frequency and a communication baud rate, wherein the clock frequency division coefficient includes a clock integer and a clock decimal;

[0039] S102, in the asynchronous communication process, when sampling each data bit, obtaining the sampling center point of the current data bit according to the clock integer and the clock decimal;

[0040] S103, performing data sampling according to the sampling center point of each data bit to obtain sampled data.

[0041] Among them, in step S101, before asynchronous communication, the local clock frequency can be obtained and represented by FREQ_LOCA, and the communication baud rate can be obtained and represented by BAUDRATE; after obtaining the local clock frequency and the communication baud rate, the local clock frequency and the communication baud rate can be divided to obtain the quotient after the division as the clock division coefficient, wherein the integer and decimal places of the quotient can be extracted, and the integer places of the quotient are used as the clock integer, and the decimal places of the quotient are used as the clock decimal. In this way, the clock division coefficient includes the clock integer and the clock decimal, and the decimal places of the quotient can be 1 decimal place, 2 decimal places, 3 decimal places, etc., and this manual does not make specific restrictions.

[0042] In the specific implementation process, if the clock distribution coefficient is represented by DIV, then DIV = FREQ_LOCAL / BAUDRATE. If the decimal place of the quotient is 1 decimal place, the calculation result can be accurate to 1 decimal place. The integer part of DIV can be represented by N as a clock integer, and the decimal part of DIV can be represented by D as a clock decimal. N and D can be configured in the relevant registers of the baud rate configuration module.

[0043] After the clock frequency division coefficient is obtained, step S102 is executed.

[0044] In step S102, the start of the asynchronous communication data can be identified by the data sampling controller. Thus, after identifying the start of the asynchronous communication data, if the asynchronous communication includes M sampling data bits, then during the asynchronous communication process, if the asynchronous communication includes M data bits, when sampling the 1st data bit, the sampling center point of the 1st data bit is obtained according to the clock integer; and when sampling the (i+1)th data bit, the (i+1)th calibration value is determined according to the clock decimal; the sampling center point of the (i+1)th data bit is determined according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit; wherein i is sequentially taken from 1 to (M-1), and M is an integer greater than 1.

[0045] Specifically, after identifying the start of the asynchronous communication data, when sampling the first data bit, the sampling center point of the first data bit is determined based on half the clock integer (i.e., N / 2); specifically, using the local clock starting from the starting position of the first data bit (i.e., the transmission starting point), counting N / 2 cycles, the sampling center point of the first data bit is found.

[0046] In one embodiment of the present specification, when the (i+1)th data bit is sampled, the (i+1)th calibration value is determined according to the clock decimal. At this time, the (i+1)th calibration value may be the sum of the clock decimal and i. It is determined whether the (i+1)th calibration value is less than a threshold value. If it is less than a preset value, the (i+1)th calibration value is determined to be a first set value; if it is not less than the set value, the (i+1)th calibration value is determined to be a second set value.

[0047] In another embodiment of the present specification, when the (i+1)th data bit is sampled, the (i+1)th calibration value and the (i+1)th accumulated value are determined according to the clock fraction and the i-th accumulated value, wherein the first accumulated value is 0. Of course, the first accumulated value may also be set to other values, such as 0.0001 and 0.001.

[0048] Specifically, determine whether the sum of the clock decimal and the i-th accumulated value is less than a threshold value. If it is less than a preset value, determine that the (i+1)th calibration value is the first set value, and the (i+1)th accumulated value is the sum of the clock decimal and the i-th accumulated value; if it is not less than the set value, determine that the (i+1)th calibration value is the second set value, and the (i+1)th accumulated value is the difference between the sum of the clock decimal and the i-th accumulated value and the third set value.

[0049] In the embodiments of the present specification, the first setting value may be, for example, -0.0001, 0, 0.0001, 0.001, and 0.01, the second setting value may be, for example, 0.98, 0.99, 1, and 1.001, and the third setting value may be, for example, 10, 10.1, 10.001, and 9.9, and the following specifically takes the first setting value as 0, the second setting value as 1, and the third setting value as 10 as an example; further, the threshold value may be set according to actual needs, or may be set manually or by the device itself, and the threshold value may be 5, 6, 7, and the like.

[0050] For example, if the i-th accumulated value is R i , take the clock fraction D as an example, and set (R i +D) is compared with the threshold 5. If (R i +D)<5, then the (i+1)th calibration value A i+1 =0, the (i+1)th accumulated value R i+1 =D+R i ; If (R i +D)≥5, then A i+1 =1, R i+1 = =D + R i -10.

[0051] In the embodiments of the present specification, when determining the sampling center point of the (i+1)th data bit based on the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit, the number of sampling cycles can be obtained based on the (i+1)th calibration value and the clock integer, and the sampling center point of the (i+1)th data bit can be obtained by counting the number of sampling cycles using the local clock, taking the sampling center point of the i-th data bit as the starting point.

[0052] Specifically, the sum of the (i+1)th calibration value and the clock integer can be used as the number of sampling cycles, or the product of the sum of the (i+1)th calibration value and the clock integer and the weight can be used as the number of sampling cycles. The weight can be set according to actual needs, for example, it can be 0.98 and 0.99, etc. This specification does not make specific restrictions. The following specifically takes the (i+1)th calibration value and the clock integer to obtain the number of sampling cycles as an example.

[0053] Specifically, after finding the sampling center point of the first data bit, when sampling the second data bit, that is, i=1, since R1=0, if D=4, since 0+4<5, then A2=0, R2=0+4=4, thus, taking the sampling center point of the first data bit as the starting point, using the local clock to count N cycles, the sampling center point of the second data bit is obtained; and when sampling the third data bit, that is, i=2, since R2=4, and D=4, since 4+4>5, then A3=1, R3=4+4-10=-2, thus, taking the sampling center point of the second data bit as the starting point, using the local clock to count (N+A3) cycles, the sampling center point of the third data bit is obtained; thus, the above operations are performed on the fourth to Mth data bits in sequence to obtain the sampling center point of each data bit, where M is an integer greater than 3.

[0054] In this way, since the clock decimal is the decimal place of the clock division coefficient, the calibration value is obtained through the clock decimal, and the cumulative error of the sampling clock generated by the clock integer division is calibrated through the calibration value, so that in the continuous sampling process, the problem of low sampling position accuracy caused by the cumulative error of the sampling clock is reduced, thereby improving the sampling position accuracy and reducing the probability of sampling errors; and it can also improve the ratio of the local clock to the data baud rate, thereby realizing asynchronous data communication with a higher baud rate and continuous sampling length, so that the efficiency of asynchronous data communication is improved.

[0055] In the examples of this specification, M is usually 3, 10, 15, 18, etc.

[0056] After the sampling center point of the current data bit is obtained, step S103 is executed.

[0057] In step S103, after each sampling center point of a data bit is obtained, the sampling center point of the data bit is sampled, and the sampling of the 1st to Mth data bits is completed in sequence to obtain sampled data, and the sampled data is cached, and the storage and verification of the sampled data are completed. Of course, after the sampling center point of M data bits is obtained, the sampling center points of M data bits can be sampled at the same time to obtain sampled data.

[0058] In actual application, taking the UART serial asynchronous communication standard as an example, UART is widely used in the fields of Internet of Things and industrial control. The UART standard defines the communication data format and communication timing. The UART standard includes RS232 / RS485 sub-standards, which define the electrical and connector standards of UART communication.

[0059] See also Figure 2 , which is the UART standard communication data format and communication timing, where the communication data line is high level when idle; BIT0 is the start bit, which is a bit low level; BIT1~BIT8 are the data bits of a byte; BIT9 is the check bit; BIT10 is the stop bit, which is a bit high level; each data bit in BIT0 to BIT10 needs to be sampled.

[0060] See also Figure 3 , which is a framework diagram of the UART communication controller provided in this specification, including a data sampling controller 30, a data transmission controller 31, a clock divider 32, a fractional frequency calibrator 33, a serial-to-parallel conversion and data cache controller 34, an interrupt controller 35, a bus interface module 36 and a baud rate configuration module 37, wherein the UART framework 301 includes a data sampling controller 30, a clock divider 32, a fractional frequency calibrator 33 and a baud rate configuration module 37, the data sampling controller 30 receives asynchronous data, and the data transmission controller 31 is used to output the sampled data asynchronously.

[0061] The steps of data communication of the above-mentioned UART communication controller are:

[0062] A1. Before data communication, the clock division coefficient DIV is calculated according to the local clock frequency FREQ_LOCAL and the communication baud rate BAUDRATE. The calculation method is DIV = FREQ_LOCAL / BAUDRATE, and the calculation result is accurate to 1 decimal place. The integer part of DIV is recorded as N, and the decimal part is recorded as D, and is configured in the relevant register of the baud rate configuration module 37.

[0063] A2, the data sampling controller 30 monitors the data line in real time from IDLE to START BIT, and identifies it as the starting point of a transmission;

[0064] A3, the data sampling controller 30 finds the sampling center point of BIT0 according to N / 2, and the specific method is: using the local clock to start from the transmission starting point in step A2, count N / 2 cycles, find the BIT0 sampling point, and enable the clock divider 32, that is, the clock divider 32 starts to use the local clock according to the division coefficient N to generate a periodic pulse signal;

[0065] A4, the clock divider 32 calculates the next data bit sampling point according to the integer part N of the clock division coefficient, and the specific method is to start with the current bit data as the sampling point, use the local clock to count N cycles, and obtain the next data bit sampling point;

[0066] A5. The fractional frequency calibrator 33 confirms the calibration value A according to the fractional part D of the clock frequency division coefficient, and calculates the fractional accumulated value R, the initial value of R is 0. The calculation method is as follows:

[0067] If R+D<5, then A=0, R=R+D;

[0068] If R+D>=5, then A=1, R=R+D-10;

[0069] The calibration value is output to the clock divider 32 to calculate and adjust the next data bit sampling point, and the implementation method is: using the frequency division coefficient N+A as the number of local clock cycles to calculate the next sampling point;

[0070] For example, after finding the BIT0 sampling point, when sampling the BIT1th data bit, that is, i=1, i=1, since R1=0, if D=3, since 0+3<5, then A2=0, R2=0+3=3, so, taking the BIT0 sampling point as the starting point, using the local clock to count N cycles, obtain the BIT1 sampling; and when sampling BIT2, that is, i=2, since R2=3, and D=3, since 3+3>5, then A3=1, R3=3+3-10=-4, so, taking the BIT0 sampling point as the starting point, using the local clock to count (N+1) cycles, obtain the BIT2 sampling point; in this way, the above operations are performed on BIT3 to BIT10 in turn to obtain each data bit sampling point.

[0071] A6, the clock divider 32 generates a data sampling pulse, and the data sampling controller 30 completes the sampling of the current data bit;

[0072] A7, repeat steps A3 to A6 until the last data bit is sampled to obtain sampled data;

[0073] A8, the data sampling controller 30 sends the adopted data to the serial-to-parallel conversion and buffer controller 34 to complete the byte data storage and verification;

[0074] A9, the interrupt controller 35 and the bus control module 36 complete the interrupt generation and the bus receiving data reading.

[0075] The beneficial effects of the embodiments of this specification are as follows:

[0076] Based on the above technical solution, before asynchronous communication, the clock division coefficient is obtained according to the local clock frequency and the communication baud rate. During the asynchronous communication process, when sampling each data bit, the sampling center point of the current data bit is obtained according to the clock integer and the clock decimal; data sampling is performed according to the sampling center point of each data bit to obtain sampled data; at this time, since the clock division coefficient includes the clock integer and the clock decimal, and the clock division coefficient is determined according to the local clock frequency and the communication baud rate, when sampling each data bit, the clock integer is calibrated by the clock decimal, so that the accuracy of the sampling center point of the current data bit obtained is higher, so that in the continuous sampling process, the problem of low sampling position accuracy caused by the cumulative error of the sampling clock is reduced, thereby improving the sampling position accuracy and reducing the probability of sampling errors.

[0077] In view of the above-mentioned embodiment, an asynchronous data sampling method is provided. The present application embodiment also provides an asynchronous data sampling device. Figure 4 , the device comprises:

[0078] The clock frequency division coefficient acquisition unit 401 is used to acquire the clock frequency division coefficient according to the local clock frequency and the communication baud rate before asynchronous communication, wherein the clock frequency division coefficient includes a clock integer and a clock decimal;

[0079] The sampling center point acquisition unit 402 is used to acquire the sampling center point of the current data bit according to the clock integer and the clock decimal when sampling each data bit during the asynchronous communication process;

[0080] The sampling unit 403 is used to perform data sampling according to the sampling center point of each data bit to obtain sampled data.

[0081] In an optional implementation, the sampling center point acquisition unit 402 is used to, during an asynchronous communication process, if the asynchronous communication includes M data bits, then when sampling the first data bit, obtain the sampling center point of the first data bit according to the clock integer; and when sampling the (i+1)th data bit, determine the (i+1)th calibration value according to the clock decimal; determine the sampling center point of the (i+1)th data bit according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit; wherein i is sequentially taken from 1 to (M-1), and M is an integer greater than 1.

[0082] In an optional implementation, the sampling center point acquisition unit 402 is used to determine the (i+1)th calibration value and the (i+1)th accumulated value according to the clock fraction and the i-th accumulated value when sampling the (i+1)th data bit.

[0083] In an optional implementation, the sampling center point acquisition unit 402 is used to determine whether the sum of the clock decimal and the i-th accumulated value is less than a threshold value; if the sum of the clock decimal and the i-th accumulated value is less than a preset value, the (i+1)th calibration value is determined to be a first set value, and the (i+1)th accumulated value is the sum of the clock decimal and the i-th accumulated value; if the sum of the clock decimal and the i-th accumulated value is not less than the set value, the (i+1)th calibration value is a second set value, and the (i+1)th accumulated value is the difference between the sum of the clock decimal and the i-th accumulated value and a third set value.

[0084] In an optional embodiment, the sampling center point acquisition unit 402 is used to obtain the number of sampling cycles based on the (i+1)th calibration value and the clock integer, take the sampling center point of the i-th data bit as the starting point, use the local clock to count the number of sampling cycles, and obtain the sampling center point of the (i+1)th data bit.

[0085] In an optional implementation, the sampling unit 403 is used to sample the sampling center point of each data bit after obtaining the sampling center point of the data bit, and complete the sampling of the 1st to Mth data bits in sequence to obtain the sampled data.

[0086] Figure 5 8 is a block diagram of an electronic device 800 according to an exemplary embodiment showing an asynchronous data sampling method. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0087] Reference Figure 5 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / display (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0088] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0089] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0090] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0091] The multimedia component 808 includes a screen that provides a display interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0092] The audio component 810 is configured to present and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for presenting audio signals.

[0093] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0094] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0095] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0096] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0097] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0098] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform an asynchronous data sampling method, the method comprising:

[0099] Before asynchronous communication, a clock frequency division coefficient is obtained according to the local clock frequency and the communication baud rate, wherein the clock frequency division coefficient includes a clock integer and a clock decimal;

[0100] In the asynchronous communication process, when sampling each data bit, the sampling center point of the current data bit is obtained according to the clock integer and the clock decimal;

[0101] Data sampling is performed according to the sampling center point obtained each time to obtain sampling data.

[0102] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The specification and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0103] It should be understood that the present invention is not limited to the precise structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

[0104] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An asynchronous data sampling method, characterized in that: The method comprises: Before asynchronous communication, a local clock frequency and a communication baud rate are obtained, and after obtaining the local clock frequency and the communication baud rate, the local clock frequency and the communication baud rate are divided to obtain a quotient as a clock division coefficient, wherein the clock division coefficient includes a clock integer and a clock decimal; The data sampling controller identifies the start of asynchronous communication data. In the asynchronous communication process, when sampling each data bit, the sampling center point of the current data bit is obtained according to the clock integer and the clock decimal; including: In an asynchronous communication process, if the asynchronous communication includes M data bits, when sampling the first data bit, the sampling center point of the first data bit is obtained according to half of the clock integer; and when sampling the (i+1)th data bit, the (i+1)th calibration value is determined according to the clock decimal; the sampling center point of the (i+1)th data bit is determined according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit; wherein i is sequentially taken from 1 to (M-1), and M is an integer greater than 1; Data sampling is performed according to the sampling center point of each data bit to obtain sampling data; wherein, when sampling the (i+1)th data bit, determining the (i+1)th calibration value and the (i+1)th accumulated value according to the clock fraction and the i-th accumulated value; Determine whether the sum of the clock decimal and the i-th accumulated value is less than a threshold; If the sum of the clock decimal and the i-th accumulated value is less than a threshold value, determining that the (i+1)th calibration value is a first set value, and the (i+1)th accumulated value is the sum of the clock decimal and the i-th accumulated value; If the sum of the clock decimal and the i-th accumulated value is not less than the set value, the (i+1)th calibration value is the second set value, and the (i+1)th accumulated value is the difference between the sum of the clock decimal and the i-th accumulated value and the third set value.

2. The method according to claim 1, characterized in that The step of determining the sampling center point of the (i+1)th data bit according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit comprises: The number of sampling cycles is obtained according to the (i+1)th calibration value and the clock integer. The sampling center point of the i-th data bit is taken as the starting point, and the sampling cycle number is counted using the local clock to obtain the sampling center point of the (i+1)th data bit.

3. The method according to claim 2, characterized in that The step of sampling data according to the sampling center point of each data bit to obtain the sampled data includes: After each sampling center point of a data bit is obtained, the sampling center point of the data bit is sampled, and the sampling of the 1st to Mth data bits is completed in sequence to obtain the sampled data.

4. An asynchronous data sampling device, characterized in that: The device comprises: A clock frequency division coefficient acquisition unit is used to acquire the local clock frequency and the communication baud rate before asynchronous communication, and after acquiring the local clock frequency and the communication baud rate, divide the local clock frequency and the communication baud rate to obtain the quotient after the division as the clock frequency division coefficient, wherein the clock frequency division coefficient includes a clock integer and a clock decimal; A data sampling controller, used to identify the start of asynchronous communication data; a sampling center point acquisition unit, used to acquire the sampling center point of the current data bit according to the clock integer and the clock decimal when sampling each data bit during the asynchronous communication process; The sampling center point acquisition unit is used for, during the asynchronous communication process, if the asynchronous communication includes M data bits, when sampling the first data bit, acquiring the sampling center point of the first data bit according to half of the clock integer; and when sampling the (i+1)th data bit, determining the (i+1)th calibration value according to the clock decimal; determining the sampling center point of the (i+1)th data bit according to the (i+1)th calibration value, the clock integer and the sampling center point of the i-th data bit; wherein i is sequentially taken from 1 to (M-1), and M is an integer greater than 1; A sampling unit, used for sampling data according to a sampling center point of each data bit to obtain sampled data; wherein, when sampling the (i+1)th data bit, determining the (i+1)th calibration value and the (i+1)th accumulated value according to the clock fraction and the i-th accumulated value; Determine whether the sum of the clock decimal and the i-th accumulated value is less than a threshold; If the sum of the clock decimal and the i-th accumulated value is less than a threshold value, determining that the (i+1)th calibration value is a first set value, and the (i+1)th accumulated value is the sum of the clock decimal and the i-th accumulated value; If the sum of the clock decimal and the i-th accumulated value is not less than the set value, the (i+1)th calibration value is the second set value, and the (i+1)th accumulated value is the difference between the sum of the clock decimal and the i-th accumulated value and the third set value.

5. An electronic device, characterized in that: It includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operation instructions corresponding to the method according to any one of claims 1 to 3 contained in the one or more programs.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps corresponding to the method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Programmable radio transceiver

    CN101313475A

  • Method for arbitrary fractional frequency division of digital circuit clock

    CN113271084A

  • Asynchronous serial data receiver

    JP2010041388A

  • Data processing apparatus

    US20110116557A1