High-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface

By constructing a high-throughput electromyography signal communication method on the Type-C USB interface, the problem of high-speed communication between devices is solved, low-latency responsiveness and stability are achieved, and it is suitable for high-density electromyography signal acquisition systems.

CN119988295APending Publication Date: 2025-05-13SHANGHAI JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510177396.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The prior art has high delays during high-speed communication between devices, making it difficult to achieve accuracy and stability of data communication.

Method used

The high-throughput electromyography signal communication method based on the Type-C USB interface is adopted to ensure the low-latency response and stability of data transmission by building physical layer data transmission channels, defining data packet structures, designing response detection mechanisms and timeout retransmission mechanisms.

Benefits of technology

It realizes low latency response and stability of high-speed communication between devices, meets the real-time requirements of high-density electromyography signal acquisition, reduces packet loss rate, and improves the accuracy and reliability of communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988295A_ABST
    Figure CN119988295A_ABST
Patent Text Reader

Abstract

The invention discloses a high-throughput electromyographic signal communication and protocol construction method based on a Type-C USB interface, and relates to the technical field of man-machine interface signal communication.The method comprises the steps that a physical layer data transmission channel is constructed, uplink data are transmitted through a parallel port data line, and downlink data are transmitted through a serial port data line; defining a data packet structure; designing a response detection mechanism: formulating a verification standard of a data packet, verifying the data packet by a receiving end according to the verification standard after the sending end sends the data packet, and sending a communication state packet of which the packet label is ACK or NAK; the sending end resends the data packet after receiving the data packet of which the packet label is NAK; a timeout retransmission mechanism is designed; if the sending end does not receive the confirmation signal of the receiving end within the preset time, the sending end retransmits the data packet; and designing a communication management mechanism which comprises a data path establishment mechanism, a communication detection mechanism and a communication restart mechanism. According to the invention, low-delay and high-stability communication is realized, real-time and reliable operation of the system is ensured, and the requirement of high synchronism is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of human-machine interface signal communication, and in particular to a high-throughput electromyographic signal communication and protocol construction method based on a Type-C USB interface. Background Art

[0002] High-density surface electromyography is a common human-machine interface signal with high signal frequency, large number of channels and high synchronization requirements between channels. Its signal acquisition system generally uses a master-slave structure, with the host side implementing signal integration and the slave side implementing signal acquisition. Similar to most sensor systems, in order to ensure that the acquired signal meets the inter-channel synchronization standard, each slave needs to communicate with the host to achieve a low-latency response to the command downlink data; in order to ensure the integrity of the acquired signal, each slave component needs to communicate with the host to achieve stable transmission of the signal uplink data; in order to meet the high-speed acquisition of multi-channel signals, each slave needs to achieve high-speed communication with the host.

[0003] The host and slave of today's sensor system mostly communicate at the board level or between boards. The host and slave need to be in the same device, which restricts the scalability of the signal acquisition system and hinders its development. However, it is difficult to achieve low-latency response for existing inter-device communication protocols such as USB2.0, USB3.0, TCP, etc.; it is difficult to achieve transmission stability for protocols such as UDP and PPP; and it is difficult to achieve high-speed communication for protocols such as CAN and I2C.

[0004] Therefore, technicians in this field are committed to developing a high-throughput electromyographic signal communication and protocol construction method based on the Type-C USB interface, which can achieve high-speed communication between devices, greatly improve the synchronization of the system, and reduce the packet loss rate. Summary of the invention

[0005] In view of the above-mentioned defects of the prior art, the technical problem to be solved by the present invention is that the delay of high-speed communication between devices is high, and the accuracy and stability of data communication are difficult to achieve.

[0006] To achieve the above object, the present invention provides a high-throughput electromyographic signal communication and protocol construction method based on a Type-C USB interface, the method comprising:

[0007] Construct a physical layer data transmission channel; the data transmission channel includes an uplink data channel and a downlink data channel; the uplink data channel uses a parallel port data line to transmit uplink data from the slave end to the host end; the downlink data channel uses a serial port data line to transmit downlink data from the host end to the slave end;

[0008] Define a data packet structure; the data packet structure includes a preamble field, a header field, a packet label identification field, a packet sequence identification field, a packet length identification field, a data field, and a data check field; the packet label identification field is used to describe the data packet type, and the data packet type includes a communication status packet, a restart command packet, a command packet, a signal packet, a communication establishment packet, a heartbeat packet, and a communication synchronization packet;

