SPI protocol and multi-channel PD protocol conversion method and circuit system
Patent Information
- Application Number
- CN202510053490.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art lacks a mature solution that can effectively realize the conversion between the SPI protocol and the multi-channel PD protocol, especially in multi-channel application scenarios, it is difficult to meet the data interaction needs of different PD devices.
Provide a SPI protocol and multi-channel PD protocol conversion method, which transmits data frames through the host computer to perform SPI protocol data interaction, and completes the SPI protocol conversion into PD protocol or vice versa, and uses the control module to realize the switching of PD channels and the status monitoring and error detection of data frames to ensure the reliability of data transmission.
The two-way conversion between the SPI protocol and the multi-channel PD protocol is realized, which meets the data interaction requirements of different PD devices in a multi-channel environment and improves the reliability and adaptability of data transmission.
Smart Images

Figure CN119892944A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of communication protocol conversion, and discloses a SPI protocol and a multi-channel PD protocol conversion method and a circuit system. Background Art
[0002] With the development of electronic products and embedded systems, different communication protocols are widely used in different scenarios. The SPI (Serial Peripheral Interface) interface is widely used in master-slave communication scenarios due to its high speed and simple physical layer structure. Compared with other common serial communication protocols, such as I2C (Inter-Integrated Circuit) and UART (Universal Asynchronous Receiver Transmitter), SPI uses four wires to achieve full-duplex communication. Its unique advantage is that it can transmit data uninterruptedly, send or receive any number of bits in a continuous stream, and can achieve a higher data transmission rate than I2C.
[0003] In recent years, the USB Power Delivery (PD) protocol has become an important transmission protocol between power adapters and smart terminals as interfaces such as USB Type-C are widely used for power transmission and communication management of high-power devices. Especially in multi-channel application scenarios, general-purpose MCUs (Microcontroller Units) often cannot meet the needs due to the limitations of the number of channels and CC port circuit system structure, and customized MCUs will also increase costs and hardware complexity.
[0004] Because general MCUs can basically implement SPI communication, and SPI is a de facto standard with no official standard. It is known that SPI can reach 50Mbps, while the PD communication protocol stipulates that its communication rate is 300Kbps (±10%). SPI far meets the rate requirements of PD communication, so the conversion between SPI protocol and PD protocol is a reliable solution for implementing multi-channel applications. These protocols each have different physical layer and protocol layer structures, so there are complex protocol conversion requirements. At present, there is a lack of mature solutions on the market that can achieve effective conversion between SPI and PD protocols, especially multi-channel PD protocols.
[0005] For example, the existing patent with the publication number CN118174837A relates to a method for generating a BMC communication clock frequency based on the USB-PD protocol and a USB-PD device. The method first determines the logic flip cycle of the received BMC signal, then obtains the number of rising edges and falling edges of the BMC signal received within n logic flip cycles, obtains the first edge number, and then obtains the number of rising edges or falling edges of the system clock signal within n logic flip cycles, obtains the second edge number, and then determines the mapping coefficient between the system clock frequency and the signal frequency of the received BMC signal according to the first edge number and the second edge number, and finally divides the system clock according to the mapping coefficient to determine the BMC communication clock frequency of the USB-PD device. Based on the received BMC signal, the method generates the BMC communication clock frequency of the USB-PD device without calibrating the system clock frequency of the USB-PD device, so that the frequency deviation of the BMC signals of the sender and receiver in the USB-PD message is small, the deviation tolerance is enhanced, and the cost is low.
[0006] The above patent only revolves around the BMC communication clock frequency generation of the USB-PD device, and only involves processing operations related to the clock frequency. It does not reflect the corresponding support mechanism for multi-channel PD device communication. In the scenario where multiple USB-PD devices need to communicate through different channels, it is difficult to effectively cope with it. Secondly, the above patent mainly focuses on determining the communication clock frequency based on the BMC signal and the system clock signal. It does not involve the complete processing logic of the data frame in the process of different protocol conversion and transmission, and lacks the ability to interact with multiple instructions of the host computer. Summary of the invention
[0007] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0008] In order to solve the above technical problems, the main purpose of the present invention is to provide a method for converting an SPI protocol to a multi-channel PD protocol, comprising:
[0009] S1. If the conversion is from SPI protocol to PD protocol, the host computer sends data frames to perform SPI protocol data interaction;
[0010] S2, complete the conversion of SPI protocol to PD protocol;
[0011] S3, if it is a conversion from PD protocol to SPI protocol, selecting one from the multiple PD devices and receiving a data frame from the PD device;
[0012] S4, complete the conversion of PD protocol to SPI protocol.
[0013] As a preferred solution of the SPI protocol and multi-channel PD protocol conversion method of the present invention, wherein:
[0014] The SPI protocol to PD protocol conversion method includes:
[0015] S101: receiving a data frame sent by the host computer from the SPI interface;
[0016] S102: Parse the SPI data frame and identify the operation instruction sent by the host computer;
[0017] S103: Convert the data frame in the SPI protocol into a data frame format that complies with the PD protocol;
[0018] S104: Send the converted PD protocol format data frame to the PD device through the selected channel.
[0019] As a preferred solution of the SPI protocol and multi-channel PD protocol conversion method of the present invention, wherein:
[0020] The method for converting the PD protocol to the SPI protocol includes:
[0021] S201, selecting one of the plurality of PD devices and receiving a data frame from the PD device;
[0022] S202, decoding and verifying the PD protocol data frame;
[0023] S203, extracting the protocol layer data in the PD data frame, re-encapsulating it into an SPI protocol data frame, and recording the physical layer information;
[0024] S204, the host computer reads the physical layer information and protocol layer data through the SPI interface.
[0025] As a preferred solution of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention, wherein:
[0026] Host computer, used to send data frames;
[0027] SPI interface module, used to receive and send SPI protocol data frames;
[0028] A control module, including PD channel switching, PD protocol physical layer configuration, data frame status monitoring and error detection, wherein the PD channel switching is used to select a specific communication channel in a multi-channel PD device, the PD protocol physical layer configuration is used to control registers and control hardware circuit systems, the data frame status monitoring is used to monitor the status of data frames received by the SPI interface module and data frames to be subsequently sent to the PD interface module, and the error detection is used to calculate and verify the valid data part in the data frame;
[0029] PD interface module, used to receive and send PD protocol data frames and determine the integrity of PD protocol data frames;
[0030] The protocol conversion module is used to complete the bidirectional conversion from SPI protocol to PD protocol and from PD protocol to SPI protocol.
[0031] As a preferred solution of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention, wherein:
[0032] The SPI interface module supports standard SPI data transmission rate;
[0033] The SPI protocol data frame adopts a combination of instructions, addresses and data, including a chip selection signal specified in the SPI protocol, a synchronous clock signal specified in the SPI protocol, a slave output signal specified in the SPI protocol and a host output signal specified in the SPI protocol.
[0034] As a preferred solution of the SPI protocol and multi-channel PD protocol conversion method of the present invention, wherein:
[0035] The control module responds to the instruction from the host computer through the SPI interface module, and the instruction from the host computer includes sending a PD protocol data frame and receiving a PD protocol data frame.
[0036] As a preferred solution of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention, wherein:
[0037] The PD protocol data frame includes physical layer data and protocol layer data;
[0038] The physical layer data consists of a Preamble header, a SOP, a CRC32 checksum and an EOP;
[0039] The protocol layer data consists of a message header and protocol data.
[0040] As a preferred solution of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention, wherein:
[0041] The protocol conversion module includes SPI data frame parsing and repackaging as well as PD data frame parsing and repackaging.
[0042] As a preferred solution of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention, wherein:
[0043] The SPI protocol to PD protocol conversion method includes:
[0044] S101, the protocol conversion module obtains the protocol layer data from the control module;
[0045] S102, performing CRC32 check on the protocol layer data, and adding the CRC32 check value to the end of the data frame;
[0046] S103, selecting the corresponding SOP type and the EOP according to the configuration of the physical layer in the control module, and adding them to the head and tail of the data frame;
[0047] S104: Send the data frame to the PD interface module and drive it to the selected PD device.
[0048] The PD protocol to SPI protocol conversion method includes:
[0049] S201, the protocol conversion module receives a PD protocol data frame from the PD interface module;
[0050] S202, perform CRC32 check on the protocol layer data, and store the check value result and data integrity status of the PD protocol data frame in the status register of the control module;
[0051] S203, sending the SOP type, handshake status and protocol layer data in the PD protocol data frame to the control module for temporary storage, and notifying the host computer that the data has been prepared.
[0052] Beneficial effects of the present invention:
[0053] The present invention provides scientific decision-making support for city managers by setting up a monitoring module to analyze big data in real time, including urban environmental data, citizen behavior data, etc. Through data-driven decision-making, the city's operating status can be more accurately understood, and civilized city construction plans and measures can be formulated in a targeted manner;
[0054] The present invention has a relatively single function for comprehensive conversion from SPI protocol to PD protocol and from PD protocol to SPI protocol, and has poor adaptability when facing complex application scenarios that require conversion of different protocols. The present invention proposes a related solution for communication with multi-channel PD devices, and selects a specific communication channel by implementing operations such as switching of PD channels through a control module to meet the data interaction requirements of different PD devices in a multi-channel environment. The control module designed by the present invention has the functions of status monitoring and error detection of data frames, can perform status monitoring on data frames received by the SPI interface module and data frames to be subsequently sent to the PD interface module, and can also perform calculation verification on the valid data part in the data frame, so as to ensure the reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0056] Figure 1 A topological diagram of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention;
[0057] Figure 2 The present invention provides an SPI protocol and multi-channel PD protocol conversion circuit system SPI protocol and multi-channel protocol conversion circuit;
[0058] Figure 3 The present invention provides a method for converting an SPI protocol and a multi-channel PD protocol, including a step of converting an SPI protocol to a PD protocol;
[0059] Figure 4 The present invention provides a SPI protocol and a multi-channel PD protocol conversion method, which includes a PD protocol to SPI protocol conversion step;
[0060] Figure 5 It is a SPI protocol data frame topology diagram of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention;
[0061] Figure 6 A composition topology diagram of a PD protocol data frame of an SPI protocol and a multi-channel PD protocol conversion circuit system of the present invention;
[0062] Figure 7 A flow chart of a method for converting an SPI protocol to a multi-channel PD protocol according to the present invention;
[0063] Figure 8 This is a composition diagram of a SPI protocol and multi-channel PD protocol conversion circuit system of the present invention. DETAILED DESCRIPTION
[0064] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0065] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0066] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0067] Embodiment 1:
[0068] like Figure 3 As shown, a method for converting an SPI protocol to a multi-channel PD protocol includes:
[0069] S1. If the conversion is from SPI protocol to PD protocol, the host computer sends data frames to perform SPI protocol data interaction;
[0070] S2, complete the conversion of SPI protocol to PD protocol;
[0071] The SPI protocol to PD protocol conversion method includes:
[0072] like Figure 4 As shown, S101: receiving a data frame sent by the host computer from the SPI interface;
[0073] S102: Parse the SPI data frame and identify the operation instruction sent by the host computer;
[0074] S103: Convert the data frame in the SPI protocol into a data frame format that complies with the PD protocol;
[0075] S104: sending the converted PD protocol format data frame to the PD device through the selected channel;
[0076] S3, if it is a conversion from PD protocol to SPI protocol, selecting one from the multiple PD devices and receiving a data frame from the PD device;
[0077] S4, complete the conversion of PD protocol into SPI protocol;
[0078] like Figure 7 As shown, the PD protocol to SPI protocol conversion method includes:
[0079] S201, selecting one of the plurality of PD devices and receiving a data frame from the PD device;
[0080] S202, decoding and verifying the PD protocol data frame;
[0081] S203, extracting the protocol layer data in the PD data frame, re-encapsulating it into an SPI protocol data frame, and recording the physical layer information;
[0082] S204, the host computer reads the physical layer information and protocol layer data through the SPI interface.
[0083] Embodiment 2:
[0084] like Figure 8 As shown, a SPI protocol and multi-channel PD protocol conversion circuit system includes, a SPI protocol and multi-channel PD protocol conversion circuit system. The conversion circuit between the SPI protocol and the multi-channel PD protocol includes: an SPI interface module, used to receive and send SPI protocol data frames, supporting standard SPI data transmission rate; a PD interface module, used to receive and send PD protocol data frames, completing 4B / 5B encoding and decoding, BMC encoding and decoding and CRC32 verification operations required by the PD protocol; a protocol conversion module, including parsing and repackaging of SPI data frames and PD data frames, realizing bidirectional conversion from SPI protocol to PD protocol, and from PD protocol to SPI protocol; a control module, responsible for global control, including switching and configuration of PD channels, status monitoring and error detection of data frames, to ensure stable data transmission
[0085] like Figure 1 As shown, the host computer 101 and multiple PD devices 103 perform data exchange through the SPI protocol and the multi-channel PD protocol conversion circuit 102, which solves the need to use a universal host computer to communicate with multiple PD devices;
[0086] like Figure 2As shown, the SPI interface module 201 is used to receive and send SPI protocol data frames and supports standard SPI data transmission rate; the control module 202 is responsible for global control, including the switching of PD channels, the configuration of the PD protocol physical layer, the status monitoring and error detection of data frames, and ensures stable data transmission; the PD interface module 203 is used to receive and send PD protocol data frames, complete the 4B / 5B encoding and decoding and BMC encoding and decoding operations required by the PD protocol, and judge the integrity of the PD protocol data frames; the protocol conversion module 204 includes the parsing and repackaging of SPI data frames and PD data frames, and realizes the bidirectional conversion from SPI protocol to PD protocol and from PD protocol to SPI protocol;
[0087] Furthermore, the PD decoding interface also includes a first 4B / 5B decoding 2031, a first BMC decoding 2032, a second 4B / 5B decoding 2033, and a second BMC decoding 2034;.
[0088] Host computer, used to send data frames;
[0089] SPI interface module, used to receive and send SPI protocol data frames;
[0090] The SPI interface module supports standard SPI data transmission rate;
[0091] The SPI protocol data frame adopts a combination of instructions, addresses and data, including a chip select signal specified in the SPI protocol, a synchronous clock signal specified in the SPI protocol, a slave output signal specified in the SPI protocol and a host output signal specified in the SPI protocol;
[0092] The SPI interface module 201 is used to receive and send SPI protocol data frames, and the SPI interface module 201 needs to support the standard SPI data transmission rate. Since SPI belongs to a synchronous serial bus, the rate supported by the circuit is determined by the rate of the host computer 101 and the limit of the circuit components.
[0093] like Figure 5 As shown, the SPI protocol data frame is usually composed of instruction 501, address 502 and data 503. CS is the chip select signal specified in the SPI protocol, CK is the synchronous clock signal specified in the SPI protocol, MISO is the slave output signal specified in the SPI protocol, and MOSI is the master output signal specified in the SPI protocol.
[0094] A control module, including PD channel switching, PD protocol physical layer configuration, data frame status monitoring and error detection, wherein the PD channel switching is used to select a specific communication channel in a multi-channel PD device, the PD protocol physical layer configuration is used to control registers and control hardware circuit systems, the data frame status monitoring is used to monitor the status of data frames received by the SPI interface module and data frames to be subsequently sent to the PD interface module, and the error detection is used to calculate and verify the valid data part in the data frame;
[0095] The control module responds to an instruction from the host computer through the SPI interface module, and the instruction from the host computer includes sending a PD protocol data frame and receiving a PD protocol data frame;
[0096] The control module 202 is responsible for global control, including switching of PD channels, configuration of the PD protocol physical layer, status monitoring and error detection of data frames, to ensure stable data transmission. The control module 202 responds to the instruction from the host computer 101 through the SPI interface module 201. If a PD protocol data frame is to be sent, the host computer 101 first configures the PD channel to be sent, then configures the type of SOP, and finally sends the protocol layer data to the control module 202 for temporary storage. When the channel is idle, the physical layer configuration and protocol layer data are forwarded to the protocol conversion module 204 and the PD interface module 203 for sending the PD protocol data frame; if a PD protocol data frame is to be received, the PD device 103 first sends the PD protocol data frame, then the protocol layer data and the physical layer configuration are extracted after passing through the PD interface module 203 and the protocol conversion module 204, and finally the protocol layer data is sent to the control module 202 for temporary storage, and the verification results of the physical layer configuration and the data frame are stored in the register of the control module 202, and the host computer 101 is notified to read through the SPI interface module 201;
[0097] PD interface module, used to receive and send PD protocol data frames and determine the integrity of PD protocol data frames;
[0098] The PD protocol data frame includes physical layer data and protocol layer data;
[0099] The physical layer data consists of a Preamble header, a SOP, a CRC32 checksum and an EOP;
[0100] The protocol layer data consists of a message header and protocol data
[0101] Protocol conversion module, used to complete the bidirectional conversion from SPI protocol to PD protocol and from PD protocol to SPI protocol;
[0102] The PD interface module 203 is used to receive and send PD protocol data frames and determine the integrity of the PD protocol data frames.
[0103] like Figure 6 As shown, the PD protocol data frame includes physical layer data 601 and protocol layer data 602, wherein the physical layer data 601 is composed of a Preamble header 6011, a SOP 6012, a CRC32 check value 6013 and an EOP 6014, and the protocol layer data 602 is composed of a message header 6021 and protocol data 6022. The Preamble header 6011 is composed of a continuous 64-bit sequence of 01s, and is not 4B / 5B encoded. In the PD protocol communication process, it is removed and added by the BMC decoding 2032 and BMC encoding 2034 modules; the SOP 6012 is the start mark of the data frame. There are multiple types of SOP 6012, which are used in the signal sent to the interface and the signal sent to the cable, respectively, and are 4B / 5B encoded; the CRC32 check value 6013 is the check result of the message header 6021 and the protocol data 6022, and is 4B / 5B encoded; the EOP 6014 is the end mark of the data frame, and is 4B / 5B encoded;
[0104] The protocol conversion module includes SPI data frame parsing and repackaging as well as PD data frame parsing and repackaging;
[0105] The SPI protocol to PD protocol conversion method includes:
[0106] S101, the protocol conversion module obtains the protocol layer data from the control module;
[0107] S102, performing CRC32 check on the protocol layer data, and adding the CRC32 check value to the end of the data frame;
[0108] S103, selecting the corresponding SOP type and the EOP according to the configuration of the physical layer in the control module, and adding them to the head and tail of the data frame;
[0109] S104: Send the data frame to the PD interface module and drive it to the selected PD device.
[0110] The PD protocol to SPI protocol conversion method includes:
[0111] S201, the protocol conversion module receives a PD protocol data frame from the PD interface module;
[0112] S202, perform CRC32 check on the protocol layer data, and store the check value result and data integrity status of the PD protocol data frame in the status register of the control module;
[0113] S203, sending the SOP type, handshake status and protocol layer data in the PD protocol data frame to the control module for temporary storage, and notifying the host computer that the data has been prepared;
[0114] The protocol conversion module 204 includes parsing and repackaging of SPI data frames and PD data frames, and realizes bidirectional conversion from SPI protocol to PD protocol and from PD protocol to SPI protocol. When converting from SPI protocol to PD protocol, first, the protocol conversion module 204 obtains the protocol layer data 602 from the control module 202, and then performs CRC32 check on the protocol layer data 602, and adds the CRC32 check value to the end of the data frame, and then, according to the configuration of the physical layer in the control module 202, the corresponding SOP6012 type and EOP6014 are selected, and added to the head and tail of the data frame, and finally, the data frame is sent to the PD interface module 203 to drive it to the selected PD device 103; when the PD protocol to During SPI protocol conversion, first, the protocol conversion module 204 receives the PD protocol data frame from the PD interface module 203. At this time, the data frame has removed the Preamble header 6011 part. Secondly, the CRC32 check is performed on the protocol layer data 602, and the check value result and data integrity status of the PD protocol data frame are stored in the status register of the control module 202. Finally, the SOP6012 type, handshake status and protocol layer data in the PD protocol data frame are sent to the control module 202 for temporary storage, and the host computer is notified that the data is ready.
[0115] Importantly, it should be noted that the construction and arrangement of the present application shown in a plurality of different exemplary embodiments are only exemplary. Although only two embodiments are described in detail in this disclosure, it should be readily understood by those who refer to this disclosure that many modifications are possible, for example, the size, scale, structure, shape and ratio of various elements, and parameter values (e.g., temperature, pressure, etc.), installation arrangement, use of materials, color, directional changes, etc., without substantially departing from the novel teachings and advantages of the subject matter described in the application. For example, the element shown as integrally formed can be composed of multiple parts or elements, the position of the element can be inverted or otherwise changed, and the nature or number or position of the discrete element can be changed or changed. Therefore, all such modifications are intended to be included in the scope of the present invention. The order or sequence of any process or method step can be changed or reordered according to an alternative embodiment. Any "device plus function" clause is intended to cover the structure of the execution function described in this article, and is not only structurally equivalent but also equivalent structure. Without departing from the scope of the present invention, other replacements, modifications, changes and omissions can be made in the design, operating conditions and arrangement of the exemplary embodiment. Therefore, the invention is not limited to a specific embodiment, but extends to numerous modifications still falling within the scope of the appended claims.
[0116] Additionally, in order to provide a concise description of exemplary embodiments, all features of an actual embodiment (ie, those features that are not relevant to the best mode presently contemplated for carrying out the invention or those that are not relevant to implementing the invention) may not be described.
[0117] It should be understood that in the development of any actual implementation, as in any engineering or design project, numerous implementation-specific decisions may be made. Such a development effort may be complex and time-consuming, but for those of ordinary skill having the benefit of this disclosure, the development effort will be a routine task of design, fabrication, and production without undue experimentation.
[0118] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for converting an SPI protocol to a multi-channel PD protocol, characterized in that: include: S1. If the conversion is from SPI protocol to PD protocol, the host computer sends data frames to perform SPI protocol data interaction; S2, complete the conversion of SPI protocol to PD protocol; S3, if it is a conversion from PD protocol to SPI protocol, selecting one from the multiple PD devices and receiving a data frame from the PD device; S4, complete the conversion of PD protocol to SPI protocol.
2. The method for converting an SPI protocol to a multi-channel PD protocol according to claim 1, characterized in that: The SPI protocol to PD protocol conversion method includes: S101: receiving a data frame sent by the host computer from the SPI interface; S102: Parse the SPI data frame and identify the operation instruction sent by the host computer; S103: Convert the data frame in the SPI protocol into a data frame format that complies with the PD protocol; S104: Send the converted PD protocol format data frame to the PD device through the selected channel.
3. The method for converting an SPI protocol to a multi-channel PD protocol according to claim 2, characterized in that: The method for converting the PD protocol to the SPI protocol includes: S201, selecting one of the plurality of PD devices and receiving a data frame from the PD device; S202, decoding and verifying the PD protocol data frame; S203, extracting the protocol layer data in the PD data frame, re-encapsulating it into an SPI protocol data frame, and recording the physical layer information; S204, the host computer reads the physical layer information and protocol layer data through the SPI interface.
4. A SPI protocol and multi-channel PD protocol conversion circuit system, based on a SPI protocol and multi-channel PD protocol conversion method according to any one of claims 1 to 3, characterized in that: include: Host computer, used to send data frames; SPI interface module, used to receive and send SPI protocol data frames; A control module, including PD channel switching, PD protocol physical layer configuration, data frame status monitoring and error detection, wherein the PD channel switching is used to select a specific communication channel in a multi-channel PD device, the PD protocol physical layer configuration is used to control registers and control hardware circuit systems, the data frame status monitoring is used to monitor the status of data frames received by the SPI interface module and data frames to be subsequently sent to the PD interface module, and the error detection is used to calculate and verify the valid data part in the data frame; PD interface module, used to receive and send PD protocol data frames and determine the integrity of PD protocol data frames; The protocol conversion module is used to complete the bidirectional conversion from SPI protocol to PD protocol and from PD protocol to SPI protocol.
5. The SPI protocol and multi-channel PD protocol conversion circuit system according to claim 4, characterized in that: The SPI interface module supports standard SPI data transmission rate; The SPI protocol data frame adopts a combination of instructions, addresses and data, including a chip selection signal specified in the SPI protocol, a synchronous clock signal specified in the SPI protocol, a slave output signal specified in the SPI protocol and a host output signal specified in the SPI protocol.
6. The SPI protocol and multi-channel PD protocol conversion circuit system according to claim 5, characterized in that: The control module responds to the instruction from the host computer through the SPI interface module, and the instruction from the host computer includes sending a PD protocol data frame and receiving a PD protocol data frame.
7. The method for converting an SPI protocol to a multi-channel PD protocol according to claim 6, characterized in that: The PD protocol data frame includes physical layer data and protocol layer data; The physical layer data consists of a Preamble header, a SOP, a CRC32 checksum and an EOP; The protocol layer data consists of a message header and protocol data.
8. The SPI protocol and multi-channel PD protocol conversion circuit system according to claim 7, characterized in that: The protocol conversion module includes SPI data frame parsing and re-encapsulation and PD data frame parsing and re-encapsulation.
9. The SPI protocol and multi-channel PD protocol conversion circuit system according to claim 8, characterized in that: The SPI protocol to PD protocol conversion method includes: S101, the protocol conversion module obtains the protocol layer data from the control module; S102, performing CRC32 check on the protocol layer data, and adding the CRC32 check value to the end of the data frame; S103, selecting the corresponding SOP type and the EOP according to the configuration of the physical layer in the control module, and adding them to the head and tail of the data frame; S104: Send the data frame to the PD interface module and drive it to the selected PD device. The PD protocol to SPI protocol conversion method includes: S201, the protocol conversion module receives a PD protocol data frame from the PD interface module; S202, perform CRC32 check on the protocol layer data, and store the check value result and data integrity status of the PD protocol data frame in the status register of the control module; S203, sending the SOP type, handshake status and protocol layer data in the PD protocol data frame to the control module for temporary storage, and notifying the host computer that the data has been prepared.
Citation Information
Patent Citations
BMC communication clock frequency generation method based on USB-PD protocol and UPB-PD device
CN118174837A
Cited By
USB PD protocol verification system and method based on UVM
CN121418330A