USB PD message decoding methods, devices, chips, and communication equipment
By directly detecting the frame header sequence code in the USB PD protocol and utilizing a decoding timer, the problem of data reception errors caused by signal distortion is solved, ensuring the accuracy and robustness of data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU POWERON IC DESIGN
- Filing Date
- 2022-12-14
- Publication Date
- 2026-06-05
AI Technical Summary
In the USB PD protocol, issues such as signal level distortion, frequency offset, and duty cycle asymmetry can cause sampling errors in the digital receiving circuit, affecting message reception, especially the confirmation of GoodCRC messages, which prevents the receiver from responding in a timely manner and affects the accuracy of data transmission.
By receiving sampled data from the USB PD signal in real time and storing it in a FIFO buffer, the four K codes in the frame header sequence code are matched. When at least three K codes are successfully detected, the frame header sequence code is determined, the data start point is determined, and the integrity of data reception is ensured by a decoding timer.
It enables accurate detection of frame header sequence codes in the event of preamble errors or loss, ensuring the correctness of data decoding and improving the robustness of the device and the reliability of data transmission.
Smart Images

Figure CN116156021B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital communication technology, specifically to a USB PD message decoding method and apparatus, chip, and communication device. Background Technology
[0002] USB (Universal Serial Bus) PD (Power Delivery) protocol, also known as the USB Power Specification, is a fast charging protocol designed to standardize fast charging devices on the market, making them universal and usable across different devices, and preventing charging failures or battery damage due to excessive voltage or current.
[0003] The USB PD protocol uses a Type-C interface. The USB PD standard has five "specifications": 10W, 18W, 36W, 60W, and 100W. The voltage is 5V, 12V, 15V, and 20V, and the current is 1.5A, 2A, 3A, and 5A, with a maximum of 100W. After a successful communication handshake between devices, they autonomously negotiate to use the corresponding power for charging and discharging. In addition, it is bidirectional and can switch roles, i.e., power supply.
[0004] According to Section 5.4 of the USB PD 3.0 protocol, PD messages are classified into different types based on their Ordered Sets header sequence codes, roughly categorized as SOP / SOP' / SOP" / Hard Reset / Cable Reset, etc. Each header sequence code consists of four K-codes, and the protocol stipulates that a single erroneous K-code will not affect message reception. The protocol also specifies that the preamble of each message consists of 64 bits of alternating 0s and 1s, and must start with 0 and end with 1.
[0005] Because signal level distortion, frequency offset, and duty cycle asymmetry can occur during actual circuit operation and transmission, digital receiving circuits may experience sampling errors. This can affect message reception, preventing the receiver from promptly replying with a GoodCRC message to confirm that the previous message has been correctly received. Summary of the Invention
[0006] This invention provides a USB PD message decoding method, apparatus, and communication device to achieve accurate detection and reception of USB PD messages.
[0007] Therefore, the embodiments of the present invention provide the following technical solutions:
[0008] On one hand, embodiments of the present invention provide a USB PD message decoding method, the method comprising:
[0009] The system receives sampled data from the USB PD signal in real time and sequentially places the sampled data into a FIFO buffer of a set length.
[0010] Extract the current data from the FIFO buffer and use the current data as the data to be detected;
[0011] The data to be detected is matched with the four K codes in the frame header sequence code;
[0012] If at least three K codes match successfully, then the frame header sequence code has been detected.
[0013] Optionally, the FIFO buffer length is 20 bits.
[0014] Optionally, matching the data to be detected with the four K codes in the frame header sequence code includes:
[0015] The data to be detected is divided into four equal parts in sequence to obtain the sequence to be detected;
[0016] The sequence to be detected is matched sequentially with the frame header sequence codes of each type.
[0017] Optionally, the method further includes:
[0018] The starting point of the data in the USB PD message is determined based on the frame header sequence code;
[0019] The data in the USB PD message is decoded based on the sampled data after the starting point.
[0020] Optionally, the method further includes:
[0021] After confirming that the frame header sequence code has been detected, the decoding timer is started;
[0022] If the EOP code is decoded before the decoding timer expires, it is determined that the message reception is complete, and the decoding timer is turned off.
[0023] Otherwise, after the decoding timer expires, it is determined that the message reception is complete.
[0024] On the other hand, embodiments of the present invention also provide a USB PD message decoding device, the device comprising:
[0025] The data buffer module is used to receive sampled data of the USB PD signal in real time and put the sampled data into a FIFO buffer of a set length in sequence;
[0026] The detection module is used to extract current data from the FIFO buffer, use the current data as the data to be detected, and match the data to be detected with the four K codes in the frame header sequence code; if at least three K codes are successfully matched, it is determined that the frame header sequence code has been detected.
[0027] Optionally, the detection module includes:
[0028] The data extraction unit is used to extract current data from the FIFO cache;
[0029] The data processing unit is used to take the current data as the data to be detected, and divide the data to be detected into four equal parts in sequence to obtain the sequence to be detected.
[0030] The matching unit is used to match the sequence to be detected sequentially with frame header sequence codes of various types, and to determine that a frame header sequence code has been detected if at least 3 K codes are successfully matched.
[0031] Optionally, the detection module is further configured to determine the data start point in the USB PD message based on the frame header sequence code;
[0032] The device further includes a decoding module, used to decode the data in the USBPD message based on the sampled data after the starting point.
[0033] Optionally, the device further includes: a decoding timer;
[0034] The detection module is also used to start the decoding timer after determining that a frame header sequence code has been detected;
[0035] The decoding module is further configured to determine that the message reception is complete after decoding the EOP code before the decoding timer expires, and then close the decoding timer; otherwise, it determines that the message reception is complete after the decoding timer expires.
[0036] On the other hand, embodiments of the present invention also provide a chip, the chip including the USB PD message decoding device described above.
[0037] On the other hand, embodiments of the present invention also provide a communication device for exchanging USB PD messages with other devices via a communication line. The communication device includes: a sampling module and the aforementioned USB PD message decoding device.
[0038] The sampling module is used to sample the USB PD signal transmitted on the communication line to obtain sampling data;
[0039] The USB PD message decoding device is used to perform decoding processing based on the sampled data.
[0040] The USB PD message decoding method and apparatus provided in this invention stores the sampled data of the real-time received USB PD signal into a FIFO buffer of a set length. The current data in the FIFO buffer is used as the data to be detected and matched against the four K codes in the frame header sequence code. If at least three K codes match successfully, the frame header sequence code is determined to have been detected. Using this invention, the detection of the frame header sequence code can be achieved simply and conveniently. Furthermore, there is no need to detect the preamble; directly detecting the frame header sequence code determines the start point of the data in the USB PD message, thereby filtering out cases of preamble errors or loss. In other words, even in the case of preamble errors or loss, as long as the frame header sequence code can be detected, it will not affect the decoding of the data in the USB PD message, thus ensuring the correct reception of transmitted data.
[0041] Furthermore, by setting a decoding timer, even in the event of an EOP code reception error, subsequent message reception will not be affected.
[0042] Accordingly, the communication device provided in this embodiment of the invention, by utilizing the above-mentioned USB PD message decoding device, can effectively improve the robustness of the device and enable the device to better adapt to various different application environments. Attached Figure Description
[0043] Figure 1 This is a schematic diagram of the existing USB PD3.0 communication process.
[0044] Figure 2 This is a flowchart of a USB PD message decoding method provided in an embodiment of the present invention.
[0045] Figure 3 This is a schematic diagram showing the correspondence between sampled data and a 20-bit window queue in an embodiment of the present invention.
[0046] Figure 4 This is a flowchart of a USB PD message decoding method provided in an embodiment of the present invention.
[0047] Figure 5 This is a schematic diagram of a USB PD message decoding device provided in an embodiment of the present invention.
[0048] Figure 6 This is another structural schematic diagram of the USB PD message decoding device provided in the embodiments of the present invention.
[0049] Figure 7 This is a schematic diagram of a communication device provided in an embodiment of the present invention. Detailed Implementation
[0050] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0051] The following is a brief explanation of the USB PD3.0 communication process, such as... Figure 1 As shown, this includes the process of sending and receiving data packets. Wherein:
[0052] The process for sending data packets is as follows:
[0053] (1) Receive data packets from the protocol layer;
[0054] (2) Perform CRC check;
[0055] (3) Encode the CRC check result onto the data packet;
[0056] (4) The verified data packet is transmitted via the Configuration Channel (CC) communication line through BMC (Biphase Mark Coding) encoding.
[0057] The process for receiving data packets is as follows:
[0058] (1) Restore the clock and lock it onto the preamble of the data packet;
[0059] (2) Check SOP*;
[0060] (3) Decode the received data, including CRC;
[0061] (4) Determine whether the received data is valid data.
[0062] The data packet format of the USB PD protocol is shown in Table 1 below.
[0063] Table 1
[0064] Preamble SOP* (Start of Package) Message CRC EOP (End of Packet)
[0065] The functions of each information field are as follows:
[0066] Preamble is a 64-bit sequence of alternating "0"s and "1"s (starting with "0" and ending with "1").
[0067] SOP* (Start of Packet) is similar to the address in I2C (Inter-Integrated Circuit) communication. There are three types of SOP*: SOP, SOP', and SOP”. Among them, SOP refers to communication between the source and the sink, which can only be end-to-end communication, and the cable cannot recognize this type of message; SOP' and SOP” can only be the data type of communication between one end (source or sink) and the cable.
[0068] The message is the payload, which includes three types of messages: 1) control messages; 2) data messages; and 3) extended messages.
[0069] CRC (Cyclic Redundancy Check) is a checksum that calculates all bytes of the payload except for frame symbols (Preamble, SOP*, EOP).
[0070] EOP (End of Packet).
[0071] Of the information above, only the Message field contains protocol layer data; the other fields contain physical layer data.
[0072] PD messages are classified into different types based on their frame header sequence codes (Ordered Sets), roughly divided into SOP / SOP' / SOP” / Hard Reset / Cable Reset, etc.
[0073] At the sending end, the PD physical layer needs to assemble the message, that is, add a preamble, SOP*, CRC, EOP, etc., and then encode the assembled data before transmitting it. Correspondingly, at the receiving end, the received data packet needs to be decoded and verified to finally obtain the message.
[0074] In USB PD3.0, except for the preamble, data packets are encoded using 4b5b encoding. That is, at the sending end, 4 bits of data are encoded into 5 bits of symbols for transmission, and at the receiving end, the 5 bits of symbols are decoded back into 4 bits of data.
[0075] The 4b5b code provides data encoding and special symbols, which are used to represent hard resets and delineate packet boundaries. The 4b5b symbol encoding table is shown in Table 2 below.
[0076] Table 2
[0077]
[0078]
[0079] PD messages are classified into different types based on their Ordered Sets header sequence codes, roughly divided into SOP / SOP' / SOP” / Hard Reset / Cable Reset. Each header sequence code consists of 4 K-codes, as shown in Table 3 below.
[0080] Table 3
[0081]
[0082] The receiver searches for all four K codes. When three or four of the four K codes are found in the correct location, it is a valid frame header sequence code.
[0083] To address this, embodiments of the present invention provide a USB PD message decoding method and apparatus. For the sampled data of the received USB PD signal, there is no need to detect the preamble; instead, the frame header sequence code is directly detected. Once the frame header sequence code is detected, the data start point in the USB PD message can be determined. Then, starting from the data start point, the data after the start point is decoded to obtain the data in the USB PD message.
[0084] like Figure 2 The diagram shown is a flowchart of a USB PD message decoding method provided in an embodiment of the present invention.
[0085] The USB PD message decoding method of this embodiment includes the following steps:
[0086] Step 201: Receive the sampling data of the USB PD signal in real time, and put the sampling data into a FIFO buffer of a set length in sequence.
[0087] Considering the four K codes in the frame header sequence code, after 4b5b encoding, each K code corresponds to a 5-bit 5b encoding, so the length of the FIFO buffer can be set to 20 bits.
[0088] The FIFO buffer is a first-in, first-out (FIFO) buffer, meaning that once it is full (20 bits), any new sampled data entering the FIFO buffer will cause the first data to overflow. Alternatively, the 20-bit FIFO buffer can be viewed as a 20-bit window queue that slides with the sampling signal sequence.
[0089] like Figure 3 The diagram shown is a schematic representation of the correspondence between sampled data and a 20-bit window queue in an embodiment of the present invention.
[0090] Where CC represents the USB PD signal transmitted on the communication line, rx_sample_en represents the sampling data output enable signal, rx_sample represents the sampling signal, and sr20bit_queue represents a 20-bit window queue.
[0091] Step 202: Extract the current data from the FIFO cache and use the current data as the data to be detected.
[0092] In other words, each detection extracts 20 bits of cached data from the FIFO buffer and checks whether this 20 bits of cached data is the frame header sequence code, i.e., 4 K codes.
[0093] In this embodiment of the invention, 20 bits of cached data can be extracted from the FIFO cache every 5 sampling clock cycles.
[0094] Step 203: Match the data to be detected with the four K codes in the frame header sequence code.
[0095] As mentioned earlier, the frame header sequence code is used to identify the type of USB PD message, specifically the following: SOP, SOP', SOP", hardware reset, and transmission line reset. The values of the four K codes will differ for different types, as shown in Table 3 above.
[0096] Therefore, in this embodiment of the invention, the data to be detected can be divided into four equal parts in sequence to obtain the sequence to be detected, and the sequence to be detected can be matched with the frame header sequence codes of each type in sequence.
[0097] Of course, the data to be detected can also be divided unequally, and the 20 bits can be matched together with the 4 K codes in the frame header sequence code. This embodiment of the invention does not limit this.
[0098] Step 204: Determine if at least 3 K codes are successfully matched. If yes, proceed to step 205; otherwise, proceed to step 202 to continue with frame header sequence code detection.
[0099] Step 205: Confirm that a frame header sequence code has been detected.
[0100] After detecting the frame header sequence code, the data start point in the USB PD message can be determined based on the frame header sequence code, and the data in the USB PD message can be decoded based on the sampled data after that start point. Specifically, the data after the data start point is extracted from the FIFO buffer, and 4b5b decoding is performed to obtain the data in the USB PD message.
[0101] It should be noted that when retrieving data to be decoded from the FIFO buffer, data can be retrieved once every 5 sampling cycles, that is, 5 bits of data are retrieved each time. The retrieved 5 bits of data are then decoded using 5b4b to obtain 4 bits of data. Of course, 5N (N = 2, 3, or 4) bits of data can also be retrieved from the FIFO buffer each time. Naturally, the data retrieval clock will differ depending on the number of bits retrieved, and this embodiment of the invention does not limit this.
[0102] It should be noted that steps 201 and 202 to 205 are two parallel processes, which can be controlled by corresponding timing control mechanisms.
[0103] The USB PD message decoding method provided in this invention provides a simple and convenient way to detect the frame header sequence code. Furthermore, it eliminates the need to detect the preamble; directly detecting the frame header sequence code determines the start point of the data in the USB PD message. This allows for filtering out cases of preamble errors or loss. In other words, even in the event of a preamble error or loss, as long as the frame header sequence code can be detected, it will not affect the decoding of the data in the USB PD message, thus ensuring the correct reception of transmitted data.
[0104] As shown in Table 1 above regarding the USB PD protocol data packet format, the EOP code in a USB PD packet indicates the end of the data packet, meaning that the USB PD packet reception is complete. Therefore, in existing technologies, decoding the EOP code is typically used to determine the completion of packet reception and end the current USB PD packet reception process.
[0105] Considering that various reasons may lead to EOP code reception errors or EOP code loss during data transmission, in these cases, decoding will fail to obtain the EOP code, thus preventing the termination of the current USB PD message reception process. To avoid affecting subsequent USB PD message reception processes, in another embodiment of the method of this invention, this problem can be solved by setting a decoding timer.
[0106] like Figure 4 The diagram shown is a flowchart of a USB PD message decoding method provided in an embodiment of the present invention.
[0107] The USB PD message decoding method of this embodiment includes the following steps:
[0108] Step 401: Receive the sampling data of the USB PD signal in real time, and put the sampling data into a FIFO buffer of a set length in sequence.
[0109] Step 402: Extract the current data from the FIFO cache and use the current data as the data to be detected.
[0110] Step 403: Match the data to be detected with the four K codes in the frame header sequence code. When at least three K codes match successfully, it is determined that the frame header sequence code has been detected, and the decoding timer is started.
[0111] Step 404: Determine the data start point in the USB PD message based on the frame header sequence code, and decode the sampled data after the start point to obtain the data in the USB PD message.
[0112] Step 405: Determine if the decoding timer has timed out. If so, proceed to step 407; otherwise, proceed to step 406.
[0113] Step 406: Determine whether the EOP code has been decoded; if so, proceed to step 407.
[0114] Step 407: Confirm that the message reception is complete and end the current USB PD message reception process.
[0115] It should be noted that the duration of the decoding timer can be set to the decoding duration corresponding to the maximum data length in the USB PD message.
[0116] The USB PD message decoding method of this invention can not only easily and conveniently detect the frame header sequence code, and then determine the data start point in the USB PD message based on the frame header sequence code, but also decode the data in the USB PD message based on the sampled data after the start point. Moreover, by setting a decoding timer, even in the case of EOP code reception error, it will not affect the reception of subsequent messages.
[0117] Accordingly, embodiments of the present invention also provide a USB PD message decoding device, such as... Figure 5 The diagram shown is a structural schematic of the device.
[0118] The USB PD message decoding device 500 includes the following modules:
[0119] The data buffer module 501 is used to receive sampled data of the USB PD signal in real time and put the sampled data into a FIFO buffer of a set length in sequence;
[0120] The detection module 502 is used to extract current data from the FIFO buffer, use the current data as the data to be detected, and match the data to be detected with the four K codes in the frame header sequence code; if at least three K codes are successfully matched, it is determined that the frame header sequence code has been detected.
[0121] One non-limiting embodiment of the detection module 502 may include the following units:
[0122] The data extraction unit is used to extract current data from the FIFO cache;
[0123] The data processing unit is used to take the current data as the data to be detected, and divide the data to be detected into four equal parts in sequence to obtain the sequence to be detected.
[0124] The matching unit is used to match the sequence to be detected sequentially with frame header sequence codes of various types, and to determine that a frame header sequence code has been detected if at least 3 K codes are successfully matched.
[0125] Furthermore, in another non-limiting embodiment of the USB PD message decoding device of the present invention, the device may further include:
[0126] The detection module 502 is also used to determine the data start point in the USB PD message based on the frame header sequence code.
[0127] Accordingly, the USB PD message decoding device of this embodiment may further include: a decoding module, used to decode the data in the USB PD message based on the sampled data after the starting point.
[0128] The USB PD message decoding device provided in this invention stores the sampled data of the real-time received USB PD signal into a FIFO buffer of a set length. The current data in the FIFO buffer is used as the data to be detected and matched against the four K codes in the frame header sequence code. If at least three K codes match successfully, the frame header sequence code is determined to have been detected. Using this invention, the detection of the frame header sequence code can be achieved simply and conveniently. Furthermore, there is no need to detect the preamble; directly detecting the frame header sequence code determines the start point of the data in the USB PD message, thereby filtering out cases of preamble errors or loss. In other words, even in the case of preamble errors or loss, as long as the frame header sequence code can be detected, it will not affect the decoding of the data in the USB PD message, thus ensuring the correct reception of transmitted data.
[0129] like Figure 6 The diagram shown is another structural schematic of the USB PD message decoding device provided in an embodiment of the present invention.
[0130] and Figure 5 The difference in the illustrated embodiment is that, in this embodiment, the USB PD message decoding device further includes a decoding module 601 and a decoding timer 602.
[0131] In this embodiment:
[0132] The data buffer module 501 is used to receive sampled data of the USB PD signal in real time and put the sampled data into a FIFO buffer of a set length in sequence;
[0133] The detection block 502 is used to extract the current data from the FIFO buffer and use the current data as the data to be detected. The data to be detected is matched with the four K codes in the frame header sequence code. If at least three K codes are successfully matched, it is determined that the frame header sequence code has been detected. The starting point of the data in the USB PD message is determined according to the frame header sequence code, and the decoding timer is started.
[0134] The decoding module 601 is used to decode the data in the USB PD message based on the sampled data after the starting point. After decoding the EOP code before the decoding timer 602 times out, it determines that the message reception is complete and closes the decoding timer; otherwise, it determines that the message reception is complete after the decoding timer 602 times out.
[0135] The USB PD message decoding device of this embodiment can easily and conveniently detect the frame header sequence code, determine the data start point in the USB PD message based on the frame header sequence code, and decode the data in the USB PD message based on the sampled data after the start point. Moreover, by setting a decoding timer, even in the case of EOP code reception errors, subsequent message reception will not be affected.
[0136] Accordingly, embodiments of the present invention also provide a chip, the chip including the USB PD message decoding device of any of the above embodiments.
[0137] Accordingly, embodiments of the present invention also provide a communication device for exchanging USB PD messages with other devices via a communication line. For example... Figure 7 The diagram shown is a structural schematic of the communication device.
[0138] The communication device includes: a sampling module 701, and a USB PD message decoding device 500 as described above. Wherein:
[0139] The sampling module 701 is used to sample the USB PD signal transmitted on the communication line to obtain sampling data;
[0140] The USB PD message decoding device 500 is used to perform decoding processing based on the sampled data.
[0141] The communication device can be a terminal device with a USB Type-C interface, such as a mobile phone.
[0142] The communication device provided in this embodiment of the invention, utilizing the aforementioned USB PD message decoding device, can detect the frame header sequence code. After detecting the frame header sequence code, it decodes the data in the USB PD message based on subsequent sampled data. Furthermore, a decoding timer can be used to ensure that subsequent message reception is not affected even in the event of an EOP code reception error, thereby effectively improving the robustness of the device and enabling it to better adapt to various application environments.
[0143] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.
[0144] In the embodiments of this invention, "multiple" refers to two or more.
[0145] The descriptions of "first," "second," etc., appearing in the embodiments of this invention are for illustrative purposes and to distinguish the objects being described. They do not indicate any particular order and do not imply any special limitation on the number of devices in the embodiments of this invention. They do not constitute any limitation on the embodiments of this invention.
[0146] In the several embodiments provided by this invention, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.
[0147] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can be physically arranged separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0148] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. A USB PD message decoding method, characterized in that, The method includes: The system receives sampled data from the USB PD signal in real time and sequentially places the sampled data into a FIFO buffer of a set length. Extract the current data from the FIFO buffer and use the current data as the data to be detected; The data to be detected is directly matched with the four K codes in the frame header sequence code, without the need to detect the preamble; If at least three K codes match successfully, then the frame header sequence code has been detected.
2. The method according to claim 1, characterized in that, The FIFO buffer has a length of 20 bits.
3. The method according to claim 2, characterized in that, The step of matching the data to be detected with the four K codes in the frame header sequence code includes: The data to be detected is divided into four equal parts in sequence to obtain the sequence to be detected; The sequence to be detected is matched sequentially with the frame header sequence codes of each type.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: The starting point of the data in the USB PD message is determined based on the frame header sequence code; The data in the USB PD message is decoded based on the sampled data after the starting point.
5. The method according to claim 4, characterized in that, The method further includes: After confirming that the frame header sequence code has been detected, the decoding timer is started; If the EOP code is decoded before the decoding timer expires, it is determined that the message reception is complete, and the decoding timer is turned off. Otherwise, after the decoding timer expires, it is determined that the message reception is complete.
6. A USB PD message decoding device, characterized in that, The device includes: The data buffer module is used to receive sampled data of the USB PD signal in real time and put the sampled data into a FIFO buffer of a set length in sequence; The detection module is used to extract the current data from the FIFO buffer and use the current data as the data to be detected. It directly matches the data to be detected with the four K codes in the frame header sequence code without detecting the preamble. If at least three K codes are successfully matched, it is determined that the frame header sequence code has been detected.
7. The apparatus according to claim 6, characterized in that, The detection module includes: The data extraction unit is used to extract current data from the FIFO cache; The data processing unit is used to take the current data as the data to be detected, and divide the data to be detected into four equal parts in sequence to obtain the sequence to be detected. The matching unit is used to match the sequence to be detected sequentially with frame header sequence codes of various types, and to determine that a frame header sequence code has been detected if at least 3 K codes are successfully matched.
8. The apparatus according to claim 6 or 7, characterized in that, The detection module is also used to determine the data start point in the USB PD message based on the frame header sequence code; The device further includes: The decoding module is used to decode the data in the USB PD message based on the sampled data after the starting point.
9. The apparatus according to claim 8, characterized in that, The device further includes: a decoding timer; The detection module is also used to start the decoding timer after determining that a frame header sequence code has been detected; The decoding module is further configured to determine that the message reception is complete after decoding the EOP code before the decoding timer expires, and then close the decoding timer; otherwise, it determines that the message reception is complete after the decoding timer expires.
10. A chip, characterized in that, The chip includes the USB PD message decoding device as described in any one of claims 6 to 9.
11. A communication device, characterized in that, The communication device is used to interact with other devices via a communication line using USB PD messages. The communication device includes: a sampling module and a USB PD message decoding device as described in any one of claims 6 to 9. The sampling module is used to sample the USB PD signal transmitted on the communication line to obtain sampling data; The USB PD message decoding device is used to perform decoding processing based on the sampled data.