[0009] Design response detection mechanism and timeout retransmission mechanism;

[0010] The response detection mechanism includes: formulating a verification standard for a data packet, when the sending end sends a data packet, the receiving end verifies the data packet according to the verification standard, if the verification passes, the receiving end sends a communication status packet with a packet mark of ACK, otherwise it sends a communication status packet with a packet mark of NAK; after the sending end receives the data packet with a packet mark of NAK, it resends the data packet; the verification standard includes packet mark identification field verification and data verification field verification;

[0011] The timeout retransmission mechanism includes: after the sending end sends a data packet, the sending end starts a timer and waits for a confirmation signal from the receiving end. If the confirmation signal from the receiving end is not received within a preset time, the sending end resends the data packet;

[0012] Design communication management mechanisms, including data path establishment mechanism, communication detection mechanism, and communication restart mechanism.

[0013] Furthermore, the constructing of a physical layer data transmission channel includes:

[0014] Using the Type-C USB interface, four pairs of differential lines are combined into a set of parallel port data lines, and one pair of differential lines is combined into a set of serial port data lines;

[0015] The SBU1 interface is configured as the TT1 data line, and the SBU2 interface is configured as the TT2 data line;

[0016] The TT1 data line is used as a transmission enable control line for uplink data;

[0017] The TT2 data line is used as a transmission enable control line for downlink data.

[0018] Furthermore, the preamble field is used for valid data positioning and clock synchronization; the packet header field is used for valid data verification; the packet sequence identification field is used for communication counting of signal packets; the packet length identification field is used to describe the length of the data packet; the data check field is used to perform CRC calculation on the data field, if the data packet is a signal packet, the CRC32 check algorithm is used, otherwise the CRC5 check algorithm is used; the packet label of the communication status packet includes: ACK, used to indicate that the received data packet has been received normally; NAK, used to indicate that the received data packet has not been received normally and needs to be resent.

[0019] Furthermore, the response detection mechanism also includes:

[0020] When the receiving end receives a data packet, it waits until it reaches the packet identification field and identifies whether the packet identification field meets the standard. If it meets the standard, it continues to receive subsequent data packets. If it does not meet the standard, it sends a communication status packet with a packet label of NAK.

[0021] When continuing to receive subsequent data packets to the data check field, determine whether the data check field meets the standard, if it meets the standard, send a communication status packet with a packet mark of ACK; if it does not meet the standard, send a communication status packet with a packet mark of NAK;

[0022] After the sender sends a data packet, it listens to the data packets sent by the receiver. If a communication status packet with a packet mark of ACK is received, it is determined that the transmission is successful; if a communication status packet with a packet mark of NAK is received, the data packet is resent.

[0023] Furthermore, the data path establishment mechanism includes:

[0024] The slave sends a communication establishment packet to the host;

[0025] After receiving the communication establishment packet sent by the slave, the host sends a communication status packet marked as ACK or NAK through the response detection mechanism. If the communication status packet marked as ACK is sent, it indicates that the communication is successfully established.

[0026] The slave side waits for the communication status packet sent by the host side through the timeout retransmission mechanism, and if the communication status packet is not received within the preset time, the slave side resends the communication establishment packet;

[0027] If the slave receives a communication status packet with a packet mark of NAK, it resends the communication establishment packet; if it receives a communication status packet with a packet mark of ACK, it indicates that the communication establishment is complete.

[0028] Furthermore, the communication detection mechanism includes:

[0029] The host periodically sends heartbeat packets to the slave;

[0030] After receiving the heartbeat packet, the slave sends a communication status packet marked as ACK or NAK through the response detection mechanism;

[0031] The host side waits for the communication status packet sent by the slave side through the timeout retransmission mechanism, and resends the heartbeat packet if the communication status packet is not received within the preset time;

[0032] If the host receives a communication status packet marked as NAK, it resends the heartbeat packet; if it receives a communication status packet marked as ACK, the heartbeat packet is considered to have been sent successfully.

[0033] If the number of times the host resends the heartbeat packet reaches a preset value, the host performs the communication restart mechanism.

[0034] Furthermore, the communication restart mechanism includes:

[0035] The host sends a restart command packet to the slave;

[0036] After receiving the restart command packet, the slave end sends a communication status packet marked as ACK or NAK through the response detection mechanism. If the communication status packet marked as ACK is sent, it indicates that the restart command is received successfully and the slave end is initialized;

