Manchester decoding method and apparatus and battery management system applying the same
By extracting the reference pulse width of the Manchester code from the battery management system, comparing the pulse width of the data code with the reference pulse width, and determining the logical inversion, the problem of high bit error rate of Manchester code in long-distance communication is solved, and efficient and low-cost decoding is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING SILERGY SEMICON TECH CO LTD
- Filing Date
- 2022-09-08
- Publication Date
- 2026-07-10
AI Technical Summary
In battery management systems, the signal amplitude attenuation and non-sharp edges caused by long-distance communication at the Manchester encoding receiver result in a high bit error rate for traditional Manchester decoding methods.
By extracting the reference pulse width from the Manchester code, comparing the pulse width of the data code with the reference pulse width, and determining the logical inversion, decoding is achieved. This avoids relying on the absolute precision of the clock and utilizes the pulse width variation characteristics for decoding.
Under long-distance isolated communication conditions, it reduces the bit error rate, saves costs, and improves the flexibility and accuracy of decoding.
Smart Images

Figure CN116318528B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communications, and more specifically, to a Manchester decoding method and apparatus, and a battery management system using the same. Background Technology
[0002] Manchester encoding is a synchronous clock encoding technique that represents "0" or "1" through high-low level transitions. Each bit has a transition that serves as both a clock signal and a data signal. Specifically, the Manchester encoding of "0" involves a low-level to high-level transition, and the Manchester encoding of "1" involves a high-level to low-level transition. Because it transmits synchronous clock signals and contains no DC component, Manchester encoding offers excellent anti-interference capabilities and is widely used in battery management systems.
[0003] Traditional Manchester decoding methods rely on the transition times of the encoding clock and the transition times and patterns within the symbols, based on the Manchester encoding. This means they depend on accurate level transition timing. However, when Manchester encoding is transmitted within a battery management system, the impedance changes along the transmission path due to long-distance communication cause amplitude attenuation of the received signal and less steep transition edges. This leads to ambiguity in the Manchester encoding's level transition times, resulting in a higher bit error rate when using traditional Manchester decoding. Summary of the Invention
[0004] In view of this, the present invention proposes a Manchester decoding method and apparatus, as well as a battery management system using the same, to solve the technical problem in the prior art where the bit error rate is high when the amplitude of the received signal at the receiving end is attenuated and the transition edge is not steep.
[0005] In a first aspect, embodiments of the present invention provide a Manchester decoding method, comprising the following steps: obtaining a reference pulse width based on the synchronization code in the Manchester encoding, wherein the reference pulse width is used to characterize the width between adjacent rising and falling edges or adjacent falling and rising edges in the Manchester encoding of 0 or 1; obtaining each first pulse width and each second pulse width based on the data code in the Manchester encoding, wherein the first pulse width is used to characterize the width between adjacent rising and falling edges in the data code, and the second pulse width is used to characterize the width between adjacent falling and rising edges in the data code; comparing both the first pulse width and the second pulse width with the reference pulse width, and when the first pulse width or the second pulse width is greater than the reference pulse width, determining that the logic of two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code.
[0006] In one embodiment, the first N symbols in the Manchester encoding are set to a synchronization code with the same logic, and the subsequent symbols are data codes. The synchronization code is set to Manchester encoding of 0 or 1, and the data code is the Manchester encoding of the data to be transmitted, where N is greater than zero.
[0007] In one embodiment, each third pulse width and each fourth pulse width are obtained according to the synchronization code in the Manchester code; the third pulse width and the fourth pulse width are averaged to obtain the reference pulse width; wherein the third pulse width is used to characterize the width between adjacent rising and falling edges in the synchronization code, and the fourth pulse width is used to characterize the width between adjacent falling and rising edges in the synchronization code.
[0008] In one embodiment, the Manchester code is compared with a first threshold and a second threshold to obtain a first comparison signal and a second comparison signal; the width between adjacent rising and falling edges corresponding to the synchronization code portion in the first comparison signal and the second comparison signal is extracted to generate the reference pulse width; the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal and the second comparison signal is extracted to obtain each first pulse width and each second pulse width; the data code is decoded according to the first pulse width, the second pulse width and the reference pulse width; wherein the first pulse width is configured as the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal, and the second pulse width is configured as the width between adjacent rising and falling edges corresponding to the data code portion in the second comparison signal.
[0009] In one embodiment, the widths between adjacent rising and falling edges corresponding to the synchronization code portion in the first comparison signal and the second comparison signal are extracted to obtain respective third pulse widths and respective fourth pulse widths; the third pulse widths and the fourth pulse widths are averaged to obtain the reference pulse width; wherein the third pulse width is configured as the width between adjacent rising and falling edges corresponding to the synchronization code portion in the first comparison signal, and the fourth pulse width is configured as the width between adjacent rising and falling edges corresponding to the synchronization code portion in the second comparison signal.
[0010] In one embodiment, each of the first pulse widths and each of the second pulse widths are alternately compared with the reference pulse width to obtain a first sequence; based on the first sequence, it is determined whether the logic of the current symbol is reversed compared with the logic of the previous symbol, thereby realizing decoding; wherein, each element in the first sequence is used to characterize the first pulse width and the second pulse width of the corresponding symbol in Manchester encoding.
[0011] In one embodiment, when the first pulse width or the second pulse width is greater than the reference pulse width, the first pulse width or the second pulse width is marked as 2T; when the first pulse width or the second pulse width is less than or equal to the reference pulse width, the first pulse width or the second pulse width is marked as T, so as to obtain the first sequence of alternating 2T and T.
[0012] In one embodiment, 2T in the first sequence is marked as 2R, and T is marked as H, to obtain a second sequence with H and R alternating; the elements in the second sequence are used to judge the logic of the code elements in all data codes in turn, wherein each element in the second sequence is judged only once.
[0013] In one embodiment, taking the logic of the code element in the synchronization code as a reference, when two adjacent elements in the second sequence are RR or RH, it is determined that the logic of the current code element has been reversed compared to the logic of the previous code element; when two adjacent elements in the second sequence are HR or HH, it is determined that the logic of the current code element is the same as the logic of the previous code element.
[0014] In one embodiment, when the Manchester code is greater than the first threshold, the first comparison signal is high; otherwise, the first comparison signal is low. When the Manchester code is less than the second threshold, the second comparison signal is high; otherwise, the second comparison signal is low.
[0015] Secondly, embodiments of the present invention provide a Manchester decoding apparatus, comprising: a comparison module configured to compare an input Manchester code with a first threshold and a second threshold respectively to obtain a first comparison signal and a second comparison signal; and a sampling and counting module configured to perform high-frequency sampling on the first comparison signal and the second comparison signal, extracting the width between adjacent rising and falling edges corresponding to the synchronization code portion of the Manchester code in the first comparison signal and the second comparison signal for generating a reference pulse width; and extracting the width between adjacent rising and falling edges corresponding to the data code portion of the Manchester code in the first comparison signal and the second comparison signal. The width between edges is used to obtain respective first pulse widths and respective second pulse widths; the decoding module is configured to decode the data code in the Manchester code according to the first pulse width, the second pulse width and the reference pulse width; wherein, the reference pulse width is used to characterize the width between adjacent rising and falling edges or adjacent falling and rising edges in the Manchester code of 0 or 1, the first pulse width is configured to characterize the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal, and the second pulse width is configured to characterize the width between adjacent rising and falling edges corresponding to the data code portion in the second comparison signal.
[0016] In one embodiment, the decoding module is configured to: compare both the first pulse width and the second pulse width with the reference pulse width; and when the first pulse width or the second pulse width is greater than the reference pulse width, determine that the logic of two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code.
[0017] In one embodiment, the sampling and counting module includes: a sampling module for high-frequency sampling of the first comparison signal and the second comparison signal using a high-frequency sampling clock; a first counter and a second counter for counting the sampled values of the first comparison signal and the second comparison signal, respectively; wherein the first counter and the second counter count the sampled values corresponding to the synchronization code portion in the first comparison signal and the second comparator, respectively, to generate a reference pulse width; the first counter and the second counter count the sampled values corresponding to the data code portion in the first comparison signal and the second comparator, respectively, to obtain each first pulse width and each second pulse width; the first pulse width is configured as the value of the first counter corresponding to the data code, and the second pulse width is configured as the value of the second counter corresponding to the data code.
[0018] In one embodiment, the Manchester decoding device further includes a reference pulse width generation module configured to average each third pulse width and each fourth pulse width to obtain the reference pulse width; wherein the third pulse width is configured as the value of a first counter corresponding to the synchronization code, and the fourth pulse width is configured as the value of a second counter corresponding to the synchronization code.
[0019] In one embodiment, the first counter is configured to increment by 1 when the first comparison signal is sampled as high, and to reset to zero when the first comparison signal is sampled as low; the second counter is configured to increment by 1 when the second comparison signal is sampled as high, and to reset to zero when the second comparison signal is sampled as low.
[0020] In one embodiment, the decoding module includes: a first judgment marker module configured to compare each of the first pulse widths and each of the second pulse widths output by the sampling counting module with the reference pulse width to obtain a first sequence; and a second judgment marker module configured to determine, based on the first sequence, whether the logic of the current symbol has been reversed compared to the logic of the previous symbol, thereby achieving decoding; wherein each element in the first sequence is used to characterize the first pulse width and the second pulse width of the corresponding symbol in Manchester encoding.
[0021] In one embodiment, the first determination marking module is configured to: mark the first pulse width or the second pulse width as 2T when the first pulse width or the second pulse width is greater than the reference pulse width; and mark the first pulse width or the second pulse width as T when the first pulse width or the second pulse width is less than or equal to the reference pulse width, so as to obtain the first sequence of alternating 2T and T.
[0022] In one embodiment, the second judgment marking module is configured to: mark 2T in the first sequence as 2 R, and mark T as H, to obtain a second sequence of H and R alternating; and judge the logic of the code elements in all data codes in turn according to the elements in the second sequence, wherein each element in the second sequence is judged only once by logic inversion.
[0023] In one embodiment, the second judgment marking module is configured to: using the code element logic of the synchronization code as a reference, when two adjacent elements in the second sequence are RR and RH, it is determined that the logic of the current code element has been reversed compared to the logic of the previous code element; when two adjacent elements in the second sequence are HR and HH, it is determined that the logic of the current code element is the same as the logic of the previous code element.
[0024] In one embodiment, the first N symbols in the Manchester encoding are set to a synchronization code with the same logic, and the subsequent symbols are data codes. The synchronization code is set to Manchester encoding of 0 or 1, and the data code is the Manchester encoding of the data to be transmitted, where N is greater than zero.
[0025] In one embodiment, the frequency of the high-frequency sampling clock is 16 times the transmission rate of the Manchester encoding.
[0026] Thirdly, embodiments of the present invention provide a battery management system, including multiple chips and a host computer, configured to communicate with each other using an isolated daisy chain.
[0027] Each chip and host computer includes: a transmitter for sending Manchester encoding to the lower-level chip or host computer; and a receiver for receiving the Manchester encoding sent by the upper-level chip or host computer and decoding the Manchester encoding using any of the above Manchester decoding methods.
[0028] Compared with the prior art, the technical solution of the present invention has the following advantages: The Manchester decoding method of the present invention includes obtaining a reference pulse width based on the synchronization code in the Manchester encoding, wherein the reference pulse width is used to characterize the width between adjacent rising and falling edges or adjacent falling and rising edges in the Manchester encoding of 0 or 1; obtaining each first pulse width and each second pulse width based on the data code in the Manchester encoding, wherein the first pulse width is used to characterize the width between adjacent rising and falling edges in the data code, and the second pulse width is used to characterize the width between adjacent falling and rising edges in the data code; comparing both the first pulse width and the second pulse width with the reference pulse width, and when the first pulse width or the second pulse width is greater than the reference pulse width, determining that the logic of the two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code. This invention utilizes the characteristic of Manchester encoding that a significant change in pulse width will occur if adjacent code elements undergo logical inversion. It extracts the pulse width of the initial synchronization code received at the receiving end to obtain a reference pulse width for subsequent data codes. Then, it sequentially extracts the pulse widths of subsequent data codes and compares them with the reference pulse width. The determination of whether a significant change occurs in the pulse width of a subsequent data code compared to the reference pulse width indicates whether the logic of adjacent code elements corresponding to that data code's pulse width has been inverted, thus achieving decoding. The pulse widths of both the synchronization code and the data codes include the width between adjacent rising and falling edges and the width of adjacent rising and falling edges. The Manchester decoding method in this invention does not rely on absolute clock precision, thus eliminating the need for high-precision clocks and saving costs. Furthermore, in long-distance isolated communication applications, it can effectively handle pulse width distortion of the received signal with a low bit error rate and flexible application scenarios. Attached Figure Description
[0029] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which:
[0030] Figure 1 This is a schematic diagram illustrating the principle of the Manchester decoding method of the present invention;
[0031] Figure 2 This is a flowchart of an embodiment of the Manchester decoding method of the present invention;
[0032] Figure 3 This is a schematic diagram of a first embodiment of the Manchester decoding device of the present invention;
[0033] Figure 4 This is a waveform diagram of the operation of the Manchester decoding device according to Embodiment 1 of the present invention;
[0034] Figure 5Flowchart of Embodiment 2 of the Manchester decoding method of the present invention;
[0035] Figure 6 This is a schematic diagram of an embodiment of the battery management system of the present invention. Detailed Implementation
[0036] The present invention is described below based on embodiments, but the invention is not limited to these embodiments. In the detailed description of the invention below, certain specific details are described in detail. Those skilled in the art will fully understand the invention even without these details. To avoid obscuring the essence of the invention, well-known methods, processes, flows, elements, and circuits are not described in detail.
[0037] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.
[0038] Furthermore, it should be understood that in the following description, "circuit" refers to a conductive loop consisting of at least one element or sub-circuit connected by electrical or electromagnetic connections. When an element or circuit is said to be "connected" to another element or "connected" between two nodes, it can be directly coupled or connected to another element, or there may be intermediate elements. The connection between elements can be physical, logical, or a combination thereof. Conversely, when an element is said to be "directly coupled to" or "directly connected" to another element, it means that there are no intermediate elements between them.
[0039] Unless the context explicitly requires it, the words "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than being exclusive or exhaustive; that is, meaning "including but not limited to."
[0040] In the description of this invention, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0041] Figure 1 This is a schematic diagram illustrating the principle of the Manchester decoding method of this invention. Where clock is the encoded clock signal, Data is the data to be transmitted, and VM is the Manchester encoding of the data. Figure 1As shown, when two adjacent data points (Data) are the same data (both 0 or 1), the width between adjacent falling and rising edges, and the width between adjacent rising and falling edges in Manchester encoding, are M. When Data changes from 1 to 0, the width between the corresponding falling and rising edges in Manchester encoding becomes 2M. When Data changes from 0 to 1, the width between the corresponding rising and falling edges in Manchester encoding also becomes 2M. Therefore, it can be seen that when the width between adjacent falling and rising edges, or between rising and falling edges, changes significantly in Manchester encoding, the logic of the corresponding two adjacent code points is reversed. It should be noted that the logic reversal of adjacent code points here refers to the logic of one code point changing from high to low (representing data 1) in Manchester encoding, and the logic of the other code point changing from low to high (representing data 0).
[0042] By utilizing the characteristic of Manchester encoding that a significant change in pulse width will occur if adjacent symbols undergo logical reversal, where the pulse width includes the width between adjacent rising and falling edges, as well as the width of the adjacent rising and falling edges, the Manchester decoding method of this invention is obtained. This Manchester decoding method of this invention does not require obtaining the clock transition time and the transition time and mode in the middle of the symbol; it can perform decoding using only the pulse width, simplifying the decoding process and thus having a significant advantage.
[0043] Figure 2 This is a flowchart of an embodiment of the Manchester decoding method of the present invention; the Manchester decoding method includes the following steps:
[0044] 01. Obtain a reference pulse width based on the synchronization code in the Manchester encoding. The reference pulse width is used to characterize the width between adjacent rising and falling edges or adjacent falling and rising edges in the Manchester encoding of 0 or 1.
[0045] 02. Obtain each first pulse width and each second pulse width according to the data code in the Manchester encoding. The first pulse width is used to characterize the width between adjacent rising edges and falling edges in the data code, and the second pulse width is used to characterize the width between adjacent falling edges and rising edges in the data code.
[0046] 03. Compare both the first pulse width and the second pulse width with the reference pulse width. When the first pulse width or the second pulse width is greater than the reference pulse width, determine that the logic of the two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code. In a preferred embodiment, both the first pulse width and the second pulse width are compared with a third threshold. When the first pulse width or the second pulse width is greater than the third threshold, determine that the logic of the two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code. The third threshold is configured as a first coefficient multiplied by the reference pulse width. The first coefficient is greater than 1 and less than 2. Preferably, the first coefficient is 1.33, but the present invention does not limit this.
[0047] Furthermore, each third pulse width and each fourth pulse width are obtained according to the synchronization code in the Manchester encoding; the third pulse width and the fourth pulse width are averaged to obtain the reference pulse width; wherein, the third pulse width is used to characterize the width between adjacent rising and falling edges in the synchronization code, and the fourth pulse width is used to characterize the width between adjacent falling and rising edges in the synchronization code.
[0048] In this invention, the first N code elements of the Manchester encoding are synchronization codes, which are set to the same logic. The subsequent code elements are data codes. The synchronization code code elements are set to Manchester encoding of 0 or 1, and the data code is the Manchester encoding of the data to be transmitted. N is greater than zero. It should be noted that this invention does not limit the number of synchronization code code elements N; more synchronization codes are more conducive to obtaining a stable reference pulse width through averaging. Furthermore, this invention does not limit the logic of the synchronization codes; they can all transition from high to low (representing data 1) or all transition from low to high (representing data 0).
[0049] There are many ways to implement the Manchester decoding method described above. This invention provides a preferred embodiment, such as... Figure 3 The diagram shown is a schematic representation of a first embodiment of the Manchester decoding device of the present invention. Figure 4 This is a waveform diagram of the operation of the Manchester decoding device according to Embodiment 1 of the present invention. The following is in conjunction with... Figure 3 and Figure 4 The Manchester decoding process of this invention is described.
[0050] In this embodiment, the Manchester decoding device includes a comparison module 1, a sampling counting module 2, and a decoding module 3.
[0051] The comparison module 1 is configured to compare the input Manchester code VM with a first threshold Vp and a second threshold Vn respectively to obtain a first comparison signal Cp and a second comparison signal Cn. The first comparison threshold Vp is positive, and the second comparison threshold Vn is negative; optionally, the absolute values of the first comparison threshold Vp and the second comparison threshold Vn are equal. In a preferred embodiment, the absolute values of the first comparison threshold Vp and the second comparison threshold Vn are equal to one-third of the amplitude of the signal transmitted by the transmitting end. Specifically, in this embodiment, as... Figure 4 As shown, when the Manchester encoding VM is greater than the first threshold Vp, the first comparison signal Cp is high; otherwise, the first comparison signal Cp is low. When the Manchester encoding VM is less than the second threshold Vn, the second comparison signal Cn is high; otherwise, the second comparison signal Cn is low. This invention does not impose any restrictions on this. By comparing the Manchester encoding VM with the first threshold Vp and the second threshold Vn respectively, a first comparison signal Cp and a second comparison signal Cn with clear level transition times are obtained, solving the technical problem of ambiguous level transition times in the Manchester encoded signal received by the receiving end. Subsequently, the width between adjacent rising and falling edges in the first comparison signal Cp represents the width between adjacent rising and falling edges in the Manchester encoding VM, and the width between adjacent rising and falling edges in the second comparison signal Cn represents the width between adjacent falling and rising edges in the Manchester encoding VM.
[0052] The sampling counting module 2 is configured to perform high-frequency sampling on the first comparison signal Cp and the second comparison signal Cn using a high-frequency sampling clock, extract the width between adjacent rising and falling edges corresponding to the synchronization code portion of the first comparison signal Cp and the second comparison signal Cn to generate a reference pulse width; and extract the width between adjacent rising and falling edges corresponding to the data code portion of the first comparison signal Cp and the second comparison signal Cn to obtain each first pulse width and each second pulse width; wherein the first pulse width is configured to characterize the width between adjacent rising and falling edges corresponding to the data code portion of the first comparison signal, and the second pulse width is configured to characterize the width between adjacent rising and falling edges corresponding to the data code portion of the second comparison signal.
[0053] The decoding module 3 is configured to decode the data code in the Manchester encoding based on the first pulse width, the second pulse width, and the reference pulse width. Specifically, both the first pulse width and the second pulse width are compared with the reference pulse width. When the first pulse width or the second pulse width is greater than the reference pulse width, it is determined that the logic of the two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code. In this embodiment, the decoding module includes a first judgment mark module and a second judgment mark module (not shown in the figure). The first judgment mark module is configured to compare each of the first pulse widths and each of the second pulse widths output by the sampling counting module with the reference pulse width to obtain a first sequence. The second judgment mark module is configured to determine whether the logic of the current code element is reversed compared with the logic of the previous code element based on the first sequence, thereby realizing decoding. Each element in the first sequence is used to represent the first pulse width and the second pulse width of the corresponding code element in the Manchester encoding.
[0054] In this embodiment, the sampling and counting module 2 includes a sampling module 21, a first counter CT1, and a second counter CT2. The sampling module 21 uses a high-frequency sampling clock to sample the first comparison signal Cp and the second comparison signal Cn at high frequency. The first counter CT1 and the second counter CT2 count the sampled values of the first comparison signal and the second comparison signal, respectively. Specifically, in this embodiment, the first counter CT1 is configured to increment by 1 when the first comparison signal Cp is sampled as high, and to reset to zero when the first comparison signal Cp is sampled as low. The second counter CT2 is configured to increment by 1 when the second comparison signal Cn is sampled as high, and to reset to zero when the second comparison signal Cn is sampled as low. Specifically, the first counter and the second counter count the sampled values corresponding to the synchronization code portion in the first comparison signal and the second comparator, respectively, to generate a reference pulse width; the first counter and the second counter count the sampled values corresponding to the data code portion in the first comparison signal and the second comparator, respectively, to obtain each first pulse width and each second pulse width; the first pulse width is configured as the value of the first counter corresponding to the data code, and the second pulse width is configured as the value of the second counter corresponding to the data code.
[0055] Furthermore, the Manchester decoding device also includes a reference pulse width generation module 4, which is configured to average each third pulse width and each fourth pulse width to obtain the reference pulse width Tbit for transmission to the decoding module 3; wherein the third pulse width is configured as the value of the first counter corresponding to the synchronization code, and the fourth pulse width is configured as the value of the second counter corresponding to the synchronization code.
[0056] In this embodiment, a first switch S1 is also included. When the first counter and the second counter count the first comparison signal and the second comparison signal corresponding to the synchronization code, respectively, the first switch S1 is closed to port 02 to send the count value to the reference pulse width generation module 4 to generate the reference pulse width Tbit. When the first counter and the second counter count the first comparison signal and the second comparison signal corresponding to the digital code, respectively, the first switch S1 is closed to port 01 to send the count value to the decoding module 3 for decoding. Optionally, the first switch S1 is controlled according to the reference pulse width signal Tbit. The initial value of the reference pulse width signal Tbit is set to 0. When the reference pulse width signal Tbit is zero, the first switch S1 is closed to port 02. When the reference pulse width signal Tbit is refreshed, that is, when it is non-zero, the first switch S1 is closed to port 01.
[0057] In this embodiment, the Manchester decoding device further includes a high-frequency sampling clock generation unit 5, used to generate a high-frequency sampling clock to simultaneously sample the first comparison signal Cp and the second comparison signal Cn at high frequency. The frequency of the high-frequency sampling clock is 16 times the data transmission rate, which is also 16 times the transmission rate of Manchester encoding. It should be noted that, theoretically, the higher the sampling frequency, the better the resolution, but a higher sampling frequency will cause greater power consumption. Therefore, 16 times is a relatively reasonable value, but this invention does not impose any limitation on it.
[0058] The first N code elements in the Manchester encoding are set as synchronization codes with the same logic, and the subsequent code elements are data codes. The synchronization codes are set to 0 or 1 in Manchester encoding, and the data codes are the Manchester encoding of the data to be transmitted, where N is greater than zero. In this embodiment, as... Figure 4 As shown, the first two code elements S0 and S1 in the Manchester encoding are set as synchronization codes. These synchronization codes are set by the transmitting end during encoding. Before transmitting the data code composed of code elements D0, D1, D2…D5, the transmitting end sends the synchronization codes S0 and S1 before the data code for reference during decoding. In this embodiment, the synchronization codes S0 and S1 are set to the same code element logic, i.e., a change from low level to high level (representing data 0).
[0059] By counting the widths between the rising and falling edges of the first comparison signal Cp and the second comparison signal Cn corresponding to synchronization codes S0 and S1, respectively, the following results are obtained: Figure 4 The third pulse width B, fourth pulse width A, and fourth pulse width C shown are averaged to obtain the reference pulse width Tbit. The reference pulse width Tbit is the average of the third pulse width B, fourth pulse width A, and fourth pulse width C, i.e., Tbit = (A + B + C) / 3. In this embodiment, the third pulse width is configured as the value of the first counter corresponding to the synchronization code, and the fourth pulse width is configured as the value of the second counter corresponding to the synchronization code. When the synchronization code has N symbols, the sum of the number of the third pulse width and the number of the fourth pulse width is 2N-1.
[0060] Before the reference pulse width Tbit is obtained, the reference pulse width Tbit is zero (in Figure 4 The reference pulse width Tbit is obtained by displaying a low level in the middle, and the reference pulse width Tbit is refreshed (in the middle). Figure 4 (This is represented by a high level) to begin decoding the data code.
[0061] After obtaining the reference pulse width Tbit, the high-frequency sampling clock continues to count the width between the rising and falling edges of the first comparison signal Cp and the second comparison signal Cn corresponding to the data codes D0, D1, D2... By counting the width between the rising and falling edges of the first comparison signal and the second comparison signal of the data code, each first pulse width and each second pulse width are obtained; the first pulse width is configured as the value of the first counter corresponding to the data code, and the second pulse width is configured as the value of the second counter corresponding to the data code.
[0062] For each obtained first or second pulse width, the first or second pulse width is compared with the reference pulse width Tbit. If the first or second pulse width is greater than the reference pulse width Tbit, the first or second pulse width is marked as 2T; if the first or second pulse width is less than or equal to the reference pulse width Tbit, the first or second pulse width is marked as T. Sequential sampling is performed to obtain alternating 2T and T pulse widths. Figure 4The first sequence. In a preferred embodiment, the first pulse width and the second pulse width are compared with a third threshold to obtain the first sequence. Specifically, the first pulse width or the second pulse width is compared with the third threshold. If the first pulse width or the second pulse width is greater than the third threshold, the first pulse width or the second pulse width is marked as 2T; if the first pulse width or the second pulse width is less than or equal to the third threshold, the first pulse width or the second pulse width is marked as T. The third threshold is configured as a first coefficient multiplied by the reference pulse width Tbit, wherein the first coefficient is greater than 1 and less than 2, preferably 1.33, but the present invention does not limit this.
[0063] The first sequence is further processed by marking 2T as 2R and T as H. By sequentially judging, a second sequence of alternating H and R can be obtained. The logic of the code elements in all data codes is judged according to the elements in the second sequence. Each element in the second sequence is judged only once.
[0064] Specifically, taking the code element logic (data 0) of the synchronization code as a reference, when two adjacent elements in the second sequence are RR and RH, it is determined that the logic of the current code element has been reversed compared to the logic of the previous code element; when two adjacent elements in the second sequence are HR and HH, it is determined that the logic of the current code element is the same as the logic of the previous code element, so as to obtain... Figure 4 The data shown. In this embodiment, the synchronization codes S0 and S1 change from low level to high level (i.e., representing data 0). Therefore, the logic of the first RH character D0 is reversed compared to the logic of character S1, resulting in the logic of D0 changing from high level to low level (i.e., representing data 1). The logic of all data code characters and the represented data are obtained sequentially, thereby achieving decoding. Specifically, the first element in the second sequence is discarded, and the judgment begins from the second element, such as... Figure 4 In the code, the second and third elements are RH respectively. Then the logic of code element D0 and the logic of synchronization code S1 are reversed. If code element S1 is data 0, then code element D0 is data 1. Similarly, D1 to D5 are obtained as 1, 0, 1, 1, 0 respectively.
[0065] Figure 5 A flowchart of Embodiment 2 of the Manchester decoding method of the present invention; the Manchester decoding method includes:
[0066] 01. The Manchester code is compared with the first threshold and the second threshold respectively to obtain the first comparison signal and the second comparison signal;
[0067] 02. Extract the width between adjacent rising and falling edges corresponding to the synchronization code portion in the first comparison signal and the second comparison signal to generate the reference pulse width;
[0068] 03. Extract the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal and the second comparison signal to obtain each first pulse width and each second pulse width;
[0069] 04. Decode the data code according to the first pulse width, the second pulse width, and the reference pulse width;
[0070] Wherein, the first pulse width is configured as the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal, and the second pulse width is configured as the width between adjacent rising and falling edges corresponding to the data code portion in the second comparison signal.
[0071] The specific Manchester decoding method is similar to the decoding method in Embodiment 1 of the Manchester decoding device, and will not be described in detail here.
[0072] Figure 6 This is a schematic diagram of an embodiment of the battery management system of the present invention; the battery management system includes multiple chips 1 to N and a host computer, the host computer includes a main unit and a transceiver, and the main unit and the multiple chips 1 to N communicate through the transceiver. In another embodiment, the main unit has its own transceiver, so no additional transceiver is required, which is hereby described.
[0073] In this embodiment, the transceiver and the plurality of chips are configured to communicate with each other using an isolated daisy chain, wherein the isolation can be transformer isolation or capacitor isolation.
[0074] In this embodiment, the daisy chain uses dual-wire harnesses to transmit differential signals, which improves the ability to suppress common-mode noise, but the present invention does not limit this.
[0075] Furthermore, each chip and host computer includes a transmitter and a receiver. The transmitter is used to send Manchester encoding to the lower-level chip or host computer; the receiver is used to receive the Manchester encoding sent by the host chip or host computer, and each chip and host computer is equipped with... Figure 3 The Manchester decoding device shown is used to, upon receiving Manchester encoding, utilize... Figure 2 or Figure 5The Manchester decoding method shown decodes the Manchester code to obtain the transmitted data information. Manchester encoding is a bipolar return-to-zero code; the effective signal does not contain a DC component, satisfying the "volt-second balance" requirement provided by the transformer's inductance and capacitance as isolation devices. It should be noted that the "upper-level chip" here refers to the chip that transmits the signal, and the "lower-level chip" refers to the chip that receives the signal.
[0076] Although the embodiments are described and illustrated separately above, some common technologies are involved. Those skilled in the art can replace and integrate them between the embodiments. If there is any content not explicitly described in one embodiment, then another embodiment that is described can be referred to.
[0077] As described above, these embodiments of the present invention do not exhaustively cover all details, nor do they limit the invention to the specific embodiments described. Clearly, many modifications and variations can be made based on the above description. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to effectively utilize the invention and its modifications. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A Manchester decoding method, characterized in that, Includes the following steps: The reference pulse width is obtained based on the synchronization code in the Manchester encoding. The reference pulse width is used to characterize the width between adjacent rising and falling edges or between adjacent falling and rising edges in the Manchester encoding of 0 or 1. Each first pulse width and each second pulse width are obtained according to the data code in the Manchester encoding. The first pulse width is used to characterize the width between adjacent rising and falling edges in the data code, and the second pulse width is used to characterize the width between adjacent falling and rising edges in the data code. Both the first pulse width and the second pulse width are compared with the reference pulse width. When the first pulse width or the second pulse width is greater than the reference pulse width, it is determined that the logic of the two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code.
2. The Manchester decoding method according to claim 1, characterized in that: In the Manchester encoding, the first N code elements are set as synchronization codes with the same logic, and the subsequent code elements are data codes. The synchronization code is set to Manchester encoding of 0 or 1, the data code is Manchester encoding of the data to be transmitted, and N is greater than zero.
3. The Manchester decoding method according to claim 1, characterized in that: The third pulse width and the fourth pulse width are obtained according to the synchronization code in the Manchester encoding. The reference pulse width is obtained by averaging the third pulse width and the fourth pulse width. The third pulse width is used to characterize the width between adjacent rising and falling edges in the synchronization code, and the fourth pulse width is used to characterize the width between adjacent falling and rising edges in the synchronization code.
4. The Manchester decoding method according to claim 1, characterized in that: The Manchester code is compared with a first threshold and a second threshold respectively to obtain a first comparison signal and a second comparison signal; The width between adjacent rising and falling edges corresponding to the synchronization code portion in the first comparison signal and the second comparison signal is extracted to generate the reference pulse width; Extract the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal and the second comparison signal to obtain each first pulse width and each second pulse width; The data code is decoded based on the first pulse width, the second pulse width, and the reference pulse width; Wherein, the first pulse width is configured as the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal, and the second pulse width is configured as the width between adjacent falling and rising edges corresponding to the data code portion in the second comparison signal.
5. The Manchester decoding method according to claim 4, characterized in that: Extract the width between adjacent rising and falling edges corresponding to the synchronization code portion in the first comparison signal and the second comparison signal to obtain each third pulse width and each fourth pulse width; The reference pulse width is obtained by averaging the third pulse width and the fourth pulse width. The third pulse width is configured as the width between adjacent rising and falling edges of the first comparison signal corresponding to the synchronization code portion, and the fourth pulse width is configured as the width between adjacent rising and falling edges of the second comparison signal corresponding to the synchronization code portion.
6. The Manchester decoding method according to claim 4, characterized in that: Each of the first pulse widths and each of the second pulse widths are alternately compared with the reference pulse width to obtain a first sequence; Based on the first sequence, determine whether the logic of the current code element is reversed compared to the logic of the previous code element, thereby achieving decoding; Each element in the first sequence is used to characterize the first pulse width and the second pulse width of the corresponding symbol in Manchester coding.
7. The Manchester decoding method according to claim 6, characterized in that: When the first pulse width or the second pulse width is greater than the reference pulse width, the first pulse width or the second pulse width is marked as 2T; When the first pulse width or the second pulse width is less than or equal to the reference pulse width, the first pulse width or the second pulse width is marked as T to obtain the first sequence of alternating 2T and T.
8. The Manchester decoding method according to claim 7, characterized in that: Label the 2T in the first sequence as 2R, and label the T as H, to obtain a second sequence with alternating H and R; The logic of the code elements in all data codes is judged sequentially based on the elements in the second sequence, wherein each element in the second sequence is judged only once.
9. The Manchester decoding method according to claim 8, characterized in that: Taking the logic of the code elements in the synchronization code as a reference, When two adjacent elements in the second sequence are RR or RH, it is determined that the logic of the current symbol has been reversed compared to the logic of the previous symbol. When two adjacent elements in the second sequence are HR or HH, the logic of the current code element is determined to be the same as that of the previous code element.
10. The Manchester decoding method according to claim 4, characterized in that: When the Manchester code is greater than the first threshold, the first comparison signal is high; otherwise, the first comparison signal is low. When the Manchester code is less than the second threshold, the second comparison signal is high; otherwise, the second comparison signal is low.
11. A Manchester decoding device, characterized in that, include: The comparison module is configured to compare the input Manchester code with a first threshold and a second threshold respectively to obtain a first comparison signal and a second comparison signal; The sampling and counting module is configured to perform high-frequency sampling on the first comparison signal and the second comparison signal, extract the width between adjacent rising and falling edges corresponding to the synchronization code portion in the first comparison signal and the second comparison signal to generate a reference pulse width; and extract the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal and the second comparison signal to obtain each first pulse width and each second pulse width. The decoding module is configured to decode the data code in the Manchester encoding according to the first pulse width, the second pulse width and the reference pulse width; The reference pulse width is used to characterize the width between adjacent rising and falling edges or adjacent falling and rising edges in Manchester encoding of 0 or 1. The first pulse width is configured to characterize the width between adjacent rising and falling edges corresponding to the data code portion in the first comparison signal. The second pulse width is configured to characterize the width between adjacent rising and falling edges corresponding to the data code portion in the second comparison signal.
12. The Manchester decoding device according to claim 11, characterized in that: The decoding module is configured as follows: Both the first pulse width and the second pulse width are compared with the reference pulse width. When the first pulse width or the second pulse width is greater than the reference pulse width, it is determined that the logic of the two adjacent code elements corresponding to the first pulse width or the second pulse width is different, so as to decode the data code.
13. The Manchester decoding device according to claim 11, characterized in that: The sampling and counting module includes: The sampling module uses a high-frequency sampling clock to sample the first comparison signal and the second comparison signal at high frequency; The first counter and the second counter count the sampled values of the first comparison signal and the second comparison signal, respectively. Specifically, the first counter and the second counter count the sampled values corresponding to the synchronization code portion in the first comparison signal and the second comparison signal, respectively, to generate a reference pulse width; the first counter and the second counter count the sampled values corresponding to the data code portion in the first comparison signal and the second comparison signal, respectively, to obtain each first pulse width and each second pulse width; the first pulse width is configured as the value of the first counter corresponding to the data code, and the second pulse width is configured as the value of the second counter corresponding to the data code.
14. The Manchester decoding device according to claim 13, characterized in that: The Manchester decoding device also includes: The reference pulse width generation module is configured to average each third pulse width and each fourth pulse width to obtain the reference pulse width; The third pulse width is configured as the value of the first counter corresponding to the synchronization code, and the fourth pulse width is configured as the value of the second counter corresponding to the synchronization code.
15. The Manchester decoding apparatus according to claim 13 or 14, characterized in that: The first counter is configured to increment by 1 when the first comparison signal is sampled as high, and to clear the value of the first counter when the first comparison signal is sampled as low. The second counter is configured to increment by 1 when the second comparison signal is sampled as high, and to clear the value of the second counter when the second comparison signal is sampled as low.
16. The Manchester decoding device according to claim 11, characterized in that: The decoding module includes: The first judgment and marking module is configured to compare each of the first pulse widths and each of the second pulse widths output by the sampling and counting module with the reference pulse width to obtain a first sequence; The second judgment and marking module is configured to determine, based on the first sequence, whether the logic of the current code element is reversed compared to the logic of the previous code element, thereby achieving decoding; Each element in the first sequence is used to characterize the first pulse width and the second pulse width of the corresponding symbol in the Manchester code.
17. The Manchester decoding device according to claim 16, characterized in that: The first judgment and marking module is configured as follows: When the first pulse width or the second pulse width is greater than the reference pulse width, the first pulse width or the second pulse width is marked as 2T; When the first pulse width or the second pulse width is less than or equal to the reference pulse width, the first pulse width or the second pulse width is marked as T to obtain the first sequence of alternating 2T and T.
18. The Manchester decoding device according to claim 17, characterized in that: The second judgment and marking module is configured as follows: Label the 2T in the first sequence as 2R, and label the T as H, to obtain a second sequence with alternating H and R; The logic of the code elements in all data codes is judged sequentially based on the elements in the second sequence, wherein each element in the second sequence is judged only once.
19. The Manchester decoding device according to claim 18, characterized in that: The second judgment and marking module is configured as follows: Using the symbol logic of the synchronization code as a reference, When two adjacent elements in the second sequence are RR or RH, it is determined that the logic of the current code element has been reversed compared to the logic of the previous code element. When two adjacent elements in the second sequence are HR or HH, the logic of the current code element is determined to be the same as that of the previous code element.
20. The Manchester decoding device according to claim 11, characterized in that: In the Manchester encoding, the first N code elements are set as synchronization codes with the same logic, and the subsequent code elements are data codes. The synchronization code is set to Manchester encoding of 0 or 1, the data code is Manchester encoding of the data to be transmitted, and N is greater than zero.
21. The Manchester decoding device according to claim 13, characterized in that: The frequency of the high-frequency sampling clock is 16 times the transmission rate of Manchester encoding.
22. A battery management system, characterized in that, include: Multiple chips and a host computer are configured to communicate with each other using an isolated daisy chain. Each chip and host computer includes: The transmitter is used to send Manchester encoding to the lower-level chip or the upper-level computer. The receiving end is used to receive the Manchester code sent by the host chip or host computer, and to decode the Manchester code using the Manchester decoding method described in any one of claims 1-10.