Manchester decoding method and system
By using a predictive phase set to filter out glitches and data edges during the Manchester encoding and decoding process, and only judging the clock edge phase, the problem of low decoding efficiency is solved, and efficient and accurate decoding is achieved.
Patent Information
- Application Number
- CN202311090669.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-08-25
AI Technical Summary
During Manchester encoding and decoding, glitches and data edges can cause low decoding efficiency, making it difficult to accurately identify clock edges and affecting communication efficiency.
By detecting the phase of the transition edge in each sampling period, using the predicted phase set to filter out glitches and data edges, and only judging the possible clock edge phase, the target phase is determined for decoding.
It improves the efficiency and anti-interference capability of Manchester decoding, ensures accurate identification of clock edges, and enhances communication reliability.
Smart Images

Figure CN117278045B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a Manchester decoding method and system. Background Technology
[0002] Manchester encoding method, for example Figure 2 As shown, encoding 01 represents data 0, encoding 10 represents data 1; encoding 11 indicates the start of a data frame, and encoding 00 indicates the end of a data frame. When the sending end is not sending raw data, i.e., when it is idle, it continuously sends data 0, which is encoded as the sequence 01010101…, to notify the receiving end to establish a connection.
[0003] There may be two types of transition edges in the encoded data. The one that causes a phase transition due to Manchester encoding is called the clock edge, for example... Figure 2 In the t1 time interval, the transition from 0 to 1 in the encoding of data "0" (01) is called a data edge; the phase transition caused by data is called a data edge, for example... Figure 2 In the t2 time period, in the Manchester encoding of the consecutive 2 bits "0b00" "0101", the transition from 1 to 0 edge is affected by the fact that during decoding, only the encoded data corresponding to the clock edge of the sampled data needs to be decoded. By sampling the encoded data, the transition edge of the sampled data may include not only the clock edge but also the data edge and glitches caused by signal interference. Therefore, the decoding efficiency will be reduced due to the influence of the data edge and glitches. Summary of the Invention
[0004] This application provides a Manchester decoding method and system with high decoding efficiency.
[0005] A Manchester decoding method, the method comprising:
[0006] Within each sampling period, the phase corresponding to the transition edge in each sampled data is detected to obtain the edge phase;
[0007] From the edge phases, determine the edge phase that matches the predicted phase set within the target sampling period to obtain the target phase; the target sampling period is the sampling period in the frame transmission state; the predicted phase set is the predicted phase corresponding to the clock edge;
[0008] The encoded data under the target phase is decoded to obtain the decoded data for each target sampling period.
[0009] In one embodiment, determining the edge phase that matches the predicted phase set within the target sampling period to obtain the target phase includes:
[0010] The edge phase that matches the predicted phase set within each sampling period is determined to obtain the encoded phase;
[0011] The encoded phase within the target sampling period is obtained to obtain the target phase.
[0012] In one embodiment, determining the edge phase that matches the predicted phase set within each sampling period to obtain the encoded phase includes:
[0013] Within each of the aforementioned sampling periods, the edge phase obtained in the current sampling period is acquired to obtain the current edge phase;
[0014] The current edge phase is compared with the predicted phase set to obtain the current comparison result;
[0015] Obtain the previous comparison result; wherein the previous comparison result is the comparison result between the previous edge phase and the predicted phase set in the previous sampling period; wherein the previous edge phase is the edge phase obtained in the previous sampling period;
[0016] If the current comparison result is that the predicted phase set includes one or two current edge phases, and the previous comparison result is that the predicted phase set includes the previous edge phase, then the current edge phase in the predicted phase set is used as the encoded phase of the current sampling period.
[0017] In one embodiment, determining the edge phase that matches the predicted phase set within each sampling period to obtain the encoded phase further includes:
[0018] If the current comparison result is that the predicted phase set includes a current edge phase, the previous comparison result is that the predicted phase set does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, then the current edge phase in the predicted phase set is used as the encoded phase of the current sampling period.
[0019] In one embodiment, the method further includes:
[0020] Obtain the first number of sub-data points where the sampled data collected up to the current sampling period is consecutively 0;
[0021] If the first quantity does not exceed the first quantity threshold, then the current sampling period is in the non-frame end transmission state.
[0022] In one embodiment, the method further includes:
[0023] Obtain the second number of sub-data that are consecutively 1 up to each of the sampling periods. If the second number exceeds the second number threshold, record the reference state under the sampling period as the frame transmission state.
[0024] The target sampling period is obtained by acquiring the sampling period in which the reference state is the frame transmission state and is not in the frame end state.
[0025] In one embodiment, the method further includes:
[0026] In each of the sampling periods, if the current comparison result is that the predicted phase set includes three or more of the current edge phases, or if the current comparison result is that the predicted phase set does not include the current edge phase and the previous comparison result is that the predicted phase set does not include the previous edge phase, or if the current sampling period is in the frame end state, then the reference state is reset.
[0027] In one embodiment, when the number of encoded phases is one, the method further includes:
[0028] If the current sampling period is in the non-frame end transmission state, then the phase with a phase difference of the encoded phase of the current sampling period within a preset threshold is obtained to obtain the first phase set;
[0029] Update the predicted phase set to the first phase set.
[0030] In one embodiment, the method further includes:
[0031] In each of the sampling periods, if the current comparison result is that the predicted phase set includes more than three of the current edge phases, then the predicted phase set is cleared.
[0032] In one embodiment, when the number of encoded phases is two, the method further includes:
[0033] If the current sampling period is in the non-frame end transmission state, then the one that lags behind the two encoded phases of the current sampling period is obtained to obtain the reference phase;
[0034] The phases whose phase difference with the reference phase is within a preset threshold are obtained to obtain a second phase set;
[0035] Update the predicted phase set to the second phase set.
[0036] In one embodiment, the method further includes:
[0037] In each of the sampling periods, if the current comparison result is that the predicted phase set does not include the current edge phase, and the previous comparison result is that the predicted phase set does not include the previous edge phase, then the predicted phase set is cleared.
[0038] In one embodiment, the method for obtaining the predicted phase set includes:
[0039] Obtain the phase of the first rising edge of the first sampled data to obtain the initial phase;
[0040] The phases whose phase difference from the initial phase is within a preset threshold are taken as the predicted phase set.
[0041] A Manchester decoding system, the system comprising:
[0042] The edge detection module is used to detect the phase corresponding to the transition edge in each sampled data in each sampling period to obtain the edge phase;
[0043] The decoding module, connected to the edge detection module, is used for:
[0044] From the edge phases, determine the edge phase that matches the predicted phase set within the target sampling period to obtain the target phase; the target sampling period is the sampling period in the frame transmission state; the predicted phase set is the predicted phase corresponding to the clock edge;
[0045] The encoded data under the target phase is decoded to obtain the decoded data for each target sampling period.
[0046] By detecting the phase corresponding to the transition edge in each sampled data within each sampling period, the edge phase is obtained. Then, from the edge phases, the edge phase that matches the predicted phase set within the target sampling period is determined, and the target phase is obtained. Finally, the encoded data under the target phase is decoded to obtain the decoded data for each target sampling period. In this way, only the phases with a high probability of becoming the clock edge phase, i.e., the phases within the predicted phase set, need to be judged. The obtained edge phases are filtered using the predicted phase set to remove glitches and edge phases corresponding to data edges outside the predicted phase set. The edge phases falling into the predicted phase set are directly determined as the phases of the corresponding clock edges. Therefore, it is not necessary to judge all edge phases one by one. The target phase corresponding to the clock edge can be quickly determined, thereby improving decoding efficiency. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating a Manchester decoding method according to an embodiment of this application;
[0048] Figure 2 This is a schematic diagram of clock signal sampling of coded data according to an embodiment of this application;
[0049] Figure 3 This is a schematic diagram illustrating the sampling of coded data by a clock signal according to another embodiment of this application;
[0050] Figure 4 This is a schematic diagram illustrating the sampling of coded data by a clock signal according to another embodiment of this application;
[0051] Figure 5 This is a structural block diagram of a Manchester decoding system according to an embodiment of this application;
[0052] Figure 6 This is a flowchart illustrating a Manchester decoding method according to an embodiment of this application. Detailed Implementation
[0053] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0055] It should be noted that all directional indicators (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicator will also change accordingly. The connection can be a direct connection or an indirect connection.
[0056] Furthermore, the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.
[0057] Figure 1 This is a flowchart illustrating one embodiment of the Manchester decoding method, as shown below. Figure 1 As shown, the method includes steps S110 to S130.
[0058] Step S110: Within each sampling period, detect the phase corresponding to the transition edge in each sampled data to obtain the edge phase.
[0059] The sampled data can be obtained by sampling the coded data using a clock signal. Specifically, a single clock signal can be used to sample within each sampling period, with multiple clock cycles evenly distributed across the sampling periods. Each clock cycle will collect one piece of coded data, resulting in multiple pieces of coded data collected in each sampling period, ultimately forming a single sampled data set. (Reference) Figure 2 As shown, taking one sampling period as an example, which includes 8 clock cycles of clock signal S, 8 coded data will be collected in each sampling period as a sample data.
[0060] The sampled data consists of data 0s and 1s. When two adjacent sub-datas in the sampled data are different, it indicates that a transition has occurred in the encoded data. The difference between the two adjacent sub-datas can be used to determine whether a transition edge has occurred in the sampled data, and the phase corresponding to the transition edge can be obtained as the edge phase. The phase corresponding to the transition edge in the sampled data can be the phase of the encoded data corresponding to the transition edge in the sampled data. The encoded data in the sampled data are arranged in the order of their acquisition time. The phase of the encoded data can be the rank of the encoded data in the sampled data according to the sampling order. For example, the first encoded data acquired is in the first rank, the next is in the second rank, and so on. The phase can also be represented as an identifier used to index the encoded data in the sampled data. This identifier includes a sequence number representing the order of the encoded data. For example, taking the sampled data acquired from the clock signal S as including 8 bits of encoded data, the identifiers of each encoded data can be s0, s1, s2, s3, s4, s5, s6, and s7. Therefore, this identifier can be used as the phase of each encoded data in the sampled data. Furthermore, in the sampled data, the sub-data acquired earlier is the first sub-data, and vice versa. When a transition edge occurs in the sampled data, the second sub-data in two adjacent sub-data is the encoded data corresponding to the transition edge.
[0061] Step S120: Determine the edge phase that matches the predicted phase set within the target sampling period from the edge phases to obtain the target phase; the target sampling period is the sampling period in the frame transmission state; the predicted phase set is the predicted phase corresponding to the clock edge.
[0062] It is understandable that during the sampling process, the states of each sampling period include frame end state and non-frame end state. The non-frame end state includes the frame transmission state and the idle state before the frame transmission state. The frame transmission state includes the state when data frames are being transmitted, and the state when the frame start flag is sampled and data frame transmission begins. The idle state is the state when data 0 is continuously transmitted during idle time. Only data decoded under the frame transmission state is valid. Therefore, the target sampling period under the frame transmission state can be determined, and the edge phase that matches the predicted phase set in that target sampling period can be used as the target phase. The predicted phase set is the predicted phase corresponding to the clock edge of the encoded data. It can be preset manually according to the characteristics of the encoded data, or it can be obtained from the collected historical encoded data. By matching the edge phase with the corresponding predicted phase set, the successfully matched edge phase can be used as the target phase corresponding to the clock edge. By setting the predicted phase set and matching the edge phase within the target sampling period with the predicted phase set, edge phases that may correspond to glitches or data edges can be filtered out, thereby obtaining the edge phase corresponding to the clock edge. This improves decoding efficiency and enhances anti-interference capability.
[0063] Step S130: Decode the encoded data under the target phase to obtain the decoded data for each target sampling period.
[0064] In this context, each target phase is the edge phase corresponding to the clock edge of the encoded data. Based on the Manchester encoding method, in one implementation, the encoded data under the target phase can be inverted (for example, if the encoded data is 1, it becomes 0 after inversion; if the encoded data is 0, it becomes 1 after inversion) to obtain the decoded data.
[0065] The above method detects the phase corresponding to the transition edge in each sampled data within each sampling period to obtain the edge phase. Then, from the edge phases, it determines the edge phase that matches the predicted phase set within the target sampling period to obtain the target phase. Finally, it decodes the encoded data under the target phase to obtain the decoded data for each target sampling period. In this way, it is only necessary to judge the phases that are more likely to become the clock edge phase, i.e., the phases in the predicted phase set. The obtained edge phases are filtered using the predicted phase set to remove glitches and edge phases corresponding to data edges outside the predicted phase set. The edge phases falling into the predicted phase set are directly determined as the phases of the corresponding clock edge. Therefore, it is not necessary to judge all edge phases one by one. The target phase corresponding to the clock edge can be quickly determined, thereby improving the decoding efficiency.
[0066] In one embodiment, determining the edge phase that matches the predicted phase set within the target sampling period to obtain the target phase includes: determining the edge phase that matches the predicted phase set within each sampling period to obtain the encoded phase; and obtaining the encoded phase within the target sampling period to obtain the target phase.
[0067] It is understandable that to determine the edge phase that matches the predicted phase set within the target sampling period, the edge phase that matches the predicted phase set within each sampling period can be determined first to obtain the encoded phase. Since the encoded phase may include the edge phase that matches the predicted phase set in the idle state and the frame end transmission state, and data decoding is not required in the idle state and the frame end transmission state, after obtaining the encoded phase, the encoded phase within the target sampling period can be further obtained to obtain the target phase.
[0068] In one embodiment, determining the edge phase that matches the predicted phase set within each sampling period to obtain the encoded phase includes: acquiring the edge phase obtained in the current sampling period within each sampling period to obtain the current edge phase; comparing the current edge phase with the predicted phase set to obtain the current comparison result; and acquiring the previous comparison result, wherein the previous comparison result is the comparison result between the previous edge phase and the predicted phase set in the previous sampling period; wherein the previous edge phase is the edge phase obtained in the previous sampling period; if the current comparison result is that the predicted phase set includes one or two current edge phases, and the previous comparison result is that the predicted phase set includes the previous edge phase, then the current edge phase in the predicted phase set is used as the encoded phase of the current sampling period.
[0069] Specifically, it can obtain the current edge phase corresponding to the transition edge in the sampled data within the current sampling period. The current edge phase can be one or more. Then, it compares the current edge phase with the predicted phase set to obtain the current edge phase falling into the predicted phase set, i.e., the current comparison result. The predicted phase set includes one or more phases, and the predicted phase set can be the same or different in different sampling periods. Furthermore, it can also obtain the previous comparison result between the previous edge phase and the predicted phase set in the previous sampling period.
[0070] Furthermore, if the current comparison result is that the predicted phase set includes a current edge phase, and the previous comparison result is that the predicted phase set includes the previous edge phase, it indicates that the current sampling period is in an idle state or in a frame transmission state when transmitting data frames, and both the current edge phase and the previous edge phase fall into the predicted phase set. At this time, the clock signal in the current sampling period is successfully synchronized with the encoded data, and the current edge phase falling into the predicted phase set is the encoded phase corresponding to the clock edge of the encoded data in the current sampling period.
[0071] If the current comparison result is that the predicted phase set includes two current edge phases, and the previous comparison result is that the predicted phase set includes the previous edge phase, it indicates that the current sampling period is in the state of transmitting data frames, but at this time the speed of receiving encoded data is slower than the speed of sending encoded data; at this time, the clock signal in the current sampling period is successfully synchronized with the encoded data, and the two current edge phases falling into the predicted phase set are both encoded phases corresponding to the clock edge of the encoded data in the current sampling period.
[0072] Specifically, because the clocks used for transmitting and receiving encoded data are not synchronized, the speed of receiving encoded data may be slower than the speed of transmitting encoded data. In this case, the period of the sender is shorter than that of the receiver. As time accumulates, the clock edge sampled will continuously advance, meaning the clock edge is sampled earlier and earlier, and the encoded phase will continuously decrease. When it decreases to the point where the phase of the encoded data sampled first in a sampling period becomes the encoded phase, if it continues to decrease, there will be two encoded phases in the predicted phase set in the next sampling period. Through the above determination method, the edge drift problem caused by the difference in frequency between the transmitting and receiving clocks can be solved, and the encoded phase at which the clock edge is sampled can be found, thus improving the decoding accuracy.
[0073] For example, suppose a sampling period consists of 8 clock cycles of the clock signal S, referencing... Figure 4 As shown, let the phases of the coded data sampled within the clock cycle of each sampling period be s0, s1, s2, s3, s4, s5, s6, and s7, respectively. Assume the clock signal S is sampled at the rising edge, the coded phase of sampling period T4 is s0, and the predicted phase set consists of phases s0, s1, and s7. As the coded phase continuously decreases, when it decreases to phase s0 (within sampling period T4), and continues to decrease, within sampling period T5, phases s0 and s7 in the predicted phase set both correspond to the clock edge of the coded data.
[0074] By comparing the current edge phase with the predicted phase set in each sampling period, phases that may sample glitches or data edges in the current edge phase can be filtered out, enhancing anti-interference capability and ultimately improving decoding efficiency. Furthermore, the current comparison result is combined with the historical comparison results to determine the encoded phase of the current sampling period, improving the accuracy of judgment. The method is simple and reliable.
[0075] In one embodiment, determining the edge phase that matches the predicted phase set within each sampling period to obtain the encoded phase further includes: if the current comparison result is that the predicted phase set includes a current edge phase, the previous comparison result is that the predicted phase set does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, then the current edge phase in the predicted phase set is used as the encoded phase of the current sampling period.
[0076] It is understandable that if the current comparison result shows that the predicted phase set includes a current edge phase, and the previous comparison result shows that the predicted phase set does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, it indicates that the current sampling period is in the frame transmission state when the frame start flag is sampled and the data frame is started to be transmitted, or in the state when the data frame is being transmitted. However, at this time, the speed of receiving encoded data is faster than the speed of sending encoded data. At this time, the clock signal in the current sampling period is successfully synchronized with the encoded data, and the current edge phase that falls into the predicted phase set is the encoded phase of the current sampling period.
[0077] It is understandable that when the start of a frame is sampled, the predicted phase set may include a current edge phase, while the predicted phase set of the previous sampling period may not include the previous edge phase. Therefore, as one scenario, when the predicted phase set includes a current edge phase, the predicted phase set of the previous sampling period may not include the previous edge phase, and the current sampling period is not in a frame end transmission state, it may be the state when the frame start flag is sampled and data frame transmission begins in the current sampling period. Furthermore, because the clock used by the external encoding system to send encoded data and the clock used by this decoding method to receive encoded data are not synchronized, the speed of receiving encoded data may be faster than the speed of sending encoded data. In this case, the transmission period is relatively long compared to the reception period. As time accumulates, the encoded phase corresponding to the clock edge will continuously shift backward, meaning the clock edge is sampled later and the encoded phase continuously increases. When it increases to the latest phase in the sampling period, if it continues to increase, there will be no encoded phase corresponding to the clock edge in the predicted phase set of the next sampling period, and the encoded phase corresponding to the clock edge will only appear in the period after the next sampling period. By using the above determination method, the clock edge drift problem caused by different frequencies of the transmitting and receiving clocks can be solved, and the encoded phase where the clock edge appears can be found in the sample, thereby improving the accuracy of decoding.
[0078] For example, suppose a sampling period consists of 8 clock cycles of the clock signal, referencing... Figure 3 As shown, let the phases of the coded data sampled within the clock cycle of each sampling period be s0, s1, s2, s3, s4, s5, s6, and s7, respectively. Assume the clock signal S is sampled at the rising edge, the coded phase in sampling period T1 is s7, and the prediction phase set consists of phases s0, s6, and s7. As the coded phase continuously increases, reaching phase s7 (within sampling period T1), and then continuing to increase, within sampling period T2, phases s0, s6, and s7 in the prediction phase set do not correspond to the clock edge of the coded data. However, within sampling period T3, phase s0 corresponds to the clock edge of the coded data.
[0079] Therefore, as another case, when the predicted phase set includes a current edge phase, the predicted phase set in the previous sampling period does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, it may be that the current sampling period is in the state of transmitting data frames, but the speed of receiving encoded data is faster than the speed of sending encoded data.
[0080] In one embodiment, the method further includes: obtaining a first number of sub-data that are consecutively 0 in the sampled data collected up to the current sampling period; if the first number does not exceed a first number threshold, then the current sampling period is in a non-frame end transmission state.
[0081] refer to Figure 2 As shown, the encoded data at the end of the frame is 0. The clock signal collects eight consecutive 0s in the encoded data of this frame. Combining the encoded data before and after the end of the frame, theoretically, when more than eight consecutive 0s are collected, the end-of-frame marker can be determined. Therefore, the first number of consecutive sub-data collected can be used to determine whether the frame is in the end-of-frame transmission state.
[0082] Specifically, after sampling the clock signal in each sampling cycle, the first number of consecutive zero sub-data points in the sampled data collected up to the current sampling cycle can be obtained. In fact, the first number is the number of consecutive zero sub-data points in the sampled data composed of the current and previous sampling cycles. If the first number exceeds a first threshold, it indicates that the current sampling cycle has collected a frame end marker and is in a frame end transmission state; if it does not exceed the first threshold, it indicates that the current sampling cycle is in a non-frame end transmission state. Based on the Manchester encoding rule, two adjacent frames of encoded data will not contain only zero data points. Therefore, the first threshold can be determined based on the number of clock cycles, set to be greater than 1 times the number of clock cycles and less than 2 times the number of clock cycles. In one embodiment, taking 8 clock cycles as an example, the first threshold can be set to 11-12.
[0083] In one embodiment, the method further includes: obtaining a second number of sub-data that are consecutively 1 up to each sampling period; if the second number exceeds a second number threshold, recording the reference state as frame transmission state under the sampling period; obtaining the sampling period in each sampling period where the reference state is frame transmission state and is not in the frame end state, to obtain the target sampling period.
[0084] It can be understood that after sampling the clock signal in each sampling cycle, a second number of consecutive 1 sub-data points in the sampled data up to that sampling cycle is obtained. In fact, the second number can be the number of consecutive 1 sub-data points in the sampled data of the current sampling cycle and the previous sampling cycle. The threshold for the second number can be determined based on the number of clock cycles, set to be greater than 1 times the number of clock cycles and less than 2 times the number of clock cycles.
[0085] Specifically, after acquiring the second quantity in each sampling period, the second quantity is compared with a second quantity threshold. Once it is determined that the second quantity exceeds the second quantity threshold, it indicates that a frame start flag has been acquired in that sampling period. At this point, it can be considered that all sampling periods from that sampling period until the end of the frame are in the frame transmission state. Therefore, the sampling period in the frame transmission state can be marked by recording the reference state as the frame transmission state. Furthermore, in each sampling period, if the reference state is the frame transmission state and the sampling period is not in the frame end state, then that sampling period can be used as the target sampling period.
[0086] It is understandable that if the current comparison result is that the predicted phase set includes a current edge phase, and the previous comparison result is that the predicted phase set includes the previous edge phase, since the current sampling period may be in an idle state or in a frame transmission state when data frames are being transmitted, the above method can be used to determine whether it belongs to the target sampling period.
[0087] If the current comparison result is that the predicted phase set includes a current edge phase, and the previous comparison result is that the predicted phase set does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, it indicates that the current sampling period is in the frame transmission state when the frame start flag is sampled and the data frame is started to be transmitted, or in the state when the data frame is being transmitted. However, at this time, the Manchester decoding method receives encoded data faster than the encoding method sends encoded data. In this case, it can be directly determined that the current sampling period belongs to the target sampling period without using the above method for judgment.
[0088] If the current comparison result is that the predicted phase set includes two current edge phases, and the previous comparison result is that the predicted phase set includes the previous edge phase, it indicates that the current sampling period is in the state of transmitting data frames. However, at this time, the speed of receiving encoded data is slower than the speed of sending encoded data. In this case, it can be directly determined that the current sampling period belongs to the target sampling period without having to use the above method for determination.
[0089] In one embodiment, the method further includes: in each sampling period, if the current comparison result is that the predicted phase set includes more than three current edge phases, or if the current comparison result is that the predicted phase set does not include the current edge phase and the previous comparison result is that the predicted phase set does not include the previous edge phase, or if the current sampling period is in the end-of-frame state, then the reference state is reset.
[0090] It is understandable that encoding data synchronization failures may occur during frame transmission. Therefore, in each sampling period, if any of the following three situations occur: the current comparison result shows that the predicted phase set includes more than three current edge phases; the current comparison result shows that the predicted phase set does not include the current edge phase and the previous comparison result shows that the predicted phase set does not include the previous edge phase; or the current sampling period is in the frame end state, it indicates that the clock signal has failed to synchronize with the encoded data in that sampling period. In this case, a Manchester violation is considered to have occurred in that sampling period, and therefore the reference state needs to be reset to re-mark the sampling period in the frame transmission state. The reset reference state is a state other than the frame transmission state, such as an empty state that does not represent any transmission state for the sampling period.
[0091] Among them, the current sampling period being in the frame end state can be the first quantity in the current sampling period exceeding the first quantity threshold.
[0092] In one embodiment, when the number of encoded phases is one, the method further includes: if the current sampling period is in a non-frame end transmission state, obtaining phases whose phase difference with the encoded phase of the current sampling period is within a preset threshold to obtain a first phase set; and updating the predicted phase set to the first phase set.
[0093] It can be understood that the encoding phase is the phase of the corresponding clock edge of the encoded data. Under normal circumstances, the encoding phase of the next cycle should be the same as the encoding phase of the current sampling cycle. For example... Figure 2The encoded phase in each sampling period is phase s5. However, due to the different clocks of the transmitting and receiving parties, the encoded phase may shift. But the shift amplitude between adjacent sampling periods will not be too large. Therefore, the encoded phase of the next sampling period can be predicted by using the phase difference between the current sampling period and the encoded phase within a preset threshold. The phase difference between two phases can be the difference in rank between the encoded data corresponding to the two phases. For example, if the phases represent the encoded data of the first rank and the encoded data of the second rank respectively, their phase difference is the difference between the first rank and the second rank, which is 1. When the phase is represented by an identifier, the phase difference can be equal to the difference between the serial numbers in the identifier. For example, the phase difference between phase sp and phase s(p-1) is p-(p-1)=1. If there is a cross-period situation, the value n of the number of clock cycles needs to be added. For example, the phase difference between phase s(p+5) of the previous sampling period and phase s(p) of the current sampling period is p-(p+5)+n. Specifically, the first phase set can be used as the phases whose phase difference with the coded phase of the current sampling period is within a preset threshold, thereby updating the predicted phase set. For each subsequent sampling period in a non-frame end transmission state, after obtaining the coded phase, the predicted phase set is updated to accurately obtain the coded phase of the next sampling period.
[0094] The preset threshold can be related to the number of clock cycles. For example, suppose the phase difference between adjacent phases is 1; in one embodiment, if the number of clock cycles is 8, then the preset threshold can be set to 1. For example, refer to... Figure 2 As shown, when phase s5 is determined as the encoding phase within the current sampling period, the phases s4, s5, and s6 whose phase difference from the encoding phase is within 1 are used. Therefore, phases s4, s5, and s6 can be used as the preset phase set for the next sampling period; Reference Figure 3 As shown, taking phase s7 as the encoding phase of sampling period T1 as an example, the phases with a phase difference of 1 from the encoding phase are s0, s6 and s7. Therefore, phases s0, s6 and s7 can be used as the first phase set, and then the predicted phase set can be updated. In another embodiment, if the number of clock cycles is 16, the preset threshold can be set to 2. Similarly, the predicted phase set can be deduced from the above.
[0095] In one embodiment, the method further includes: in each sampling period, if the current comparison result is that the predicted phase set includes more than three current edge phases, then the predicted phase set is cleared.
[0096] It is understandable that if the current comparison result shows that the predicted phase set includes more than three current edge phases, it indicates that the clock signal has failed to synchronize with the encoded data in the current sampling period. It can be determined that a Manchester violation has occurred in the current sampling period. At this time, the predicted phase set is cleared and the next sampling period is used as the starting point for decoding.
[0097] In one embodiment, when the number of coded phases is two, the method further includes: if the current sampling period is in a non-frame end transmission state, obtaining the phase that lags behind the current sampling period to obtain a reference phase; obtaining the phases whose phase difference with the reference phase is within a preset threshold to obtain a second phase set; and updating the predicted phase set to the second phase set.
[0098] It can be understood that the encoding phase is the phase corresponding to the clock edge of the encoded data. Typically, the phase difference between the encoding phase of the next cycle and the encoding phase of the current sampling cycle is not significant. Therefore, we can first determine the encoding phase corresponding to the latest clock edge (i.e., the encoding phase that lags behind) to obtain the reference phase. Then, we use the phases whose phase difference with the reference phase is within a preset threshold to predict the encoding phase of the next sampling cycle. Specifically, we can use the phases whose phase difference with the reference phase is within a preset threshold as the second phase set, thereby updating the predicted phase set. For each subsequent sampling cycle in a non-frame-end transmission state, after obtaining the two encoding phases, the predicted phase set is updated to accurately obtain the encoding phase of the next sampling cycle.
[0099] The preset threshold can be related to the number of clock cycles. For example, suppose the phase difference between adjacent phases is 1; in one embodiment, if the number of clock cycles is 8, then the preset threshold can be set to 1. For example, refer to... Figure 4 As shown, in the sampling period T5, the two encoded phases are s0 and s7. At this time, phase s7 is used as the reference phase. The phases with a phase difference of less than 1 from the reference phase are s0, s6 and s7. Therefore, phases s0, s6 and s7 can be used as the second phase set to update the predicted phase set. In another embodiment, if the number of clock cycles is 16, the preset threshold can be set to 2. Similarly, the predicted phase set can be deduced from the above.
[0100] In one embodiment, the method further includes: in each sampling period, if the current comparison result is that the predicted phase set does not include the current edge phase, and the previous comparison result is that the predicted phase set does not include the previous edge phase, then the predicted phase set is cleared.
[0101] It is understandable that if the previous comparison result shows that the predicted phase set does not include the previous edge phase, it indicates that the previous sampling period may have been in the state of transmitting data frames, but the speed of receiving encoded data is faster than the speed of sending encoded data. Under normal circumstances, the predicted phase of the current sampling period should be sampled at the clock edge, that is, the current comparison result should show that the predicted phase set includes the current edge phase. Conversely, if the current comparison result shows that the predicted phase set does not include the current edge phase, it indicates that the clock signal has failed to synchronize with the encoded data in the current sampling period. It can be determined that a Manchester violation has occurred in the current sampling period. At this time, the predicted phase set is cleared, and the next sampling period is used as the starting point for decoding.
[0102] In one embodiment, the method for obtaining the predicted phase set includes: obtaining the phase of the first rising edge of the first sampled data to obtain the initial phase; and using the phases whose phase difference with the initial phase is within a preset threshold as the predicted phase set.
[0103] It is understandable that, in order to obtain the encoded phase of subsequent sampling periods, the phases whose phase difference with the obtained initial phase is within a preset threshold can be used as the initial predicted phase set. Then, the predicted phase set will be continuously updated and corrected in subsequent sampling periods, thereby improving the accuracy of the obtained encoded phase.
[0104] Since the sender continuously sends data 0 (0101 sequence) when no connection is established, the rising edge at this time must be the clock edge. Therefore, the first rising edge in the first sampled data can be considered as the clock edge, and its corresponding phase can be used as a reference phase to predict the phase of subsequent clock edges, thereby effectively improving the accuracy of clock edge determination.
[0105] This invention also provides a Manchester decoding system, such as... Figure 5 As shown, the system includes an edge detection module 110 and a decoding module 111. The edge detection module is used to detect the phase corresponding to the transition edge in each sampled data within each sampling period to obtain the edge phase. The decoding module is connected to the edge detection module and is used to: determine the edge phase that matches the predicted phase set within the target sampling period from the edge phases to obtain the target phase; the target sampling period is the sampling period in the frame transmission state; the predicted phase set is the predicted phase corresponding to the clock edge; and decode the encoded data under the target phase to obtain the decoded data for each target sampling period.
[0106] The working principle and beneficial effects of the Manchester decoding system of this invention have been specifically described in the above Manchester decoding method, and will not be repeated here.
[0107] In one embodiment, the decoding module is further configured to: determine the edge phase that matches the predicted phase set in each sampling period to obtain the encoded phase; and obtain the encoded phase in the target sampling period to obtain the target phase.
[0108] In one embodiment, the decoding module is further configured to: obtain the edge phase obtained in the current sampling period within each sampling period to obtain the current edge phase; compare the current edge phase with the predicted phase set to obtain the current comparison result; obtain the previous comparison result; wherein the previous comparison result is the comparison result between the previous edge phase and the predicted phase set in the previous sampling period; wherein the previous edge phase is the edge phase obtained in the previous sampling period; if the current comparison result is that the predicted phase set includes one or two current edge phases, and the previous comparison result is that the predicted phase set includes the previous edge phase, then the current edge phase in the predicted phase set is used as the encoding phase of the current sampling period.
[0109] In one embodiment, the decoding module is further configured to: if the current comparison result is that the predicted phase set includes a current edge phase, the previous comparison result is that the predicted phase set does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, then the current edge phase in the predicted phase set is used as the encoding phase of the current sampling period.
[0110] In one embodiment, the decoding module is further configured to: obtain a first number of sub-data that are consecutively 0 in the sampled data collected up to the current sampling period; if the first number does not exceed a first number threshold, the current sampling period is in a non-frame end transmission state.
[0111] In one embodiment, the decoding module is further configured to: obtain a second number of sub-data that are consecutively 1 up to each sampling period; if the second number exceeds a second number threshold, record the reference state as frame transmission state in the sampling period; obtain the sampling period in each sampling period where the reference state is frame transmission state and is not in the frame end state, and obtain the target sampling period.
[0112] In one embodiment, the decoding module is further configured to: in each sampling period, if the current comparison result is that the predicted phase set includes more than three current edge phases, or if the current comparison result is that the predicted phase set does not include the current edge phase and the previous comparison result is that the predicted phase set does not include the previous edge phase, or if the current sampling period is in the end-of-frame state, then reset the reference state.
[0113] In one embodiment, when the number of encoded phases is one, the decoding module is further configured to: if the current sampling period is in a non-frame end transmission state, obtain the phases whose phase difference with the encoded phases of the current sampling period is within a preset threshold, and obtain a first phase set; update the predicted phase set to the first phase set.
[0114] In one embodiment, the decoding module is further configured to clear the predicted phase set if the current comparison result indicates that the predicted phase set includes more than three current edge phases in each sampling period.
[0115] In one embodiment, when the number of encoded phases is two, the decoding module is further configured to: if the current sampling period is in a non-frame end transmission state, obtain the phase that lags behind the two encoded phases of the current sampling period to obtain the reference phase; obtain the phases whose phase difference with the reference phase is within a preset threshold to obtain the second phase set; and update the predicted phase set to the second phase set.
[0116] In one embodiment, the decoding module is further configured to: in each sampling period, if the current comparison result is that the predicted phase set does not include the current edge phase, and the previous comparison result is that the predicted phase set does not include the previous edge phase, then clear the predicted phase set.
[0117] In one embodiment, the decoding module is further configured to: obtain the phase of the first rising edge of the first sampled data to obtain the initial phase; and use the phases whose phase difference with the initial phase is within a preset threshold as the predicted phase set.
[0118] This invention also provides a Manchester decoding method, including steps (a1) to (a18).
[0119] Step (a1): Within each sampling period, detect the phase corresponding to the transition edge in each sampled data to obtain the edge phase.
[0120] Step (a2): Obtain the phase of the first rising edge of the first sampled data to obtain the initial phase; use the phases whose phase difference with the initial phase is within a preset threshold as the predicted phase set.
[0121] Step (a3): Obtain the edge phase obtained within the current sampling period to obtain the current edge phase; compare the current edge phase with the predicted phase set to obtain the current comparison result.
[0122] Step (a4): Obtain the previous comparison result; wherein the previous comparison result is the comparison result between the previous edge phase and the predicted phase set in the previous sampling period; wherein the previous edge phase is the edge phase obtained in the previous sampling period.
[0123] Step (a5): If the current alignment result is that the predicted phase set includes one or two current edge phases, and the previous alignment result is that the predicted phase set includes the previous edge phase, then the current edge phase in the predicted phase set is used as the encoding phase of the current sampling period.
[0124] Step (a6) obtains the first number of sub-data points where the sampled data collected up to the current sampling period is continuously 0.
[0125] Step (a7): If the first quantity does not exceed the first quantity threshold, the current sampling period is in a non-frame end transmission state.
[0126] Step (a8): If the current comparison result is that the predicted phase set includes a current edge phase, the previous comparison result is that the predicted phase set does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, then the current edge phase in the predicted phase set is used as the encoding phase of the current sampling period.
[0127] Step (a9): When the number of encoded phases is one, if the current sampling period is in a non-frame end transmission state, the phases whose phase difference with the encoded phase of the current sampling period is within a preset threshold are obtained to obtain the first phase set; the predicted phase set is updated to the first phase set.
[0128] Step (a10): When there are two coded phases, if the current sampling period is in a non-frame end transmission state, the lagging phase of the two coded phases in the current sampling period is obtained to obtain the reference phase.
[0129] Step (a11): Obtain the phases whose phase difference with the reference phase is within a preset threshold to obtain the second phase set; update the predicted phase set to the second phase set.
[0130] Step (a12): In each sampling period, if the current comparison result is that the predicted phase set does not include the current edge phase, and the previous comparison result is that the predicted phase set does not include the previous edge phase, then the predicted phase set is cleared.
[0131] Step (a13): In each sampling period, if the current comparison result is that the predicted phase set includes more than three current edge phases, then the predicted phase set is cleared.
[0132] Step (a14): Obtain the second number of sub-data that are consecutively 1 up to each sampling period. If the second number exceeds the second number threshold, record the reference state as frame transmission state under the sampling period.
[0133] Step (a15): Obtain the sampling period in each sampling period where the reference state is the frame transmission state and not in the frame end state, and obtain the target sampling period.
[0134] Step (a16): In each sampling period, if the current comparison result is that the predicted phase set includes more than three current edge phases, or if the current comparison result is that the predicted phase set does not include the current edge phase and the previous comparison result is that the predicted phase set does not include the previous edge phase, or if the current sampling period is in the frame end state, then the reference state is reset.
[0135] Step (a17) is to obtain the encoded phase within the target sampling period to obtain the target phase.
[0136] Step (a18) decodes the encoded data under the target phase to obtain the decoded data for each target sampling period.
[0137] This embodiment uses Figure 6 The flowchart illustrates the specific process of decoding using the Manchester decoding method.
[0138] In step S1, the phase corresponding to the transition edge in each sampled data is detected to obtain the edge phase.
[0139] When two adjacent sub-data points in the sampled data differ, it indicates a transition in the encoded data. The phase corresponding to the transition edge can be understood as the phase of the encoded data corresponding to the transition edge within the sampled data. The encoded data corresponding to the transition edge can be determined first, and then its phase can be used as the edge phase. The phase of the encoded data can be an identifier used to index that encoded data within the sampled data. The sub-data points acquired earlier in the sampled data are considered the preceding sub-data points, and vice versa. When a transition edge occurs in the sampled data, the latter sub-data point among two adjacent sub-data points is the encoded data corresponding to the transition edge.
[0140] In step S2, the phase sk of the first rising edge is obtained, and the phase with a phase difference of phase sk within a preset threshold is predicted to be the phase of the next clock edge that may be sampled.
[0141] Since the sender continuously transmits data 0 (0101 sequence) when no connection is established, the rising edge in this case must be a clock edge. Therefore, the first rising edge in the first sampled data can be considered the clock edge, and its corresponding phase can be used as a reference phase to predict the phase of subsequent clock edges, thereby effectively improving the accuracy of clock edge determination. The preset threshold can be related to the number of clock cycles contained in the sampling period, where the clock cycle is the period of the clock signal used to sample the encoded data. For example, suppose the phase difference between adjacent phases is 1. In one embodiment, if the number of clock cycles is 8, the preset threshold can be set to 1, and the predicted phases are phase s(k-1), phase sk, and phase s(k+1); if the number of clock cycles is 16, the preset threshold can be set to 2, and the predicted phases are phase s(k-2), phase s(k-1), phase sk, phase s(k+1), and phase s(k+2), and so on.
[0142] Further, in step S3, it is determined whether the predicted phase has captured 0 transition edges in the current sampling period. If the determination result is no, step S4 is executed to further determine the number of transition edges captured in the predicted phase. If the determination result is yes, it may be that the encoded data synchronization has failed, or it may be that the speed of receiving encoded data is faster than the speed of sending encoded data, resulting in no transition edges being captured in the predicted phase in the current sampling period. At this time, step S18 is executed to further determine the prediction result in combination with the previous sampling period.
[0143] The number of edge phases falling within the predicted phase can be determined by comparing the sampled edge phase with the predicted phase. If the predicted phase includes the edge phase, it indicates that the predicted phase has sampled the edge; otherwise, it has not. The number of predicted phases sampled with the edge is equal to the number of predicted phases that include the edge phase.
[0144] In step S4, it is determined whether the predicted phase has captured one transition edge. If the determination result is yes, further determination is made based on the prediction result of the previous sampling period, and step S5 is executed at this time; if the determination result is no, step S12 is executed to further determine the number of transition edges captured by the predicted phase.
[0145] In step S5, it is determined whether the phase predicted in the previous sampling period has captured a transition edge. If the determination result is yes, it indicates that the current sampling period is in an idle state or in a frame transmission state where a data frame is being transmitted. At this time, step S6 is executed to re-predict the phase of the clock edge that may be captured in subsequent sampling periods. If the determination result is no, it indicates that the current sampling period is in a frame transmission state where the frame start flag has been sampled and a data frame has started to be transmitted, or in a state where a data frame is being transmitted, or in a state where a frame ends. At this time, step S9 is executed for further determination.
[0146] In step S6, the phase sp1 that actually captures the transition edge in the predicted phase is recorded, sk = sp1 is updated, and the phase that might capture the next clock edge is re-predicted. It can be understood that phase sp1 is the edge phase falling within the predicted phase, which is the phase of the clock edge captured in the current sampling period; when the current sampling period is in an idle state or in a frame transmission state where data frames are being transmitted, the predicted phase needs to be updated with phase sp1. Figure 3 For example, within the sampling period T1, the edge phase falling into the predicted phase is phase s7. Therefore, the previous phase sk is updated to phase s7. Furthermore, phases s0, s6, and s7, which are within 1 phase difference from phase s7, are the phases that may be sampled next.
[0147] In step S7, it is determined whether the current sampling period is in a frame transmission state. If the determination result is yes, it indicates that the current sampling period is in the first state, that is, the state when data frames are being transmitted in the frame transmission state. At this time, step S8 is executed to perform decoding. If the determination result is no, it indicates that the current sampling period is in the second state, that is, the idle state. At this time, decoding of the sampling period is not performed, and sampling continues in the next sampling period.
[0148] In step S8, the data is decoded. It can be understood that after determining the phase sp1 of the acquired clock edge, the encoded data at that phase can be inverted to obtain the decoded data for the current sampling period.
[0149] In step S9, it is determined whether the frame start flag has been sampled in the current sampling period. If the determination result is yes, it indicates that the current sampling period is in the third state, that is, in the frame transmission state when the frame start flag has been sampled and the data frame has started to be transmitted. In this state, the edge phase falling into the predicted phase is the phase sampled at the clock edge. At this time, the predicted phase needs to be updated, that is, step S10 is executed, and the sampled data is further decoded, that is, step S8 is executed. If the determination result is no, it indicates that the current sampling period is in the state of transmitting data frames or in the frame end state. At this time, step S11 is executed to further determine the state.
[0150] Specifically, the number of consecutive 1s in the sampled data up to the current sampling period can be obtained. If this number exceeds a second threshold, it indicates that a frame start flag has been captured in the current sampling period. The second threshold can be determined based on the number of clock cycles, set to be greater than 1 times the number of clock cycles in a sampling period and less than 2 times the number of clock cycles. For example, the second threshold could be 11 or 12. Obtaining the number of consecutive 1s in the sampled data up to the current sampling period can actually be the number of consecutive 1s in the sampled data of the current sampling period and the previous sampling period.
[0151] In step S10, the phase sp1 that actually captures the transition edge in the predicted phase is recorded, sk = sp1 is updated, and the phase that may capture the next clock edge is re-predicted. Here, phase sp1 is the edge phase that falls into the predicted phase, which is the phase of the clock edge captured in the current sampling period.
[0152] In step S11, it is determined whether 11-12 consecutive bits of data 0 have been sampled. If the determination result is yes, it indicates that the data frame end flag has been sampled and the frame transmission has ended. At this time, the current sampling period is in the fourth state, that is, in the frame end state. Decoding is not performed in the current sampling period, and sampling continues in the next sampling period. If the determination result is no, it indicates that the current sampling period is in the fifth state, that is, in the state of transmitting data frames, but the speed of receiving encoded data is faster than the speed of sending encoded data. At this time, step S6 is continued to be executed to update the predicted phase, and after being determined in step S7, step S8 is executed to perform data decoding.
[0153] In step S12, it is determined whether the predicted phase has captured two transition edges. If the determination result is yes, step S13 is executed to further determine the prediction result of the previous sampling period. If the determination result is no, step S14 is executed, it is determined that a Manchester violation has occurred in the current sampling period, and the encoded data synchronization has failed. Then step S15 is executed to clear the internal state and continue sampling in the next sampling period. Clearing the internal state may include clearing the predicted phase so that the phase k of the first captured transition edge can be obtained in the next sampling period, and then a new predicted phase can be obtained. In addition, when the frame start flag is determined to be captured, the current period is marked. Clearing the internal state also includes resetting the sampling period marked with the frame start flag to accurately determine the frame start flag in the next sampling period.
[0154] In step S13, determine whether the predicted phase in the previous sampling period has detected a transition edge. If the judgment result is no, execute step S14, recognize that a Manchester violation occurs in the current sampling period and the encoding data synchronization fails, then execute step S15 to clear the internal state, and continue sampling in the next sampling period. If the judgment result is yes, it is in the sixth state, i.e., the state of transmitting a data frame. However, at this time, the speed of receiving the encoded data is slower than the speed of transmitting the encoded data. At this time, execute step S17 to update the predicted phase, and then execute step S8 to decode the data after the judgment in step S17.
[0155] In step S16, record the phases sp1 and sp2 at which transition edges are actually detected in the predicted phases, where p1<p2, update sk=sp2, and re-predict the phases at which clock edges may be detected subsequently. The phases sp1 and sp2 are both edge phases falling within the predicted phases, and are the phases at which clock edges are detected in the current sampling period. The phase sp2 lags behind the phase sp1. To predict the phases at which clock edges are detected in subsequent sampling periods, phases whose phase difference from the phase sp2 is within a preset threshold can be obtained to update the predicted phases.
[0156] Taking Figure 4 as an example, the phase at which the encoded data clock edge is detected in the sampling period T4 is phase s0, and the predicted phases include phases s0, s1, and s7. When the phase at which the encoded data clock edge is detected continuously decreases to phase s0 (in the sampling period T4), and then continues to decrease, in the sampling period T5, both phases s0 and s7 in the predicted phases will detect the encoded data clock edge. At this time, update the predicted phases based on the lagging phase s7, and take phases s6, s7, and s0 with a phase difference within 1 as the new predicted phases. When proceeding to step S17, it indicates that the sender clock is faster than the receiver clock, and 2-bit data is decoded at this time.
[0157] In step S18, determine whether the predicted phase in the previous sampling period has detected a transition edge. If the judgment result is yes, it indicates that the speed of receiving the encoded data may be faster than the speed of transmitting the encoded data. At this time, the period of the sender is relatively long compared to the receiver. As time accumulates, the phase at which the clock edge is detected will continuously retreat backward, i.e., the clock edge is detected later and later. When the clock edge of the previous sampling period retreats to be detected by the rearmost phase, if the clock edge continues to retreat, the clock edge will not be detected in the current sampling period, but will be detected only after the next sampling period. Therefore, in this case, execute step S21 to make a judgment for the next sampling period. If the judgment result is no, execute step S19, recognize that a Manchester violation occurs in the current sampling period and the encoding data synchronization fails, then execute step S20 to clear the internal state, and continue sampling in the next sampling period.
[0158] In step S21, the judgment is paused in the current sampling period, and the result of the transition edge detection in the next sampling period is waited for. No data is written in the current sampling period.
[0159] It should be understood that while steps S110 to S130, S1 to S21, and (a1) to (a18) are displayed sequentially according to their numbers, they are not necessarily executed in the order indicated by the arrows or numbers. Unless explicitly stated herein, there is no strict order requirement for the execution of these steps; they can be executed in other orders. Furthermore, Figure 1 and Figure 6 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.
[0160] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A Manchester decoding method, characterized in that, The method includes: Within each sampling period, the phase corresponding to the transition edge in each sampled data is detected to obtain the edge phase; The phase of the first rising edge of the first sampled data is obtained to obtain the initial phase; the phases whose phase difference with the initial phase is within a preset threshold are used as the predicted phase set; the predicted phase set is the predicted phase corresponding to the clock edge. From the edge phases, determine the edge phases that match the predicted phase set within each sampling period to obtain the encoded phase; When the number of the encoded phases is one, if the current sampling period is in a non-frame end transmission state, the phases whose phase difference with the encoded phases of the current sampling period is within a preset threshold are obtained to obtain a first phase set; the predicted phase set is updated to the first phase set. When the number of the encoded phases is two, if the current sampling period is in the non-frame end transmission state, then the phase lagging one of the two encoded phases in the current sampling period is obtained to obtain the reference phase; the phases whose phase difference with the reference phase is within a preset threshold are obtained to obtain the second phase set; the predicted phase set is updated to the second phase set. The encoded phase within the target sampling period is obtained to obtain the target phase; the target sampling period is the sampling period in the frame transmission state; The encoded data under the target phase is decoded to obtain the decoded data for each target sampling period.
2. The Manchester decoding method according to claim 1, characterized in that, The step of determining the edge phase that matches the predicted phase set within each sampling period to obtain the encoded phase includes: Within each of the aforementioned sampling periods, the edge phase obtained in the current sampling period is acquired to obtain the current edge phase; The current edge phase is compared with the predicted phase set to obtain the current comparison result; Obtain the previous comparison result; wherein the previous comparison result is the comparison result between the previous edge phase and the predicted phase set in the previous sampling period; wherein the previous edge phase is the edge phase obtained in the previous sampling period; If the current comparison result is that the predicted phase set includes one or two current edge phases, and the previous comparison result is that the predicted phase set includes the previous edge phase, then the current edge phase in the predicted phase set is used as the encoded phase of the current sampling period.
3. The Manchester decoding method according to claim 2, characterized in that, The step of determining the edge phase that matches the predicted phase set within each sampling period to obtain the encoded phase further includes: If the current comparison result is that the predicted phase set includes a current edge phase, the previous comparison result is that the predicted phase set does not include the previous edge phase, and the current sampling period is in a non-frame end transmission state, then the current edge phase in the predicted phase set is used as the encoded phase of the current sampling period.
4. The Manchester decoding method according to claim 3, characterized in that, The method further includes: Obtain the first number of sub-data points where the sampled data collected up to the current sampling period is consecutively 0; If the first quantity does not exceed the first quantity threshold, then the current sampling period is in the non-frame end transmission state.
5. The Manchester decoding method according to claim 3, characterized in that, The method further includes: Obtain the second number of sub-data that are consecutively 1 up to each of the sampling periods. If the second number exceeds the second number threshold, record the reference state under the sampling period as the frame transmission state. The target sampling period is obtained by acquiring the sampling period in which the reference state is the frame transmission state and is not in the frame end state.
6. The Manchester decoding method according to claim 5, characterized in that, The method further includes: In each of the sampling periods, if the current comparison result is that the predicted phase set includes three or more of the current edge phases, or if the current comparison result is that the predicted phase set does not include the current edge phase and the previous comparison result is that the predicted phase set does not include the previous edge phase, or if the current sampling period is in the frame end state, then the reference state is reset.
7. The Manchester decoding method according to claim 6, characterized in that, The method further includes: In each of the sampling periods, if the current comparison result is that the predicted phase set includes more than three of the current edge phases, then the predicted phase set is cleared.
8. The Manchester decoding method according to claim 2, characterized in that, The method further includes: In each of the sampling periods, if the current comparison result is that the predicted phase set does not include the current edge phase, and the previous comparison result is that the predicted phase set does not include the previous edge phase, then the predicted phase set is cleared.
9. A Manchester decoding system, characterized in that, The system includes: The edge detection module is used to detect the phase corresponding to the transition edge in each sampled data in each sampling period to obtain the edge phase; The decoding module, connected to the edge detection module, is used for: The phase of the first rising edge of the first sampled data is obtained to obtain the initial phase; the phases whose phase difference with the initial phase is within a preset threshold are used as the predicted phase set; the predicted phase set is the predicted phase corresponding to the clock edge. From the edge phases, determine the edge phases that match the predicted phase set within each sampling period to obtain the encoded phase; When the number of encoded phases is one, if the current sampling period is in a non-frame end transmission state, the phases whose phase difference with the encoded phases of the current sampling period is within a preset threshold are obtained to obtain a first phase set; the predicted phase set is updated to the first phase set. When the number of the encoded phases is two, if the current sampling period is in the non-frame end transmission state, then the phase lagging one of the two encoded phases in the current sampling period is obtained to obtain the reference phase; the phases whose phase difference with the reference phase is within a preset threshold are obtained to obtain the second phase set; the predicted phase set is updated to the second phase set. The encoded phase within the target sampling period is obtained to obtain the target phase; the target sampling period is the sampling period in the frame transmission state; The encoded data under the target phase is decoded to obtain the decoded data for each target sampling period.
Citation Information
Patent Citations
Manchester encoding and decoding method
CN109217875A
Signal processing method and device, electronic equipment and storage medium
CN114205054A
Data valid detector circuit for Manchester encoded data
US5170396A
Circuit and method for Manchester decoding with automatic leading phase discovery and data stream correction
US7633414B1