[0037] The host side waits for the communication status packet sent by the slave side through the timeout retransmission mechanism. If the communication status packet is not received within the preset time, the restart command packet is resent;

[0038] If the host receives a communication status packet with a packet mark of NAK, it resends the restart command packet; if it receives a communication status packet with a packet mark of ACK, the host communication module is initialized.

[0039] Furthermore, the method further comprises an instruction data sending mechanism, wherein the instruction data sending mechanism comprises:

[0040] The host generates instruction data, encapsulates the instruction data into a command packet, and sends it to the slave through the downlink data channel;

[0041] After receiving the command packet, the slave sends a communication status packet marked as ACK or NAK through the response detection mechanism;

[0042] The host side waits for the communication status packet sent by the slave side through the timeout retransmission mechanism, and resends the command packet if the communication status packet is not received;

[0043] If the host receives a communication status packet marked as NAK, it resends the command packet; if it receives a communication status packet marked as ACK, it sends a communication synchronization packet to the slave.

[0044] If the host resends the command packet for a number of times that reaches a preset value, the host determines that the command packet has failed to be sent and reports the exception to the user.

[0045] Furthermore, the method further includes a signal data sending mechanism, and the signal data sending mechanism includes:

[0046] The slave terminal collects electromyographic signals and generates signal data, encapsulates the signal data into signal packets, and sends the signal packets to the host terminal through the uplink data channel;

[0047] After receiving the signal packet, the host sends a communication status packet marked as ACK or NAK through the response detection mechanism;

[0048] The slave side waits for the communication status packet sent by the host side through the timeout retransmission mechanism. If the communication status packet is not received within the preset time, the signal packet is resent; if a communication status packet marked as NAK is received, the signal packet is resent. If a communication status packet marked as ACK is received, the signal packet is sent successfully this time.

[0049] Furthermore, the host end and the slave end communicate synchronously based on a preset virtual clock frequency; the uplink data channel transmits 1 byte through 2 clock cycles, and the downlink data channel transmits 1 byte through 8 clock cycles.

[0050] Compared with the prior art, the present invention has at least the following beneficial technical effects:

[0051] 1. The timeout retransmission mechanism and response detection mechanism designed by the present invention ensure the low-delay responsiveness and stability of data transmission; meet the real-time requirements of high-density electromyographic signal acquisition and avoid signal distortion;

[0052] 2. The asymmetric design of uplink and downlink transmission in the present invention ensures high speed of data transmission and economical interface overhead;

[0053] 3. The data verification of the present invention adopts CRC5 and CRC32 verification algorithms. For shorter data packets, CRC5 verification reduces overhead and improves communication efficiency; for longer data packets, CRC32 verification enhances the reliability of data transmission; improves the accuracy of high-speed communication (over 100Mbps) between devices, and the packet loss rate is less than 0.3 parts per million;

[0054] 4. The present invention is based on a common data communication interface and does not require any other chip assistance. Only an FPGA chip is required to achieve 600Mbps stable upstream communication, thus reducing the cost of communication implementation;

[0055] 5. The communication detection mechanism and communication restart mechanism of the present invention can automatically detect and restore communication failures, realize self-correction and self-reconnection, and improve the stability of data communication.

[0056] The concept, specific structure and technical effects of the present invention will be further described below in conjunction with the accompanying drawings to fully understand the purpose, characteristics and effects of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is a schematic diagram of the physical layer interface design of a preferred embodiment of the present invention;

[0058] Figure 2 This is a schematic diagram of data transmission of a physical layer interface design of a preferred embodiment of the present invention

[0059] Figure 3 It is a schematic diagram of a data packet structure of a preferred embodiment of the present invention;

[0060] Figure 4 It is a schematic diagram of the response detection mechanism flow of a preferred embodiment of the present invention;

[0061] Figure 5 It is a flow chart of a data path establishment mechanism of a preferred embodiment of the present invention;

[0062] Figure 6 It is a flow chart of a communication detection mechanism of a preferred embodiment of the present invention;

[0063] Figure 7 It is a flow chart of a communication restart mechanism of a preferred embodiment of the present invention;

[0064] Figure 8 It is a flow chart of a command data sending mechanism of a preferred embodiment of the present invention;

