Data decoding device, data decoding method and system
By designing a data decoding device including a rising edge detection module, a falling edge detection module and a timing module, the problem of high cost and poor flexibility of serial data decoding equipment in the prior art is solved, and a low-cost and high-flexibility data decoding effect is achieved.
Patent Information
- Application Number
- CN202311369630.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-20
- Publication Date
- 2025-04-22
AI Technical Summary
In the prior art, serial data decoding equipment for the data link layer of the LIN bus is costly and has poor flexibility, and it is impossible to effectively handle uncertain length synchronization intervals.
A data decoding device is designed, including a rising edge detection module, a falling edge detection module and a timing module. By detecting the changes in the level signal, the data stream corresponding to the uncertain length synchronization interval segment is filtered out to generate a target data stream.
Reduces data decoding costs, improves decoding flexibility, and achieves effective data decoding without expensive decoding equipment.
Smart Images

Figure CN119865295A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to data processing technology, and in particular to a data decoding device, a data decoding method and a system. Background Art
[0002] LIN (Local Interconnect Network) bus is a low-speed, low-cost serial communication protocol based on UART (Universal Asynchronous Receiver-Transmitter) / SCI (Serial Communication Interface), which is mainly used in distributed network systems of automotive electronics. Logic analyzers, oscilloscopes and special LIN simulation test tools are used to capture the serial data generated by the data link layer of the LIN bus online. Serial data is transmitted in the form of a frame structure, such as Figure 1a and Figure 1b As shown, the LIN frame structure includes a frame header part (Header) and a response part (Response). The remaining part of the frame structure except the synchronization interval segment located in the frame header part is called a byte field.
[0003] However, the above-mentioned serial data decoding equipment is relatively expensive, has high decoding cost, and has high requirements for the experimental environment; it is necessary to implement synchronization interval detection logic, baud rate generation logic, and first receive the byte data of the LIN bus and then transfer it through the UART logic; the bit value of the dominant level of the synchronization interval of the serial port data transmitted through the LIN protocol is not fixed, and the above-mentioned decoding device has a fixed bit limit for decrypting the serial port data corresponding to the synchronization interval, so the decryption cost is high and the flexibility is poor. Summary of the invention
[0004] The technical problem to be solved by the present invention is to overcome the defects of high cost and poor flexibility in decoding serial data of the data link layer of the LIN bus in the prior art, and to provide a data decoding device, a data decoding method and a system.
[0005] The present invention solves the above technical problems through the following technical solutions:
[0006] In a first aspect, the present invention provides a data decoding device, the data decoding device comprising: a rising edge detection module, a falling edge detection module and a timing module; one end of the rising edge detection module is electrically connected to one end of the falling edge detection module, the other end of the rising edge detection module and the other end of the falling edge detection module are electrically connected to a sending pin of a LIN controller respectively, the falling edge detection module is electrically connected to the timing module, and the falling edge detection module is electrically connected to a conversion device;
[0007] The rising edge detection module is used to receive the level signal corresponding to the original data stream sent by the LIN controller, and when detecting that the level signal switches from the first level to the second level within a first set time period, send a first enable signal to the falling edge detection module to control the falling edge detection module to start receiving the level signal;
[0008] The falling edge detection module is configured to control the timing module to start timing after receiving the first enable signal, and send a target data stream corresponding to the level signal to the conversion device when the timing of the timing module does not reach a time threshold and detects that the level signal switches from the second level to the first level;
[0009] The second level is greater than the first level.
[0010] Preferably, the falling edge detection module is further used to control the sending of a second enable signal to the rising edge detection module and control the timing of the timing module to be reset when the timing of the timing module reaches a time threshold and the level signal is not detected to switch from the second level to the first level.
[0011] Preferably, the rising edge detection module is further used to re-receive the new level signal corresponding to the original data stream of the next frame sent by the LIN controller after receiving the second enable signal.
[0012] Preferably, the time threshold is the duration of 10 bits of data.
[0013] In a second aspect, the present invention provides a data decryption method, which is implemented using the data decoding device as described in the first aspect, and the data decoding method comprises:
[0014] The LIN controller sends a level signal corresponding to the original data stream to the rising edge detection module;
[0015] The rising edge detection module receives and sends a first enable signal to the falling edge detection module when detecting that the level signal switches from the first level to the second level within a first set period of time, so as to control the falling edge detection module to start receiving the level signal;
[0016] After receiving the first enable signal, the falling edge detection module controls the timing module to start timing. When the timing module does not reach the time threshold and detects that the level signal switches from the second level to the first level, the target data stream corresponding to the level signal is sent to the conversion device; the second level is greater than the first level.
[0017] Preferably, the data decoding method further includes:
[0018] When the timing of the timing module reaches a time threshold and the level signal is not detected to be switched from the second level to the first level, a second enable signal is controlled to be sent to the rising edge detection module, and the timing of the timing module is controlled to be reset.
[0019] Preferably, the data decoding method further includes:
[0020] After the rising edge detection module receives the second enable signal, the rising edge detection module receives the new level signal corresponding to the original data stream of the next frame sent by the LIN controller.
[0021] In a third aspect, the present invention provides a data decoding system, the data decoding system comprising: a LIN controller, a conversion device, a host end, and the data decoding device according to the first aspect;
[0022] One end of the conversion device is electrically connected to the host end, the other end of the conversion device is electrically connected to one end of the data decoding device, and the other end of the data decoding device is electrically connected to the LIN controller;
[0023] The data decoding device is used to detect the level signal corresponding to the original data stream sent by the LIN controller, so as to decode the original data stream, obtain the target data stream and send it to the conversion device;
[0024] The conversion device is used to convert the target data stream into a target signal corresponding to the USB interface of the host end and transmit the target signal to the host end;
[0025] The host end is used to receive the target signal.
[0026] Preferably, the host end is also used to transmit the target feedback signal to the LIN controller via the conversion device and the data decoding device in sequence.
[0027] Preferably, the conversion device comprises a USB to UART adapter.
[0028] The positive and progressive effects of the present invention are: providing a data decoding device, a data decoding method and a system, which, without the need for expensive decoding equipment, only utilizes a rising edge detection module, a falling edge detection module and a timing module to detect the level signal corresponding to the original data stream of the LIN bus data link layer, filters out the data stream corresponding to the synchronization interval segment of indefinite length, obtains the target data stream, reduces the data decoding cost, and improves the decoding flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1aThis is a schematic diagram of the LIN frame structure of Example 1 of the present invention.
[0030] Figure 1b This is a schematic diagram of the byte field structure of embodiment 1 of the present invention.
[0031] Figure 2 It is a structural diagram of a data decoding device according to embodiment 1 of the present invention.
[0032] Figure 3 This is the first flow chart of the data decoding method according to the second embodiment of the present invention.
[0033] Figure 4 This is a second flow chart of the data decoding method according to embodiment 2 of the present invention.
[0034] Figure 5 This is a schematic diagram of the structure of a data decoding system according to Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0035] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0036] Example 1
[0037] This embodiment provides a data decoding device, such as Figure 2 As shown, the data decoding device includes: a rising edge detection module 11, a falling edge detection module 12 and a timing module 13; one end of the rising edge detection module 11 is electrically connected to one end of the falling edge detection module 12, the other end of the rising edge detection module 11 and the other end of the falling edge detection module 12 are electrically connected to the sending pin of the LIN controller respectively, the falling edge detection module 12 is electrically connected to the timing module 13, and the falling edge detection module 12 is electrically connected to the conversion device;
[0038] The rising edge detection module 11 is used to receive the level signal corresponding to the original data stream sent by the LIN controller, and when detecting that the level signal switches from the first level to the second level within a first set period of time, send a first enable signal to the falling edge detection module 12 to control the falling edge detection module 12 to start receiving the level signal;
[0039] The falling edge detection module 12 is used to control the timing module 13 to start timing after receiving the first enable signal. When the timing of the timing module 13 does not reach the time threshold and detects that the level signal switches from the second level to the first level, the target data stream corresponding to the level signal is sent to the conversion device; wherein the second level is greater than the first level.
[0040] The time threshold is the duration of 10 bits of data.
[0041] In a specific implementation, the first level is a low level "0" and the second level is a high level "1". When the rising edge detection module 11 detects that the level signal switches from a continuous multi-bit low level "0" to a 1-bit high level "1", it indicates that the synchronization interval of the original data stream has been detected, and the first enable signal is sent to the falling edge detection module 12 to control the falling edge detection module 12 to start receiving the level signal. The falling edge detection module 12 continues to detect the level signal. When it is detected that the level signal switches from a high level "1" to a low level "0" within the time threshold, it indicates that the byte domain part of the original data stream has been detected, and the falling edge detection module 12 sends the target data stream corresponding to the remaining level signal to the conversion device.
[0042] It should be noted that the length of the first set time period is the length of the level signal corresponding to the synchronization interval, for example, greater than or equal to 13 bits.
[0043] The falling edge detection module 12 is further configured to control the sending of a second enable signal to the rising edge detection module 11 and control the timing module 13 to reset the timing when the timing module 13 reaches a time threshold and does not detect that the level signal switches from the second level to the first level.
[0044] The rising edge detection module 11 is further configured to receive a new level signal corresponding to the original data stream of the next frame sent by the LIN controller after receiving the second enable signal.
[0045] When the falling edge detection module 12 does not detect the level signal switching from high level "1" to low level "0" within the time threshold, it indicates that the byte domain part of the original data stream is not detected, and there is no data in the current original data stream. The falling edge detection module 12 sends a second enable signal to the rising edge detection module 11, and clears the timing data of the timing module 13, effectively preventing interference with the detection result of the level signal corresponding to the original data stream of the next frame. After the rising edge detection module 11 receives the second enable signal, it receives the new level signal corresponding to the original data stream of the next frame sent by the LIN controller, and detects the level signal corresponding to the original data stream of the next frame.
[0046] This embodiment provides a data decoding device, which uses a rising edge detection module, a falling edge detection module and a timing module to detect the level signal corresponding to the original data stream of the LIN bus data link layer, filters out the data stream corresponding to the synchronization interval segment of indefinite length, obtains the target data stream, reduces the data decoding cost, and improves the decoding flexibility.
[0047] Example 2
[0048] On the basis of Example 1, Figure 3As shown, this embodiment provides a data decryption method, which is implemented using the data decoding device of embodiment 1. The data decoding method includes:
[0049] S1, LIN controller sends a level signal corresponding to the original data stream to the rising edge detection module;
[0050] S2, when the rising edge detection module receives and detects that the level signal switches from the first level to the second level within the first set time period, the first enable signal is sent to the falling edge detection module to control the falling edge detection module to start receiving the level signal;
[0051] S31. After receiving the first enable signal, the falling edge detection module controls the timing module to start timing. When the timing module does not reach the time threshold and detects that the level signal switches from the second level to the first level, the target data stream corresponding to the level signal is sent to the conversion device; the second level is greater than the first level.
[0052] Specifically, the first level is a low level "0", and the second level is a high level "1". When the rising edge detection module detects that the level signal switches from a continuous multi-bit low level "0" to a 1-bit high level "1", it indicates that the synchronization interval segment of the original data stream has been detected, and the first enable signal is sent to the falling edge detection module to control the falling edge detection module to start receiving the level signal. The falling edge detection module continues to detect the level signal. When it is detected that the level signal switches from a high level "1" to a low level "0" within the time threshold, it indicates that the byte domain part of the original data stream has been detected, and the target data stream corresponding to the remaining level signal is sent to the conversion device.
[0053] It should be noted that the length of the first set time period is the length of the level signal corresponding to the synchronization interval, for example, greater than or equal to 13 bits.
[0054] In one embodiment, Figure 4 As shown, the data decoding method also includes:
[0055] S32: When the timing of the timing module reaches the time threshold and the level signal is not detected to switch from the second level to the first level, control the sending of a second enable signal to the rising edge detection module, and control the timing of the timing module to be reset.
[0056] S4. After the rising edge detection module receives the second enable signal, the rising edge detection module receives a new level signal corresponding to the original data stream of the next frame sent by the LIN controller.
[0057] Specifically, when the level signal is not detected to switch from high level "1" to low level "0" within the time threshold, it indicates that the byte domain part of the original data stream is not detected, and there is no data in the current original data stream. When the rising edge detection module receives the second enable signal, it re-receives a new level signal corresponding to the next original data stream sent by the LIN controller.
[0058] This embodiment provides a data decryption method, which uses a rising edge detection module, a falling edge detection module and a timing module to detect the level signal corresponding to the original data stream of the LIN bus data link layer, filters out the data stream corresponding to the synchronization interval segment of indefinite length, obtains the target data stream, reduces the data decoding cost, and improves the decoding flexibility.
[0059] Example 3
[0060] On the basis of Example 1, Figure 5 As shown, this embodiment provides a data decoding system, which includes: a LIN controller 20, a conversion device 30, a host end 40 and the data decoding device 10 of embodiment 1;
[0061] One end of the conversion device 30 is electrically connected to the host end 40, the other end of the conversion device 30 is electrically connected to one end of the data decoding device 10, and the other end of the data decoding device 10 is electrically connected to the LIN controller 20;
[0062] The data decoding device 10 is used to detect the level signal corresponding to the original data stream sent by the LIN controller 20, so as to decode the original data stream, obtain the target data stream and send it to the conversion device 30;
[0063] The conversion device 30 is used to convert the target data stream into a target signal corresponding to the USB interface of the host end 40 and transmit it to the host end 40;
[0064] The host end 40 is used to receive the target signal sent by the conversion device 30.
[0065] In one embodiment, the host end 40 is also used to transmit the target feedback signal to the LIN controller 20 via the conversion device 30 and the data decoding device 10 in sequence.
[0066] The conversion device includes a USB to UART adapter.
[0067] In the specific implementation, the sending pin and receiving pin of the tested LIN controller 20 are electrically connected to the GPIO pin of the data decoding device 10 respectively, and the LIN controller 20 sends a level signal corresponding to the original data stream to the data decoding device 10. The data decoding device 10 detects the high and low changes of the level signal, thereby filtering out the data stream corresponding to the synchronization interval segment of indefinite length and generating a target data stream. The data decoding device 10 transmits the target signal corresponding to the target data stream to the host end 40 through the USB to UART adapter. The serial port debugging assistant software is installed on the host end 40, and the data is displayed on the display screen through the assistant software. After receiving the target signal, the host end 40 generates a target feedback signal, and outputs the target feedback signal to the receiving pin of the LIN controller 20 through the USB to UART adapter and the data decoding device 10 in sequence. It should be noted that the target feedback signal is the response part of the LIN frame data, and the response part is all byte fields.
[0068] The present embodiment provides a data decryption system, which uses a data decoding device to detect the level signal corresponding to the original data stream of the LIN bus data link layer sent by the LIN controller to realize data decoding, and sends the target data stream generated after decoding to the host end through a conversion device. There is no need for expensive decoding equipment, which reduces the cost of data decoding and improves decoding flexibility.
[0069] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A data decoding device, characterized in that: The data decoding device comprises: a rising edge detection module, a falling edge detection module and a timing module; one end of the rising edge detection module is electrically connected to one end of the falling edge detection module, the other end of the rising edge detection module and the other end of the falling edge detection module are electrically connected to the sending pin of the LIN controller respectively, the falling edge detection module is electrically connected to the timing module, and the falling edge detection module is electrically connected to the conversion device; The rising edge detection module is used to receive the level signal corresponding to the original data stream sent by the LIN controller, and when detecting that the level signal switches from the first level to the second level within a first set time period, send a first enable signal to the falling edge detection module to control the falling edge detection module to start receiving the level signal; The falling edge detection module is configured to control the timing module to start timing after receiving the first enable signal, and send a target data stream corresponding to the level signal to the conversion device when the timing of the timing module does not reach a time threshold and detects that the level signal switches from the second level to the first level; The second level is greater than the first level.
2. The data decoding device according to claim 1, characterized in that: The falling edge detection module is further used to control the sending of a second enable signal to the rising edge detection module and control the timing of the timing module to be reset when the timing of the timing module reaches a time threshold and the level signal is not detected to be switched from the second level to the first level.
3. The data decoding device according to claim 2, characterized in that: The rising edge detection module is further used to receive the new level signal corresponding to the original data stream of the next frame sent by the LIN controller after receiving the second enable signal.
4. The data decoding device according to claim 1, wherein: The time threshold is the duration of 10 bits of data.
5. A data decryption method, characterized in that: The data decoding method is implemented by using the data decoding device according to any one of claims 1 to 4, wherein the data decoding method comprises: The LIN controller sends a level signal corresponding to the original data stream to the rising edge detection module; The rising edge detection module receives and sends a first enable signal to the falling edge detection module when detecting that the level signal switches from the first level to the second level within a first set period of time, so as to control the falling edge detection module to start receiving the level signal; After receiving the first enable signal, the falling edge detection module controls the timing module to start timing. When the timing module does not reach the time threshold and detects that the level signal switches from the second level to the first level, the target data stream corresponding to the level signal is sent to the conversion device; the second level is greater than the first level.
6. The data decryption method according to claim 5, characterized in that: The data decoding method further comprises: When the timing of the timing module reaches a time threshold and the level signal is not detected to be switched from the second level to the first level, a second enable signal is controlled to be sent to the rising edge detection module, and the timing of the timing module is controlled to be reset.
7. The data decryption method according to claim 6, characterized in that: The data decoding method further comprises: After the rising edge detection module receives the second enable signal, the rising edge detection module receives the new level signal corresponding to the original data stream of the next frame sent by the LIN controller.
8. A data decoding system, characterized in that: The data decoding system comprises: a LIN controller, a conversion device, a host end and a data decoding device as claimed in any one of claims 1 to 4; One end of the conversion device is electrically connected to the host end, the other end of the conversion device is electrically connected to one end of the data decoding device, and the other end of the data decoding device is electrically connected to the LIN controller; The data decoding device is used to detect the level signal corresponding to the original data stream sent by the LIN controller, so as to decode the original data stream, obtain the target data stream and send it to the conversion device; The conversion device is used to convert the target data stream into a target signal corresponding to the USB interface of the host end and transmit the target signal to the host end; The host end is used to receive the target signal.
9. The data decoding system according to claim 8, characterized in that: The host end is also used to transmit the target feedback signal to the LIN controller through the conversion device and the data decoding device in sequence.
10. The data decoding system according to claim 9, characterized in that: The conversion device includes a USB to UART adapter.