Data decoding method and device, electronic equipment and storage medium
By sampling and decoding Manchester-encoded data streams on the rising and falling edges of a single clock, the problems of data recovery difficulties and clock resource utilization in high-speed serial communication are solved, and efficient data decoding is achieved.
Patent Information
- Application Number
- CN202311577729.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-23
AI Technical Summary
In high-speed serial communication, data recovery using Manchester encoded is more difficult, and the existing decoding method requires multiple clocks, which occupies a large clock resource and is not very decoding efficiency.
By obtaining the clock rate of a single clock, the Manchester-encoded data stream is sampled on the rising and falling edges of the single clock, multiple sampled data are obtained and decoded to realize the decoding of the data stream.
There is no need to output multiple clocks at any clock rate, double the decoding efficiency and low clock offset jitter requirements, reducing development difficulty and clock resource usage.
Smart Images

Figure CN120034200A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data decoding method, device, electronic device and storage medium. Background Art
[0002] Compared with parallel communication, serial communication has the advantages of strong anti-interference ability, fewer pins required and long transmission distance. However, since serial communication has only one data line, it is difficult to recover data in high-speed serial communication without an accompanying clock. Therefore, Manchester encoding can be used to encode serial communication data. This encoding method has good anti-interference and self-synchronization capabilities, which is conducive to data recovery.
[0003] The data transmission rate of Manchester-encoded data is only half of the modulation rate. Therefore, in order to improve the decoding efficiency, in the related art, the data using Manchester encoding is sampled at high speed by using a phase shifter to output multiple homologous clocks with equal phase differences, thereby achieving reliable decoding of the data and improving the decoding rate of the data. However, this decoding method requires the use of a phase shifter to output multiple clocks, which occupies a large amount of clock resources. Summary of the invention
[0004] In view of the above problems, the present application provides a data decoding method, device, electronic device and storage medium, which can improve the decoding efficiency while reducing the clock resources required for decoding Manchester-encoded data.
[0005] In a first aspect, the present application provides a data decoding method, comprising: obtaining the clock rate of a single clock; sampling a data stream formed by Manchester encoding at the rising edge and the falling edge of the single clock according to the clock rate of the single clock to obtain a plurality of sampled data; decoding each of the sampled data to obtain decoded data of the data stream.
[0006] In the technical solution of the embodiment of the present application, after obtaining the clock rate of a single-channel clock, the data stream formed by Manchester coding is sampled at the rising edge and the falling edge of the single-channel clock according to the clock rate of the single-channel clock to obtain multiple sampling data, so as to decode each sampling data to obtain the decoded data of the data stream, so that in the process of decoding the data using Manchester coding, data is collected for decoding through double-edge sampling, so that at any clock rate, there is no need to output multiple clocks, and the decoding efficiency can be doubled, and the single clock has low requirements on the clock offset jitter, which reduces the development difficulty, thereby improving the decoding efficiency while reducing the clock resources required for decoding the data using Manchester coding.
[0007] In some embodiments, obtaining the clock rate of a single clock includes: obtaining the clock rate of the single clock according to the modulation rate of a data stream formed by Manchester coding. The clock rate of the single clock is obtained by using the modulation rate of the data stream formed by Manchester coding, so that the clock rate is adapted to the modulation rate of the data stream, so that Manchester codes of different modulation rates can be decoded, thereby improving the accuracy of data decoding.
[0008] In some embodiments, decoding each of the sampled data to obtain the decoded data of the data stream includes: comparing adjacent sampled data according to the sampling order of each of the sampled data to determine each transition edge position; and obtaining the decoded data of the data stream from each of the sampled data according to each of the transition edge positions. By comparing adjacent sampled data according to the sampling order of the sampled data to determine each transition edge position, and obtaining the decoded data of the data stream from each of the sampled data based on each transition edge position, the characteristic of the data signal using Manchester encoding being located at the transition edge is utilized to quickly determine the transition edge position for data decoding by comparing adjacent sampled data, thereby improving the decoding accuracy of the data stream using Manchester encoding.
[0009] In some embodiments, according to the sampling order of each sampling data, adjacent sampling data are compared to determine the position of each transition edge, including: according to the sampling order of each sampling data, the last sampling data collected in the previous clock cycle is spliced with each sampling data collected in the next clock cycle to obtain spliced data; the adjacent sampling data in the spliced data are compared to determine the transition edge position, so that the data signal of the data stream can be accurately extracted from each clock cycle.
[0010] In some embodiments, according to the sampling order of each sampled data, adjacent sampled data are compared to determine the position of each transition edge, including: according to the sampling order of each sampled data, each sampled data collected in the previous clock cycle is spliced with the first sampled data collected in the next clock cycle to obtain spliced data; adjacent sampled data in the spliced data are compared to determine the position of the transition edge. Thus, the data signal of the data stream can be accurately extracted from each clock cycle.
[0011] In some embodiments, according to each of the transition edge positions, the decoded data of the data stream is obtained from each of the sampled data, including: according to each of the transition edge positions, from each of the sampled data, each candidate data corresponding to each of the transition edge positions is obtained; according to the modulation rate, each candidate data is screened to obtain each target data; according to each of the target data, the decoded data is obtained. The risk threshold of the area is determined by the historical impact information of the area that has been impacted, so as to obtain the risk assessment result of the battery according to the comparison result of the impact force in the collision information and the risk threshold, after each candidate data corresponding to each of the transition edge positions is obtained from each of the sampled data according to each of the transition edge positions, each candidate data is screened according to the modulation rate to obtain each target data, so as to obtain the decoded data according to each target data, so as to filter out the sampled data determined by the transition edge that does not match the data stream from the decoded data, and improve the accuracy of the decoded data obtained.
[0012] In some embodiments, each candidate data is screened according to the modulation rate to obtain each target data, including: determining the time period of adjacent bits of the decoded data according to the modulation rate; screening each candidate data in turn according to the time period to obtain each target data, so that the candidate data matching the modulation rate can be quickly screened out from the candidate data as the target data, so that the target data can be arranged in the order of acquisition to obtain the decoded data, thereby improving the efficiency of obtaining the decoded data.
[0013] In the second aspect, the present application provides a data decoding device, including: a rate acquisition module, used to obtain the clock rate of a single clock; a data sampling module, used to sample a data stream formed by Manchester encoding at the rising edge and falling edge of the single clock according to the clock rate of the single clock, to obtain multiple sampling data; a data decoding module, used to decode each of the sampling data to obtain decoded data of the data stream.
[0014] In the technical solution of the embodiment of the present application, after obtaining the clock rate of a single-channel clock, the data stream formed by Manchester coding is sampled at the rising edge and the falling edge of the single-channel clock according to the clock rate of the single-channel clock to obtain multiple sampling data, so as to decode each sampling data to obtain the decoded data of the data stream, so that in the process of decoding the data using Manchester coding, data is collected for decoding through double-edge sampling, so that at any clock rate, there is no need to output multiple clocks, and the decoding efficiency can be doubled, and the single clock has low requirements on the clock offset jitter, which reduces the development difficulty, thereby improving the decoding efficiency while reducing the clock resources required for decoding the data using Manchester coding.
[0015] In a third aspect, the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the method in the implementation of the first aspect when executing the computer program.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the method in the implementation of the first aspect.
[0017] In a fifth aspect, the present application provides a computer program product, which, when running on a computer, enables the computer to execute the method in the first aspect, any optional implementation manner in the first aspect, or the third aspect, any optional implementation manner in the third aspect.
[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Moreover, the same reference numerals are used throughout the drawings to represent the same components. In the drawings:
[0020] Figure 1 A flowchart of a data decoding method according to some embodiments of the present application;
[0021] Figure 2 This is a schematic diagram of the sampling circuit structure of some embodiments of the present application;
[0022] Figure 3 A schematic diagram of dual clock edge sampling in some embodiments of the present application;
[0023] Figure 4 A schematic diagram of the structure of a data decoding device according to some embodiments of the present application;
[0024] Figure 5 This is a schematic diagram of the structure of an electronic device according to some embodiments of the present application.
[0025] Some of the reference numerals in the specific implementation manner are as follows:
[0026] 200 - rate acquisition module; 201 - data sampling module; 202 - data decoding module; 300 - electronic device; 301 - processor; 302 - memory; 303 - communication bus. DETAILED DESCRIPTION
[0027] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0029] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0030] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0031] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0032] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple paths" refers to more than two paths (including two paths).
[0033] Compared with parallel communication, serial communication has the advantages of strong anti-interference ability, fewer pins required and long transmission distance. However, since serial communication has only one data line, it is difficult to recover data in high-speed serial communication without an accompanying clock. Therefore, the data of serial communication can be encoded by using Manchester encoding. Among them, Manchester encoding is also called phase encoding. It is a synchronous clock encoding technology used by the physical layer to encode the clock and data of a synchronous bit stream. It can modulate each code element into two levels, and use the transition edge of the level to represent the high and low levels. The data stream formed by Manchester encoding is accompanied by clock transmission, which makes this encoding method have good anti-interference and self-synchronization capabilities, which is conducive to data recovery.
[0034] The data transmission rate of Manchester-encoded data is only half of the modulation rate. Therefore, the common decoding methods for Manchester-encoded data require a high-frequency clock that is much higher than the symbol rate for encoding and decoding, but this will cause the clock required for encoding and decoding to become very high, and the decoding efficiency is still not high. Therefore, in the related art, by using a phase shifter to output a multi-channel homologous clock with equal phase difference, the data using Manchester encoding is sampled at high speed, thereby achieving reliable decoding of the data without using a high-frequency clock that is much higher than the symbol rate, thereby improving the decoding rate of the data. However, this decoding method requires the use of a phase shifter to output multiple clocks, which occupies a large amount of clock resources.
[0035] In response to the above technical problems, an embodiment of the present application provides a data decoding method. After acquiring the clock rate of a single clock, the method samples a data stream formed by Manchester coding at the rising edge and the falling edge of the single clock according to the clock rate of the single clock to obtain multiple sampling data, so as to decode each sampling data to obtain decoded data of the data stream. In the process of decoding the data using Manchester coding, data is collected for decoding through double-edge sampling, so that at any clock rate, there is no need to output multiple clocks, and the decoding efficiency can be doubled. In addition, the single clock has low requirements on clock offset jitter, which reduces the development difficulty. Therefore, while improving the decoding efficiency, the clock resources required for decoding the data using Manchester coding are reduced.
[0036] The data decoding method, device, electronic device and storage medium disclosed in the embodiments of the present application can be applied to a decoding device for decoding data encoded in Manchester. The decoding device may include a decoder for decoding data, and the decoder may include a sampling circuit for sampling the data.
[0037] According to some embodiments of the present application, an embodiment of the present application provides a data decoding method, which can be applied to the aforementioned decoding device to decode data using Manchester encoding. Figure 1 As shown, the data decoding method includes:
[0038] S101, obtaining the clock rate of a single clock;
[0039] S102, sampling a data stream formed by using Manchester encoding at a rising edge and a falling edge of the single-channel clock according to a clock rate of the single-channel clock to obtain a plurality of sampled data;
[0040] S103, decoding each sample data to obtain decoded data of the data stream.
[0041] In some embodiments, the clock rate of a single clock can be set according to actual decoding requirements. The clock rate refers to the number of pulses per second generated by the oscillator that sets the sampling speed of the decoder. In order to avoid the situation where decoding cannot be performed, the clock rate must be less than or equal to the preset rate, and the preset rate is determined based on the computing resources currently available for data sampling. Exemplarily, the preset rate can be calculated based on the computing resources currently available for data sampling in the decoding device, so as to set the specific value of the clock rate according to the preset rate. The computing resources can be the hard core resources of the FPGA of the sampling circuit in the decoding device to reduce the difficulty of development.
[0042] After determining the clock rate of the single clock, the clock rate and the data stream can be input into the FPGA of the decoder for data sampling. The FPGA may include an IDDR module, which is a register for data input, and its function is to synchronize the external input data with the clock signal for subsequent data processing and analysis. For example, the sampling circuit may be as follows Figure 2 As shown, the D port is the data input port, the CE port is the enable control port, the C port is the clock input port, the S / R port is the reset position port, Q1 is the clock rising edge sampling data, and Q2 is the clock falling edge sampling data. After determining the clock rate of the single clock, the clock rate can be input into the sampling circuit through the C port, and the data stream can be input into the sampling circuit through the D port, so that the data stream can be sampled at the rising and falling edges of the single clock according to the clock rate through the sampling circuit, and the sampling data collected at the rising edge of the clock is output from the Q1 port, and the sampling data collected at the falling edge of the clock is output from the Q2 port. Taking the modulation rate of the data stream with a clock rate of 2 times as an example, since the clock rate input into the sampling circuit is twice the modulation rate, and dual clock edge sampling is adopted, there are 4 clock edges in one clock cycle, and 4 sampling points can be obtained in one clock cycle, that is, 4 scratch data, to achieve 4 times frequency sampling. As shown Figure 3 As shown in the figure, clk0, clk90, clk180, clk270 are the four sampling points of the data stream. Figure 3 The sampled data extracted from the data stream shown are "0000", "1111", "0000", and "1111". Originally, if a single clock were to obtain four sampled data in one clock cycle, the clock rate would need to be four times the modulation rate. However, this method only requires the clock rate to be twice the modulation rate, so that under the premise of having the same decoding speed, the clock resources of the single clock can be saved by half, and the decoding efficiency is higher.
[0043] After obtaining a plurality of sampled data, each sampled data may be combined in the order of acquisition, and then each sampled data may be decoded according to the encoding rule of Manchester encoding adopted by the data stream to obtain the decoded data of the data stream.
[0044] After acquiring the clock rate of a single-channel clock, the data stream formed by Manchester coding is sampled at the rising edge and the falling edge of the single-channel clock according to the clock rate of the single-channel clock to obtain a plurality of sampled data, so as to decode each sampled data and obtain decoded data of the data stream. Thus, in the process of decoding the data using Manchester coding, data is collected for decoding through double-edge sampling, so that at any clock rate, there is no need to output multiple clocks, and the decoding efficiency can be doubled. Moreover, a single clock has low requirements on clock offset jitter, which reduces the development difficulty. Thus, while improving the decoding efficiency, the clock resources required for decoding the data using Manchester coding are reduced.
[0045] To improve the accuracy of data decoding, in some embodiments, obtaining the clock rate of a single clock includes: obtaining the clock rate of the single clock according to the modulation rate of a data stream formed by Manchester encoding.
[0046] In some embodiments, when receiving a data stream formed by Manchester encoding, the decoding device may parse the data stream to obtain the modulation rate of the data stream. Alternatively, the modulation rate of the data stream may be obtained from an encoder that encodes the data stream. The data stream may be a data stream of serial data. The modulation rate refers to the change in a signal per unit time after being modulated, that is, the number of times the carrier parameter changes per unit time, also known as the symbol rate, symbol rate or baud rate.
[0047] After obtaining the modulation rate of the data stream, the clock rate of the single-channel clock that is N times the modulation rate can be determined based on the modulation rate. Among them, the clock rate refers to the number of pulses per second generated by the oscillator that sets the sampling speed of the decoder. N ≥ 1, the specific value can be determined according to the actual situation. For example, N can be inversely proportional to the modulation rate. If the modulation rate is high, the value of N is low to avoid excessive clock rate requirements and increase the cost and design difficulty of the decoding device; if the modulation rate is low, the value of N is high to further improve the decoding efficiency. Exemplarily, 2 times the modulation rate can be used as the clock rate of the single-channel clock.
[0048] In order to avoid the situation where decoding cannot occur, the preset rate can be calculated based on the computing resources that the decoding device can currently allocate to data sampling, and then the quotient obtained by dividing the preset rate by the modulation rate is used as the value N. Therefore, based on the value N and the modulation rate, the clock rate = N × modulation rate can be determined.
[0049] By adopting the modulation rate of the data stream formed by Manchester coding, the clock rate of the single-channel clock is obtained, so that the clock rate is adapted to the modulation rate of the data stream, thereby being able to decode Manchester codes of different modulation rates and improving the accuracy of data decoding.
[0050] When decoding the sampled data, in order to improve the accuracy of the decoded data obtained, in some embodiments, each sampled data is decoded to obtain decoded data of the data stream, including: comparing adjacent sampled data according to the sampling order of each sampled data to determine each transition edge position; and obtaining decoded data of the data stream from each sampled data according to each transition edge position.
[0051] In some embodiments, since there is a transition in the middle of each bit in Manchester encoding, the transition in the middle of the bit represents a data signal, that is, the data stream formed by Manchester encoding has a data signal located at the transition edge of the data stream. Therefore, after obtaining each sampled data, each sampled data can be arranged in a sampling order, and then any sampled data can be XOR-compared with the adjacent sampled data. If the phases of two adjacent sampled data are the same, such as two adjacent sampled data are both "1" or both "0", it means that no transition occurs between the two sampled data, and it can be determined that there is no transition edge between the two sampled data. If the phases of the sampled data of the two rings are different, such as the previous sampled data is "1" and the next sampled data is "0", it means that no transition occurs between the two sampled data, and it can be determined that there is a transition edge between the two sampled data. In this way, by comparing all adjacent sampled data, the transition edge position in each sampled data can be identified.
[0052] After determining the transition edge position, the sampling data on the left and right sides of the transition edge position can be compared to determine whether the transition edge at the transition edge position is a rising edge or a falling edge. If the sampling data on the left side of the transition edge position is "1" and the sampling data on the right side is "0", it can be determined that the transition edge at the transition edge position is a falling edge. After determining the type of transition edge at each transition edge position, the data signal corresponding to each transition edge can be extracted according to the encoding rules defined by Manchester encoding, so that all data signals can be arranged in the order of acquisition to obtain the decoded data of the data stream. If the encoding rules defined by Manchester encoding are that the rising edge represents "0" and the falling edge represents "1", then if the transition edge at a certain transition edge position is a rising edge, it can be determined that the data signal carried by the transition edge is "0".
[0053] By comparing adjacent sampled data according to the sampling order of the sampled data, the position of each transition edge is determined, and based on the position of each transition edge, the decoded data of the data stream is obtained from each sampled data, thereby utilizing the characteristic that the data signal using Manchester encoding is located at the transition edge, by comparing adjacent sampled data, the transition edge position is quickly determined for data decoding, thereby improving the decoding accuracy of the data stream using Manchester encoding.
[0054] In order to more accurately identify the transition edge position, in some embodiments, adjacent sampling data are compared according to the sampling order of each sampling data to determine the transition edge position, including: according to the sampling order of each sampling data, the last sampling data collected in the previous clock cycle is spliced with each sampling data collected in the next clock cycle to obtain spliced data; adjacent sampling data in the spliced data are compared to determine the transition edge position.
[0055] In some embodiments, considering that the data signal in the data stream is transmitted according to the clock cycle, the sampled data of the last bit collected in the previous clock cycle can be spliced with each sampled data collected in the next clock cycle according to the sampling order of each sampled data, so as to obtain the spliced data. Exemplarily, assuming that a clock rate twice the modulation rate is used for double clock edge sampling, 4 sampled data can be collected in one clock cycle. Assuming that the 4 sampled data collected in the previous clock cycle are "0000" and the 4 sampled data collected in the next clock cycle are "1111", the last sampled data in "0000" can be spliced with "1111" to obtain the spliced data "01111". After obtaining the spliced data, the sampled data of each adjacent bit in the spliced data can be XOR compared to obtain the transition edge position, so that the data signal of the data stream can be extracted from the spliced data using the transition edge position. In this way, the data signal of the data stream can be accurately extracted from each clock cycle.
[0056] Similarly, in some embodiments, each sampling data collected in the previous clock cycle can be spliced with the first sampling data collected in the next clock cycle according to the sampling order of each sampling data to obtain spliced data; adjacent sampling data in the spliced data are compared to determine the jump edge position.
[0057] For example, assuming that a clock rate twice the modulation rate is used for dual clock edge sampling, 4 sampled data can be collected in one clock cycle. Assuming that the 4 sampled data collected in the previous clock cycle are "0000" and the 4 sampled data collected in the next clock cycle are "1111", the first sampled data in "1111" can be spliced with "0000" to obtain the spliced data "00001". After obtaining the spliced data, the sampled data of each adjacent bit in the spliced data can be XOR compared to obtain the transition edge position, so that the data signal of the data stream can be extracted from the spliced data using the transition edge position.
[0058] After the data signal of the data stream is extracted through the transition edge position, the individual data signals can be spliced in the sampling order to obtain the decoded data of the data stream.
[0059] However, considering that when Manchester coding is used to form a data stream, Manchester coding needs to use a transition edge to represent the data signal. Therefore, if two adjacent data signals in the data stream are the same, Manchester coding will first make a transition between the two data signals. For example, if the data signal of the data stream is "11", Manchester coding uses a falling edge to represent "1" and a rising edge to represent "0", it means that the data stream needs to have two falling edges. Therefore, after the first falling edge appears to represent the first data signal "1", in the process from the first data signal "1" to the second data signal "1", its waveform needs to rise once before the second falling edge appears to represent the second data signal "1". In the process of sampling the data stream, three transition edges will be identified through the sampled data. At this time, if the decoding is performed directly according to the transition edge positions of these three transition edges, the decoded data obtained will be "101", which is inconsistent with the original data stream, resulting in a decoding error. Therefore, in order to improve the accuracy of decoding the data stream, in some embodiments, decoded data of the data stream is obtained from each sampled data, including: according to each transition edge position, obtaining each alternative data corresponding to each transition edge position from each sampled data; according to the modulation rate, screening each alternative data to obtain each target data; according to each target data, obtaining decoded data.
[0060] In some embodiments, after determining the transition edge position, the sampling data on the left and right sides of the transition edge position can be compared to determine whether the transition edge of the transition edge position is a rising edge or a falling edge. After determining the type of the transition edge of the transition edge position, one of the sampling data on the left and right sides of the transition edge position can be selected as the candidate data according to the encoding rule defined by Manchester encoding. Exemplarily, assuming that the sampling data on the left and right sides of the transition edge position are "0" and "1" respectively, it can be determined that the transition edge position is a rising edge. If the encoding rule defined by Manchester encoding is that the data signal represented by the rising edge is "0", the sampling data "0" on the left side of the transition edge position can be determined as the candidate data; if the encoding rule defined by Manchester encoding is that the data signal represented by the rising edge is "1", the sampling data "1" on the right side of the transition edge position can be determined as the candidate data. In the above manner, each candidate data corresponding to each transition edge position can be obtained from each sampling data.
[0061] After obtaining each candidate data, each candidate data can be arranged in a sampling order, and then, according to the arrangement order of each candidate data, starting from the second candidate data, the interval length between each candidate data and the first candidate data is determined. Then, for the interval length between any candidate data and the first candidate data, it is determined whether the interval length matches the modulation length between two adjacent data signals determined by the modulation rate, such as whether the interval length is an integer multiple of the modulation length. If so, the candidate data is retained; otherwise, the candidate data is deleted. In this way, the candidate data that matches the modulation rate can be screened out from all the candidate data as the target data, so that each target data can be arranged in the acquisition order to obtain the decoded data.
[0062] After obtaining each candidate data corresponding to each transition edge position from each sampled data through each transition edge position, each candidate data is screened according to the modulation rate to obtain each target data, so as to obtain decoded data according to each target data, thereby being able to screen out the sampling data determined by the transition edge that does not match the data stream from the decoded data, thereby improving the accuracy of the decoded data obtained.
[0063] In order to further improve the efficiency of screening the candidate data, in some embodiments, each candidate data is screened according to the modulation rate to obtain each target data, including: determining the time period of adjacent bits of the decoded data according to the modulation rate; and screening each candidate data in turn according to the time period to obtain each target data.
[0064] In some embodiments, the interval between any two adjacent data signals in the data stream can be determined based on the modulation rate, and the interval can be used as the time period of adjacent bits of the decoded data. If the modulation rate is to complete encoding once every 50ns, the time period of adjacent bits of the decoded data can be determined to be 50ns.
[0065] After all candidate data are obtained from each sampled data according to each jump edge position, each candidate data is arranged according to the acquisition order of each candidate data, and then the first candidate data is added to the target data set as the current data, and the next candidate data whose acquisition time interval with the current data meets the time period is extracted from each candidate data, and the current data is iteratively added to the target data set until the next candidate data of the current data cannot be extracted from each candidate data according to the time period, and all candidate data in the target data set are used as target data, so that the candidate data matching the modulation rate can be quickly screened out from each candidate data as the target data, so that each target data can be arranged in the acquisition order to obtain decoded data.
[0066] Figure 4 The present application provides a schematic diagram of the structure of a data decoding device. It should be understood that the device is Figure 1 Corresponding to the method embodiment executed in, the steps involved in the aforementioned method can be executed. The specific functions of the device can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device. Specifically, the device is used to perform collision detection on a battery with a sensor on the surface. The device includes: a rate acquisition module 200, which is used to obtain the clock rate of a single clock; a data sampling module 201, which is used to sample the data stream formed by Manchester encoding at the rising and falling edges of the single clock according to the clock rate of the single clock to obtain multiple sampled data; a data decoding module 202, which is used to decode each sampled data to obtain decoded data of the data stream.
[0067] In the technical solution of the embodiment of the present application, after obtaining the clock rate of a single-channel clock, the data stream formed by Manchester coding is sampled at the rising edge and the falling edge of the single-channel clock according to the clock rate of the single-channel clock to obtain multiple sampling data, so as to decode each sampling data to obtain the decoded data of the data stream, so that in the process of decoding the data using Manchester coding, data is collected for decoding through double-edge sampling, so that at any clock rate, there is no need to output multiple clocks, and the decoding efficiency can be doubled, and the single clock has low requirements on the clock offset jitter, which reduces the development difficulty, thereby improving the decoding efficiency while reducing the clock resources required for decoding the data using Manchester coding.
[0068] According to some embodiments of the present application, the rate acquisition module 200 is specifically used to: acquire the clock rate of the single-channel clock according to the modulation rate of the data stream formed by using Manchester encoding.
[0069] According to some embodiments of the present application, the data decoding module 202 is specifically used to: compare adjacent sampled data according to the sampling order of each sampled data to determine each transition edge position; and obtain decoded data of the data stream from each sampled data according to each transition edge position.
[0070] According to some embodiments of the present application, the data decoding module 202 is specifically used to: splice the last sampling data collected in the previous clock cycle with each sampling data collected in the next clock cycle according to the sampling order of each sampling data to obtain spliced data; compare adjacent sampling data in the spliced data to determine the jump edge position.
[0071] According to some embodiments of the present application, the data decoding module 202 is specifically used to: splice each sampling data collected in the previous clock cycle with the first sampling data collected in the next clock cycle according to the sampling order of each sampling data to obtain spliced data; compare adjacent sampling data in the spliced data to determine the jump edge position.
[0072] According to some embodiments of the present application, the data decoding module 202 is specifically used to: obtain each alternative data corresponding to each transition edge position from each sampled data according to each transition edge position; screen each alternative data according to the modulation rate to obtain each target data; and obtain decoded data according to each target data.
[0073] According to some embodiments of the present application, the data decoding module 202 is specifically used to: determine the time period of adjacent bits of the decoded data according to the modulation rate; and screen each candidate data in turn according to the time period to obtain each target data.
[0074] According to some embodiments of the present application, the clock rate is less than or equal to a preset rate, and the preset rate is determined according to the computing resources currently available for data sampling.
[0075] According to some embodiments of the present application, as Figure 5 shown, the present application provides an electronic device 300, including: a processor 301 and a memory 302. The processor 301 and the memory 302 are interconnected and communicate with each other through a communication bus 303 and / or other forms of connection mechanisms (not shown). The memory 302 stores a computer program executable by the processor 301. When the computing device runs, the processor 301 executes the computer program to execute the method performed by the external terminal in any optional implementation manner, for example: obtaining the clock rate of a single-channel clock; according to the clock rate of the single-channel clock, sampling the data stream formed by Manchester encoding at the rising edge and falling edge of the single-channel clock to obtain a plurality of sampling data; decoding each sampling data to obtain the decoded data of the data stream.
[0076] The present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the method in any of the foregoing optional implementation manners.
[0077] Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, abbreviated as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, abbreviated as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, abbreviated as EPROM), programmable read-only memory (Programmable Red-Only Memory, abbreviated as PROM), read-only memory (Read-OnlyMemory, abbreviated as ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0078] The present application provides a computer program product, which, when running on a computer, causes the computer to execute the method in any optional implementation manner.
[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application. In particular, as long as there is no structural conflict, the various technical features mentioned in the various embodiments can be combined in any way. The present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions that fall within the scope of the claims.
Claims
1. A data decoding method, It is characterized in that include: Get the clock rate of a single clock; According to the clock rate of the single-channel clock, sampling the data stream formed by using Manchester encoding at the rising edge and the falling edge of the single-channel clock to obtain a plurality of sampled data; Each of the sampled data is decoded to obtain decoded data of the data stream.
2. The method according to claim 1, It is characterized in that Get the clock rate of a single clock, including: The clock rate of the single-channel clock is obtained according to the modulation rate of the data stream formed by using Manchester encoding.
3. The method according to claim 1 or 2, It is characterized in that Decoding each of the sampled data to obtain decoded data of the data stream includes: Comparing adjacent sampling data according to the sampling order of each sampling data to determine the position of each transition edge; According to each of the transition edge positions, decoded data of the data stream is obtained from each of the sampled data.
4. The method according to claim 3, It is characterized in that According to the sampling order of each of the sampled data, adjacent sampled data are compared to determine each transition edge position, including: According to the sampling order of each of the sampled data, the last sampled data collected in the previous clock cycle is spliced with each sampled data collected in the next clock cycle to obtain spliced data; Adjacent sampling data in the spliced data are compared to determine the transition edge position.
5. The method according to claim 3, It is characterized in that According to the sampling order of each of the sampled data, adjacent sampled data are compared to determine each transition edge position, including: According to the sampling order of each of the sampled data, each sampled data collected in the previous clock cycle is spliced with the first sampled data collected in the next clock cycle to obtain spliced data; Adjacent sampling data in the spliced data are compared to determine the transition edge position.
6. The method according to any one of claims 3 to 5, It is characterized in that According to each of the transition edge positions, the decoded data of the data stream is obtained from each of the sampled data, including: According to each of the transition edge positions, acquiring each of the candidate data corresponding to each of the transition edge positions from each of the sampled data; According to the modulation rate, the candidate data are screened to obtain target data; The decoded data is obtained according to each of the target data.
7. The method according to claim 6, It is characterized in that According to the modulation rate, the candidate data are screened to obtain target data, including: Determining a time period of adjacent bits of the decoded data according to the modulation rate; According to the time period, each candidate data is screened in turn to obtain each target data.
8. A data decoding device, It is characterized in that include: A rate acquisition module, used to obtain the clock rate of a single-channel clock; A data sampling module, used for sampling a data stream formed by Manchester coding at a rising edge and a falling edge of the single-channel clock according to a clock rate of the single-channel clock to obtain a plurality of sampled data; The data decoding module is used to decode each of the sampled data to obtain decoded data of the data stream.
9. An electronic device comprising a processor and a memory storing a computer program, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.