[0065] Fig. 9 It is a flow chart of a signal data sending mechanism according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0066] The following describes several preferred embodiments of the present invention with reference to the drawings in the specification, so that the technical content is clearer and easier to understand. The present invention can be embodied in many different forms of embodiments, and the protection scope of the present invention is not limited to the embodiments mentioned in the text.

[0067] In the drawings, components with the same structure are indicated by the same numerical reference numerals, and components with similar structures or functions are indicated by similar numerical reference numerals. The size and thickness of each component shown in the drawings are arbitrarily shown, and the present invention does not limit the size and thickness of each component. In order to make the illustration clearer, the thickness of the components is appropriately exaggerated in some places in the drawings.

[0068] This embodiment provides a high-throughput electromyographic signal communication and protocol construction method based on a Type-C USB interface, including:

[0069] 1. Construct a physical layer data transmission channel

[0070] The data transmission channel includes an uplink data channel and a downlink data channel; the uplink data channel uses a parallel data line to transmit uplink data from the slave end to the host end; the downlink data channel uses a serial data line to transmit downlink data from the host end to the slave end.

[0071] like Figure 1 As shown, the data line based on the Type-C USB interface communication protocol includes:

[0072] The interface includes 24 pins. After flipping side A and side B, the order of pin definition is the same. The 12 pins on side A are defined as A1-GND, A2-D0+, A3-D0-, A4-PWR, A5-CC1, A6-D+, A7-D-, A8-SBU1, A9-PWR, A10-D1-, A11-D1+, and A12-GND; the 12 pins on side B are defined as B1-GND, B2-D3+, B3-D3-, B4-PWR, B5-CC2, B6-D+, B7-D-, B8-SBU2, B9-PWR, B10-D2-, B11-D2+, and B12-GND.

[0073] A pair of differential lines D0+ and D0- form the D0 data line; a pair of differential lines D1+ and D1- form the D1 data line; a pair of differential lines D2+ and D2- form the D2 data line; a pair of differential lines D3+ and D3- form the D3 data line. A pair of differential lines D+ and D- form the D data line. The commonly used SBU1 interface is configured as the TT1 data line, and the commonly used SBU2 interface is configured as the TT2 data line.

[0074] like Figure 2 As shown, the data transmission method based on the Type-C USB interface includes:

[0075] This embodiment is a point-to-point transmission protocol, and the two parties in communication are respectively called the host end and the slave end. The data sent from the slave end to the host end is defined as uplink data, and the data sent from the host end to the slave end is defined as downlink data. The basic unit of transmitted data is byte.

[0076] The D0 data line, D1 data line, D2 data line, and D3 data line form a group of parallel port data lines to transmit upstream data. The upstream data line transmits 1 byte through 2 clock cycles (CLK).

[0077] TT1 is used as the transmission enable control line for uplink data.

[0078] The D data lines form a group of serial port data lines to transmit downstream data. The downstream data lines transmit 1 byte through 8 clock cycles (CLK).

[0079] TT2 is used as the transmission enable control line for downlink data.

[0080] CLK is a virtual clock. A fixed communication frequency (eg, 150 MHz) needs to be determined by the host and the slave before communication to achieve stable communication between the host and the slave.

[0081] 2. Define the data packet structure

[0082] like Figure 3 As shown, the data packet structure includes a preamble field, a packet header field, a packet label identification field, a packet sequence identification field, a packet length identification field, a data field, and a data check field.

[0083] As shown in Table 1, the preamble field is used for valid data positioning and clock synchronization, the packet header field is used for valid data verification, the packet label identification field is used to describe the data packet type, the packet sequence identification field is used for communication counting of the signal packet, the packet length identification field is used to describe the length of the data packet, and the data check field is used to perform CRC calculation on the data field. If the data packet is a signal packet, the CRC32 check algorithm is used, otherwise the CRC5 check algorithm is used.

[0084] Table 1 Specific fields of communication protocol communication data packet

[0085]

[0086] As shown in Table 2, the data packet types include communication status packet, restart command packet, command packet, signal packet, communication establishment packet, heartbeat packet, and communication synchronization packet.

[0087] Table 2 Communication protocol communication data packet identification field identification and code description table

[0088]

[0089] The point-to-point communication protocol based on the Type-C USB interface of this embodiment supports full-duplex communication mode, and has the characteristics of simple communication, low latency, and fast transmission rate.

[0090] Based on the above communication physical layer design, this embodiment also formulates a response detection mechanism and a timeout retransmission mechanism to ensure stable and reliable data transmission.

[0091] 3. Response detection mechanism

[0092] Formulate verification standards for data packets, including: Standard 1, data packet format meets the declaration of packet identification field; Standard 2, data verification field meets the standard. Data packets that meet the above standards are defined as meeting the packet specification.

[0093] When the sender sends data, the slave waits for the completion of receiving the packet label identification field, and then verifies that the packet label identification field satisfies the legal value of the field, and then receives the data check field. After the data check field meets the packet specification, it sends a communication status packet with a packet label of ACK to implement data packet verification.

[0094] like Figure 4 As shown in the figure, description is made from the transmitting end and the receiving end respectively.

[0095] 1) Describe the sender

[0096] The sender sends a data packet and listens to the data packets sent by the receiver. When a data packet is received, if the received data packet is parsed and it is a communication status packet with a packet mark of ACK, the data packet transmission is judged to be successful; if it is a communication status packet with a packet mark of NAK, the data packet is resent.

[0097] 2) Describe the receiving end

[0098] When receiving a data packet from the machine, it waits until the packet identification field is received to identify whether the packet identification field meets the packet specification standard 1. If it meets the standard, it continues to receive subsequent data packets; if it does not meet the standard, it sends a communication status packet with a packet label of NAK.

[0099] After the subsequent data packets are received until the data check field is completed, it is determined whether the data check field meets the packet specification standard 2. If it meets the standard, a communication status packet with a packet mark of ACK is sent; if it does not meet the standard, a communication status packet with a packet mark of NAK is sent.

[0100] 3. Timeout retransmission mechanism

[0101] After the sending end sends a data packet, it starts a timer and waits for a confirmation signal from the receiving end. If the sending end does not receive a confirmation signal from the receiving end within a preset time, the sending end resends the data packet.

[0102] 4. Data channel establishment mechanism

[0103] The slave starts to send a communication establishment packet to the host. The host receives the data packet sent by the slave, and after verifying that it is a communication establishment packet, it sends a communication status packet marked as ACK to establish the data path. Figure 5 As shown, specifically including:

[0104] 1) Host-side description

[0105] After the communication module on the host side is started, it waits for the slave side to send a data packet. After receiving the data packet, it sends a communication status packet marked with ACK or NAK through the response detection mechanism. That is, when a data packet is received, it determines whether it meets the standard packet specification. If it does, it sends a communication status packet marked with ACK; if it does not, it sends a communication status packet marked with NAK. After parsing the received data packet as a communication establishment packet, the communication with the slave side is established.

[0106] 2) Describe from the slave side

[0107] After the communication module on the slave side is started, a communication establishment packet is sent to the host side, and a timer is set on the slave side. If the communication status packet sent by the host side is received within the preset time (for example, 50μs), the data packet sent by the host is parsed; if the communication status packet sent by the host side is not received within the preset time, the communication establishment packet is resent and the timer is reset.

[0108] If the slave receives a communication status packet with a packet mark of ACK, the communication is established successfully; if the slave receives a communication status packet with a packet mark of NAK, the communication establishment packet is resent and a timer is set on the slave.

[0109] 5. Communication detection mechanism

[0110] After the data path is completed, the host periodically sends heartbeat packets to detect the communication status, and triggers the slave restart mechanism when the communication is abnormal. In simple terms, the host sends a heartbeat packet to the slave, and the slave receives the data packet sent by the host. After verifying that it is a heartbeat packet, it sends a communication status packet marked as ACK to implement this communication detection. Figure 6 As shown, specifically including:

[0111] 1) Host-side description

[0112] After the host side establishes a data path with the slave side, the host side periodically (for example, 100ms) sends a heartbeat packet and sets a timer on the host side. If the communication status packet sent by the slave side is received within a preset time (for example, 50μs), the communication status packet sent by the slave side is parsed; if the communication status packet sent by the slave side is not received within the preset time, the heartbeat packet is resent, the host side timer is set to count 50μs, and the abnormal count of the host side abnormal counter is increased by one.

[0113] If the host receives a communication status packet marked as ACK, the heartbeat packet is considered to be sent successfully and the exception counter is reset to zero; if the host receives a communication status packet marked as NAK, the heartbeat packet is resent, the host resets the timer, and the exception count of the host exception counter is increased by one.

[0114] If the abnormal count of the host-side abnormal counter reaches a preset value (for example, 10 times), the host side sends a restart command packet to perform a communication restart mechanism.

[0115] 2) Describe from the slave side

[0116] After establishing a data path with the host, the slave waits for the data packet sent by the host. When receiving the data packet, it determines whether it meets the standard packet specification. If it meets the standard packet specification, it sends a communication status packet with a packet mark of ACK; if it does not meet the standard packet specification, it sends a communication status packet with a packet mark of NAK.

[0117] After the slave parses the received data packet as a heartbeat packet, the communication detection ends.

[0118] 6. Communication restart mechanism

[0119] When a communication problem occurs that cannot be self-checked, the host starts the communication restart. The host sends a restart command packet (data packet is 40 bytes of 0xFF) to the slave. The slave receives the data packet sent by the host, and after verifying that it is a restart command, it sends a communication status packet marked as ACK. The slave is reinitialized. The host waits for the slave to confirm that the restart command packet has been successfully received, and then reinitializes the host communication module. Figure 7 As shown, specifically including:

[0120] 1) Host-side description

[0121] The host sends a restart command packet and sets a timer on the host. If the data packet sent by the slave is received within a preset time (e.g., 50 μs), the data packet sent by the slave is parsed; if the data packet sent by the slave is not received within the preset time, the restart command packet is resent, and the host timer is set to count 50 μs.

[0122] If the host parses the received data packet as a communication status packet marked as ACK, the restart command packet is sent successfully and the host communication module is initialized; if not, the restart command packet is resent and the host resets the timer.

[0123] 2) Describe from the slave side

[0124] The slave receives the data packet sent by the host and determines whether it meets the standard packet specification. If it does, it sends a communication status packet with the packet marked as ACK; if it does not, it sends a communication status packet with the packet marked as NAK.

[0125] After the slave side parses the received data packet as a restart command packet, the slave side starts initialization.

[0126] 7. Command data sending mechanism

[0127] The host sends command data to the slave to implement the corresponding functions of the system. The host generates command data, encapsulates the command data into a command packet, and sends it to the slave through the downlink data channel. The slave receives the data packet sent by the host, and after verifying it as a command packet, sends a communication status packet marked with ACK to the host. After the host receives the data packet, after verifying it as a communication status packet marked with ACK, it sends a communication synchronization packet to the slave to implement the transmission of this command data. Figure 8 As shown, specifically including:

[0128] 1) Host-side description

[0129] After the host generates the instruction data, it sends a command packet to the slave and sets a timer on the host. If the data packet sent by the slave is received within a preset time (for example, 50 μs), the data packet sent by the slave is parsed. If the data packet sent by the slave is not received within the preset time, the command packet is resent and the timer is reset, and the count value of the exception counter is increased by one.

[0130] If the host parses the received data packet and finds it is a communication status packet marked as ACK, it sends a communication synchronization packet and sets a timer on the host; if not, it resends the command packet, resets the timer, and increases the count value of the exception counter by one.

[0131] After the communication synchronization packet is sent and the timer is set on the host side, if the data packet sent by the slave side is received within the preset time (for example, 100μs), the communication synchronization packet is resent; if the data packet sent by the slave side is not received within the preset time, the command packet is sent successfully.

[0132] When the count value of the exception counter reaches a preset value (eg, 10 times), the host determines that the command packet has failed to be sent and reports the exception to the user.

[0133] 2) Describe from the slave side

[0134] The slave side waits for the data packet sent by the host side, and when receiving the data packet, it determines whether it meets the standard packet specification. If it meets the standard, it sends a communication status packet marked as ACK and sets a timer on the host side; if it does not meet the standard, it sends a communication status packet marked as NAK.

[0135] Parse whether the received data packet is a command packet. If it is a command packet, the slave side notifies the execution component to parse the instructions in the command packet and execute them.

[0136] After the communication status packet marked as ACK is sent and the timer is set on the slave side, if the data packet sent by the host is received within a preset time (for example, 50μs), the data packet is parsed; if the data packet sent by the host is not received within the preset time, the communication status packet marked as ACK is resent and a timer is set on the slave side.

[0137] Analyze whether the received packet is a communication synchronization packet. If so, the command packet reception is judged to be successful. If not, resend the communication status packet marked as ACK and set a timer on the slave end.

[0138] 8. Signal data sending mechanism

[0139] The slave sends signal data to the host to implement the corresponding functions of the system. The slave collects electromyographic signals and generates signal data, encapsulates the signal data into signal packets, and sends them to the host through the uplink data channel. The host receives the data packet sent by the slave, and after verifying it as a signal packet, sends a communication status packet marked with ACK to the slave. After the slave receives the data packet, it will verify it as a communication status packet marked with ACK, and then the signal packet is judged to be sent successfully. Fig. 9 As shown, specifically including:

[0140] 1) Host-side description

[0141] The host waits for the data packet sent by the slave, and when receiving the data packet, it determines whether it meets the standard packet specification. If it does, it sends a communication status packet marked as ACK and sets a timer on the host; if it does not, it sends a communication status packet marked as NAK.

[0142] Analyze whether the received data packet is a signal packet. If it is a signal packet, store the signal packet and perform other subsequent operations.

[0143] 2) Describe from the slave side

[0144] After the signal data is generated, the slave sends a signal packet to the host and sets a timer on the slave. If the data packet sent by the host is received within a preset time (e.g., 50 μs), the received data packet is parsed; if the data packet sent by the host is not received within the preset time, the signal packet is resent.

[0145] If the received data packet is a communication status packet marked as ACK, the signal packet transmission is judged to be successful; if not, the signal packet is resent to the host end and a timer is set on the slave end.

[0146] After testing in actual communication projects, this embodiment has a response delay of less than 1μs from the slave end to the host end. Under the premise of 600Mbps uplink bandwidth and 150Mbps downlink bandwidth, it can achieve 24-hour continuous stable transmission, packet loss rate less than 0.3 parts per million, communication module does not crash, and the stability, high speed and low latency of the communication protocol meet the technical requirements. It has high applicability for sensor acquisition systems with high system response synchronization, high expansion requirements and high data transmission requirements.

[0147] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. A high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface, characterized in that: The method comprises: Construct a physical layer data transmission channel; the data transmission channel includes an uplink data channel and a downlink data channel; the uplink data channel uses a parallel port data line to transmit uplink data from the slave end to the host end; the downlink data channel uses a serial port data line to transmit downlink data from the host end to the slave end; Define a data packet structure; the data packet structure includes a preamble field, a header field, a packet label identification field, a packet sequence identification field, a packet length identification field, a data field, and a data check field; the packet label identification field is used to describe the data packet type, and the data packet type includes a communication status packet, a restart command packet, a command packet, a signal packet, a communication establishment packet, a heartbeat packet, and a communication synchronization packet; Design response detection mechanism and timeout retransmission mechanism; The response detection mechanism includes: formulating a verification standard for a data packet, when the sending end sends a data packet, the receiving end verifies the data packet according to the verification standard, if the verification passes, the receiving end sends a communication status packet with a packet mark of ACK, otherwise it sends a communication status packet with a packet mark of NAK; after the sending end receives the data packet with a packet mark of NAK, it resends the data packet; the verification standard includes packet mark identification field verification and data verification field verification; The timeout retransmission mechanism includes: after the sending end sends a data packet, the sending end starts a timer and waits for a confirmation signal from the receiving end. If the confirmation signal from the receiving end is not received within a preset time, the sending end resends the data packet; Design communication management mechanisms, including data path establishment mechanism, communication detection mechanism, and communication restart mechanism.

2. The high-throughput electromyographic signal communication and protocol construction method based on the Type-C USB interface as claimed in claim 1, characterized in that: The construction of a physical layer data transmission channel comprises: Using the Type-C USB interface, four pairs of differential lines are combined into a set of parallel port data lines, and one pair of differential lines is combined into a set of serial port data lines; The SBU1 interface is configured as the TT1 data line, and the SBU2 interface is configured as the TT2 data line; The TT1 data line is used as a transmission enable control line for uplink data; The TT2 data line is used as a transmission enable control line for downlink data.

3. The high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface as claimed in claim 1, characterized in that: The preamble field is used for valid data positioning and clock synchronization; the packet header field is used for valid data verification; the packet sequence identification field is used for communication counting of signal packets; the packet length identification field is used to describe the length of the data packet; the data check field is used to perform CRC calculation on the data field, and if the data packet is a signal packet, the CRC32 check algorithm is used, otherwise the CRC5 check algorithm is used; The packet mark of the communication status packet includes: ACK, which is used to indicate that the received data packet has been received normally; NAK is used to indicate that the received data packet was not received normally and needs to be resent.

4. The high-throughput electromyographic signal communication and protocol construction method based on the Type-C USB interface as claimed in claim 1, characterized in that: The response detection mechanism also includes: When the receiving end receives a data packet, it waits until it reaches the packet identification field and identifies whether the packet identification field meets the standard. If it meets the standard, it continues to receive subsequent data packets. If it does not meet the standard, it sends a communication status packet with a packet label of NAK. When continuing to receive subsequent data packets to the data check field, determine whether the data check field meets the standard, if it meets the standard, send a communication status packet with a packet mark of ACK; if it does not meet the standard, send a communication status packet with a packet mark of NAK; After the sender sends a data packet, it listens to the data packets sent by the receiver. If a communication status packet with a packet mark of ACK is received, it is determined that the transmission is successful; if a communication status packet with a packet mark of NAK is received, the data packet is resent.

5. The high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface as claimed in claim 1, characterized in that: The data path establishment mechanism includes: The slave sends a communication establishment packet to the host; After receiving the communication establishment packet sent by the slave, the host sends a communication status packet marked as ACK or NAK through the response detection mechanism. If the communication status packet marked as ACK is sent, it indicates that the communication is successfully established. The slave side waits for the communication status packet sent by the host side through the timeout retransmission mechanism, and if the communication status packet is not received within the preset time, the slave side resends the communication establishment packet; If the slave receives a communication status packet with a packet mark of NAK, it resends the communication establishment packet; if it receives a communication status packet with a packet mark of ACK, it indicates that the communication establishment is complete.

6. The high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface as claimed in claim 1, characterized in that: The communication detection mechanism includes: The host periodically sends heartbeat packets to the slave; After receiving the heartbeat packet, the slave sends a communication status packet marked as ACK or NAK through the response detection mechanism; The host side waits for the communication status packet sent by the slave side through the timeout retransmission mechanism, and resends the heartbeat packet if the communication status packet is not received within the preset time; If the host receives a communication status packet marked as NAK, it resends the heartbeat packet; if it receives a communication status packet marked as ACK, the heartbeat packet is considered to have been sent successfully. If the number of times the host resends the heartbeat packet reaches a preset value, the host performs the communication restart mechanism.

7. The high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface as claimed in claim 1, characterized in that: The communication restart mechanism includes: The host sends a restart command packet to the slave; After receiving the restart command packet, the slave end sends a communication status packet marked as ACK or NAK through the response detection mechanism. If the communication status packet marked as ACK is sent, it indicates that the restart command is received successfully and the slave end is initialized; The host side waits for the communication status packet sent by the slave side through the timeout retransmission mechanism. If the communication status packet is not received within the preset time, the restart command packet is resent; If the host receives a communication status packet with a packet mark of NAK, it resends the restart command packet; if it receives a communication status packet with a packet mark of ACK, the host communication module is initialized.

8. The high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface as claimed in claim 1, characterized in that: The method further includes an instruction data sending mechanism, wherein the instruction data sending mechanism includes: The host generates instruction data, encapsulates the instruction data into a command packet, and sends it to the slave through the downlink data channel; After receiving the command packet, the slave sends a communication status packet marked as ACK or NAK through the response detection mechanism; The host side waits for the communication status packet sent by the slave side through the timeout retransmission mechanism, and resends the command packet if the communication status packet is not received; If the host receives a communication status packet marked as NAK, it resends the command packet; if it receives a communication status packet marked as ACK, it sends a communication synchronization packet to the slave. If the host resends the command packet for a number of times that reaches a preset value, the host determines that the command packet has failed to be sent and reports the exception to the user.

9. The high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface as claimed in claim 1, characterized in that: The method further includes a signal data sending mechanism, the signal data sending mechanism including: The slave terminal collects electromyographic signals and generates signal data, encapsulates the signal data into signal packets, and sends the signal packets to the host terminal through the uplink data channel; After receiving the signal packet, the host sends a communication status packet marked as ACK or NAK through the response detection mechanism; The slave side waits for the communication status packet sent by the host side through the timeout retransmission mechanism. If the communication status packet is not received within the preset time, the signal packet is resent; if a communication status packet marked as NAK is received, the signal packet is resent. If a communication status packet marked as ACK is received, the signal packet is sent successfully this time.

10. The high-throughput electromyographic signal communication and protocol construction method based on Type-C USB interface according to claim 1, characterized in that: The host end and the slave end perform synchronous communication based on a preset virtual clock frequency; the uplink data channel transmits 1 byte through 2 clock cycles, and the downlink data channel transmits 1 byte through 8 clock cycles.