A data transmission method and control system for an embedded remote experiment platform
By building temporary buffers and interface buffers on the embedded remote experimental development platform, dynamically adjusting the capacity and status of buffer nodes, the problems of data accumulation and real-time reduction in data transmission are solved, and the quality of data transmission is improved.
Patent Information
- Application Number
- CN202410864109.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-30
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2044-06-30
AI Technical Summary
There are problems of data accumulation and real-time reduction in data transmission of existing embedded remote experimental development platforms, resulting in low data transmission quality.
Using an embedded remote experimental platform data transmission method, by building temporary buffers and interface buffers, dynamically adjusting the capacity and state of buffer nodes, optimizing data transmission efficiency, avoiding data accumulation, and maintaining real-time transmission.
The quality of data transmission of the embedded remote experimental development platform has been improved, and by dynamically adjusting the capacity and status of the buffer nodes, effectively utilizing limited buffer resources, reducing resource waste, and improving data processing and transmission efficiency.
Smart Images

Figure CN118869639B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded remote experiment development, and particularly to a data transmission method and control system for an embedded remote experiment platform. Background Art
[0002] An embedded system is a special computer system that is usually embedded in other systems or devices to achieve specific functions. Compared with traditional computer systems, embedded systems usually have the characteristics of small size, low power consumption, reliable performance, and strong real-time performance. Embedded systems are widely used in fields such as household appliances, automobiles, medical devices, and communication devices.
[0003] A remote shared embedded experiment development platform device with the publication number of CN211181151U includes a Raspberry Pi embedded system. The Raspberry Pi embedded system includes an acquisition circuit module, an experiment circuit module, a clock signal module, and an LED digital tube display module. The experiment circuit module is connected to the acquisition circuit module through a data pipeline. The acquisition circuit module includes an image acquisition circuit and an audio acquisition circuit. The experiment circuit module includes an LED control circuit and a buzzer control circuit. The clock signal module includes an external power supply circuit. The Raspberry Pi embedded system is connected to the image acquisition circuit and the audio acquisition circuit through a network connection module.
[0004] In the above prior art, the acquisition circuit module can only perform image acquisition and audio acquisition, and the signal acquisition is relatively single. Moreover, when the transmission control system fails to parse and send data as fast as the data arrives during data transmission, buffer block nodes in the transmission buffer linked list may accumulate a large amount of data, resulting in excessive memory occupation and even data loss. At the same time, if the interface data volume is low, increasing the buffer block node capacity and sending multiple data frames at once may cause the data to wait in the buffer for a long time before being sent, reducing the real-time performance of the transmission, and thus reducing the quality of data transmission of the embedded remote experiment development platform. Summary of the Invention
[0005] In view of this, the present invention provides a data transmission method and control system for an embedded remote experiment platform, which is simple to use, highly applicable, and can optimize the data transmission efficiency to avoid data accumulation while maintaining the real-time performance of the transmission, thereby improving the quality of data transmission of the embedded remote experiment development platform.
[0006] On the one hand, the present invention provides a data transmission method for an embedded remote experiment platform, and the method includes the following steps:
[0007] S1, respectively obtain corresponding data information on the embedded experiment development board by using local interface classes;
[0008] S2. Construct a temporary buffer and interface buffers. Each interface buffer is provided with a buffer linked list for data to be transmitted and a free buffer linked list. The temporary buffer is provided with a temporary buffer linked list. Both the temporary buffer linked list and the free buffer linked list include a number of buffer nodes.
[0009] S3. The buffer linked list for data to be transmitted in the interface buffer obtains buffer nodes corresponding to the data information from the free buffer linked list, and stores the corresponding data information into the buffer nodes corresponding in the buffer linked list for data to be transmitted. If there is overcapacity or remaining capacity in any buffer node, the capacity of this buffer node is adjusted according to the temporary buffer linked list.
[0010] S4. Package each data information in each buffer node in the buffer linked list for data to be transmitted into data frames, respectively pack the data frames in the buffer nodes into data packets, and send the data packets to the cloud server using a network interface.
[0011] Based on the above technical solution, preferably, in step S1, the corresponding data information on the embedded experimental development board is obtained by using the local interface class. Among them, the local interface class includes five communication interfaces: HDMI, UART, GPIO, CAN, and USB. And the number of both the local interface class and the embedded experimental development board is several, and the local interface class and the embedded experimental development board are set in one-to-one correspondence. The corresponding data information on the corresponding embedded experimental development board is collected according to each communication interface in each local interface class.
[0012] Based on the above technical solution, preferably, in step S2, the temporary buffer and interface buffers are constructed. Each interface buffer is provided with a buffer linked list for data to be transmitted and a free buffer linked list. The temporary buffer is provided with a temporary buffer linked list. Both the temporary buffer linked list and the free buffer linked list include a number of buffer nodes. Among them, the number of interface buffers is equal to the number of local interface classes. The interface buffer is used to receive the data information collected in the corresponding local interface class. The storage data types of the buffer nodes in the free buffer linked list respectively correspond to the storage data types of the data information collected by each communication interface. The buffer nodes of the temporary buffer linked list receive the storage data types of the data information collected by each communication interface; and each buffer node corresponds to identification information.
[0013] Based on the above technical solution, preferably, the identification information of the buffer node includes buffer node type, buffer node status information, buffer area pointer, buffer node default capacity, buffer node adjustment flag, and buffer node adjustment status. The buffer node type includes interface buffer nodes and temporary buffer nodes. The buffer node status information includes free buffer status or buffer status for data to be transmitted. The buffer node adjustment flag indicates whether this buffer node needs to adjust its capacity. The buffer node adjustment status indicates whether this buffer node is in the process of adjustment. Both the buffer node adjustment flag and the buffer node adjustment status are boolean values.
[0014] Based on the above technical solutions, preferably, in step S3, the buffer node of the buffer linked list to be transmitted in the interface buffer obtains the corresponding data information from the free buffer linked list, and stores the corresponding data information into the buffer node corresponding in the buffer linked list to be transmitted. If any buffer node has overcapacity or remaining capacity, the capacity of the buffer node is adjusted according to the temporary buffer linked list, including the following sub-steps:
[0015] Obtain the quantity of data information collected by each communication interface in each local interface class , m is the m th local interface class, i is the m th type i communication interface in the
[0016] If > 0, the buffer linked list to be transmitted obtains the corresponding buffer node from the free buffer linked list. If = 0, modify the storage type of the current buffer node, and fill the buffer node into the temporary buffer linked list, and return it to the buffer node when all data information is encapsulated;
[0017] Obtain the storage capacity occupied by the data information collected by each communication interface in the local interface class , and calculate the total storage capacity occupied by the data information in the corresponding communication interface The expression is:
[0018] ;
[0019] According to the total storage capacity occupied by the data information in the communication interface , calculate the total storage capacity occupied by the data information collected in the local interface class The expression is:
[0020] ;
[0021] Obtain the default capacity of the buffer node corresponding to each communication interface , and calculate the total default capacity of the buffer nodes in the corresponding communication interface , the expression is:
[0022] ;
[0023] According to the total storage capacity occupied by the data information collected in the local interface class and the total default capacity of the buffer nodes in the corresponding communication interface , calculate the unit capacity difference Q m;
[0024] ;
[0025] According to the default capacity of the buffer nodes corresponding to each communication interface and the total occupancy capacity of the data information in the corresponding communication interface , calculate the interface capacity difference , and the expression is:
[0026] ;
[0027] Judge whether the unit capacity difference is greater than 0 and whether the interface capacity difference is greater than 0;
[0028] If Q m > 0, then construct a temporary storage area, obtain all buffer nodes corresponding to the interface capacity difference greater than 0, intercept the interface capacity difference in each buffer node, fill it into the temporary storage area, and store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively; obtain all buffer nodes corresponding to the interface capacity difference less than 0, merge the corresponding interface capacity difference obtained from the temporary storage area into the corresponding buffer nodes, store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively. If the capacity of the temporary storage area is greater than 0 after adjustment, then fill the temporary storage area into the temporary buffer linked list, delete the temporary storage area, and after all buffer nodes of the transmission buffer linked list are transmitted, the buffer nodes of each temporary buffer and interface buffer return to the initial state;
[0029] If Q m < 0, then obtain the remaining capacity L of the buffer nodes of the temporary buffer linked list, and judge whether the remaining capacity L of the buffer nodes of the temporary buffer linked list is greater than the capacity difference Q m ;
[0030] If L > Q m , obtain all buffer nodes corresponding to the interface capacity difference greater than 0, intercept the interface capacity difference in each buffer node, fill it into the corresponding buffer nodes of the temporary buffer linked list, and store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively; obtain all buffer nodes corresponding to the interface capacity difference For all buffer nodes corresponding to less than 0, the interface capacity difference obtained from the buffer nodes of the temporary buffer linked list is merged into the corresponding buffer nodes, and the corresponding data information collected by the communication interface is respectively stored in the corresponding buffer nodes. After all buffer nodes of the pending transmission buffer linked list are transmitted, the buffer nodes of each temporary buffer and the interface buffer are restored to the initial state;
[0031] If L < Q m , then set the priority levels of each communication interface in the local interface class, and sequentially obtain the corresponding buffer nodes from the free buffer linked list from high to low, and obtain the interface capacity difference For all buffer nodes corresponding to greater than 0, intercept the interface capacity difference in each buffer node and fill it into the corresponding buffer node of the temporary buffer linked list, and respectively store the corresponding data information collected by the communication interface in the corresponding buffer nodes; obtain the interface capacity difference For all buffer nodes corresponding to less than 0, merge the interface capacity difference obtained from the buffer nodes of the temporary buffer linked list into the corresponding buffer nodes, and respectively store the corresponding data information collected by the communication interface in the corresponding buffer nodes. If there is no capacity in the buffer nodes of the temporary buffer linked list, it is determined that the output buffer overflows abnormally. After all buffer nodes of the pending transmission buffer linked list are transmitted, they are refilled into the free buffer linked list. After all buffer nodes of the pending transmission buffer linked list are transmitted, the buffer nodes of each temporary buffer and the interface buffer are restored to the initial state.
[0032] On the basis of the above technical solutions, preferably, the priority levels of each communication interface in the local interface class include obtaining an evaluation score through weighted calculation based on the transmission speed, transmission stability, and importance of the transmitted data information of each communication interface. The higher the evaluation score, the higher the priority level of each communication interface in the local interface class. The calculation expression is:
[0033] ;
[0034] In the formula, Z is the comprehensive score of the corresponding communication interface, S is the transmission speed score, W 1 is the transmission speed weight, K is the transmission stability score, W 2 is the transmission stability weight, G is the importance score of the transmitted data information, W 3 is the importance weight of the transmitted data information, W 1 +W 2 +W 3 = 1.
[0035] Based on the above technical solutions, preferably, in step S4, each data information in each buffer node in the buffer linked list to be transmitted is encapsulated into a data frame, the data frames in the buffer nodes are respectively packed into data packets, and the data packets are sent to the cloud server through a network interface, where the following sub-steps are included:
[0036] Read the data information in the buffer nodes corresponding to the communication interfaces in each buffer linked list to be transmitted;
[0037] Construct the first four bytes of data according to the data transmission protocol, encapsulate each data information in each buffer node into a data frame, and then pack all the data frames in the same buffer node into a data packet;
[0038] Send the data packet to the server through the ETH0 network interface.
[0039] Based on the above technical solutions, preferably, when constructing the first four bytes of data according to the data transmission protocol, the first byte is used to determine whether the data information is of the instruction packet type, the second byte represents the specific type of the instruction. If the first byte is of the instruction packet type, the specific types of the second byte include the request instruction for allocating a development board, the request failure instruction, the request success instruction, the GPIO instruction type, the buffer overflow instruction type, and the USB descriptor transmission instruction type. If it is the request instruction type for allocating a development board, the third byte represents the corresponding embedded experimental development board model information. If it is the GPIO instruction type, the third byte represents the signal type, and the signal types include high level, low level, positive pulse, and negative pulse. If it is the buffer overflow instruction type, the third byte represents the corresponding buffer interface address. If it is the USB descriptor transmission instruction type, the subsequent data of the USB device descriptor instruction represents the USB descriptor information, and the fourth byte represents the number of data frames contained in the current buffer node.
[0040] Based on the above technical solutions, preferably, it further includes that the cloud server receives the data packet transmitted by the network interface, parses the first four bytes of the data packet according to the data transmission protocol, removes the first four bytes of each data frame, and obtains the corresponding data information.
[0041] On the other hand, the present invention also provides an embedded remote experiment platform control system, which is characterized in that, as the data transmission method of the embedded remote experiment platform described above, the system includes an embedded experimental development board, a local interface acquisition module, a buffer module, a network interface module, and a cloud server, where,
[0042] The embedded experimental development board is communicatively connected to the local interface acquisition module, and the local interface acquisition module is used to collect the data information transmitted in each communication interface on the embedded experimental development board;
[0043] The buffer module is communicatively connected between the local interface acquisition module and the network interface module, and between the network interface module and the cloud server respectively. The buffer module is used to adjust and balance the storage capacity of each buffer node, and the data information collected by each communication interface is sent to the cloud server through the network interface module.
[0044] A data transmission method and control system for an embedded remote experiment platform provided by the present invention has the following beneficial effects compared with the prior art:
[0045] The present invention can adapt to different interfaces and different types of data, improving adaptability. By dynamically adjusting the capacity and status of buffer nodes, it can more effectively utilize limited buffer resources, reduce resource waste, and by optimizing the use of the buffer, it can reduce the data waiting time for transmission, improve the efficiency of data processing and transmission, avoid data accumulation and maintain the real-time nature of transmission, thereby improving the quality of data transmission of the embedded remote experiment development platform.
[0046] By comprehensively considering the transmission speed, stability, and importance of data information, it can more accurately evaluate the performance and priority of each communication interface, thereby optimizing resource allocation, giving priority to allocating resources to communication interfaces with better performance and greater importance, which can improve the overall transmission efficiency and performance of the system; at the same time, by considering transmission stability, the system can give priority to ensuring the data transmission of communication interfaces with higher stability, reducing system instability factors caused by transmission errors or packet loss;
[0047] Through the designed data transmission protocol between the embedded development board, the buffer, and the cloud server, the cloud server can apply for development board resources from the remote experiment platform management system; the transmission of the above-mentioned USB, CAN, UART, and HDMI data between the remote experiment system and the cloud server will not be chaotic, and the protocol is simple and clear, easy to parse and encapsulate data frames, improving adaptability;
[0048] The system of the present invention can adapt to the access of multiple types of development boards, the system construction is simple, it is easy to add and delete development board resources, it will not damage the development boards added to the remote experiment platform, and there is no need to redesign the experimental development board for the remote experiment platform, which can save resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0050] Figure 1Schematic diagram of the data transmission method of an embedded remote experiment platform according to the present invention;
[0051] Figure 2 Schematic diagram of the control system of an embedded remote experiment platform according to the present invention. Specific embodiments
[0052] Next, in combination with the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present invention.
[0053] As Figure 1-2 shown, the present invention provides a data transmission method for an embedded remote experiment platform, and the method includes the following steps:
[0054] S1, using the local interface class to respectively obtain the corresponding data information on the embedded experiment development board;
[0055] Among them, the local interface class includes five communication interfaces: HDMI, UART, GPIO, CAN, and USB. The number of the local interface class and the embedded experiment development board is several, and the local interface class and the embedded experiment development board are set in one-to-one correspondence. According to each communication interface in each local interface class, the corresponding data information on the corresponding embedded experiment development board is collected.
[0056] It should be noted that the local interface class includes five communication interfaces: HDMI high-definition multimedia interface, UART universal asynchronous transceiver, GPIO general-purpose input / output, CAN controller area network, and USB universal serial bus; these interfaces respectively correspond to different data transmission requirements on the embedded experiment development board; the number of the local interface class and the embedded experiment development board is several, and the local interface class and the embedded experiment development board are set in one-to-one correspondence. Each embedded experiment development board is equipped with a complete set of local interface classes for collecting corresponding data information and storing the received data in the receive buffer of the corresponding interface.
[0057] Specifically, in this embodiment, video or image data is collected through the HDMI interface, serial communication data is collected through the UART interface, digital signals or analog signals are collected through the GPIO interface, automotive network data is collected through the CAN interface, and data in the storage medium is collected through the USB interface.
[0058] HDMI Communication Interface: The MS2109 chip is used to collect the video data of the HDMI interface on the experimental platform, and the remote experimental service system receives it in the USB slave mode. The MS2109 is a high-definition video capture chip that can transmit the audio and video signals output from the HDMI interface through the USB interface. The HDMI input supports RGB444, YCBCR422, YCBCR444, and YCBCR420 encoding formats, with a maximum input resolution of 3840×2160@30Hz. It supports two output modes, YUV and JPEG, with a maximum output resolution of 1920X1080@30Hz. In this embodiment, the MS2109 chip is used to collect the video data of the HDMI interface on the experimental platform, and the remote experimental service system receives it in the USB slave mode.
[0059] GPIO Communication Interface: In this embodiment, 16 general-purpose GPIO pins are led out. Two pins form a group, with one configured in the input mode and the other in the output mode, for a total of 8 groups. There are four input and output modes: high level, low level, positive pulse, and negative pulse. Reasonably configuring these pins can read the device status of the experimental platform or control the devices on the experimental platform.
[0060] UART Communication Interface: Adopts TTL level;
[0061] USB Communication Interface: After the cloud server host accesses the USB device, it needs to send the USB device descriptor set to the buffer through the network; the buffer establishes a USB Gadget device based on the obtained descriptor set, so that the embedded experimental development board can identify the device of the corresponding USB device type accessed by the server. In the operation function of the specific endpoint, the mapping of USB transmission is completed.
[0062] According to the five communication interfaces of HDMI, UART, GPIO, CAN, and USB in this embodiment, the system can collect various data types including video / image data, serial communication data, digital / analog signals, automotive network data, and data in the storage medium, greatly expanding the data processing capabilities of the experimental development board. And since each embedded experimental development board is equipped with a complete set of local interface classes, users can select the corresponding interfaces to collect and process data according to different experimental requirements, thus enhancing the flexibility and diversity of the experiment. Since the system adopts a modular design, it is convenient to add or replace local interface classes to meet different experimental requirements. At the same time, due to the use of standard communication interfaces, the system also has good compatibility and scalability.
[0063] S2. Construct a temporary buffer and interface buffers. Each interface buffer is provided with a buffer linked list to be transmitted and an idle buffer linked list, and the temporary buffer is provided with a temporary buffer linked list. Both the temporary buffer linked list and the idle buffer linked list include several buffer nodes;
[0064] Among them, the number of interface buffers is equal to the number of local interface classes. The interface buffers are used to receive the data information collected in the corresponding local interface classes. The storage data types of the buffer nodes in the idle buffer linked list respectively correspond to the storage data types of the data information collected by each communication interface. The buffer nodes of the temporary buffer linked list receive the storage data types of the data information collected by each communication interface; and each buffer node corresponds to identification information;
[0065] The identification information of the buffer node includes buffer node type, buffer node status information, buffer area pointer, buffer node default capacity, buffer node adjustment flag, and buffer node adjustment status. The buffer node type includes interface buffer node and temporary buffer node. The buffer node status information includes idle buffer status or buffer status to be transmitted. The buffer node adjustment flag indicates whether the buffer node needs to adjust its capacity. The buffer node adjustment status indicates whether the buffer node is in the process of adjustment. Both the buffer node adjustment flag and the buffer node adjustment status are boolean values.
[0066] It should be noted that when the local interface class collects data, first take out a node from the idle buffer linked list of the corresponding interface buffer; if there is no available node in the idle linked list, the system can trigger the node capacity adjustment mechanism as needed; store the collected data in the taken-out node, and add the node to the buffer linked list to be transmitted of the corresponding interface buffer; when the data is ready to be transmitted, take out the node from the buffer linked list to be transmitted, and send the data to the network interface; after the sending is completed, reset the node to the idle state and add it to the idle buffer linked list of the corresponding interface buffer. When adjusting the capacity from the temporary buffer linked list to the buffer node, it is necessary to adjust and fill in the storage data type of the partial capacity according to the storage data type of the buffer node. When adjusting the capacity from the buffer node to the temporary buffer linked list, the storage data type of the partial capacity is modified to the default.
[0067] S3. The buffer linked list to be transmitted of the interface buffer obtains the buffer node corresponding to the data information from the idle buffer linked list, and stores the corresponding data information into the buffer node corresponding in the buffer linked list to be transmitted. If any buffer node has overcapacity or remaining capacity, the capacity of the buffer node is adjusted according to the temporary buffer linked list;
[0068] Among them, step S3 includes the following sub-steps:
[0069] Obtain the quantity of the data information collected by each communication interface in each local interface class ,m is the m th local interface class, i is the m i-th communication interface among the local interface classes, and determine whether it is greater than 0;
[0070] If > 0, the buffer node corresponding to the buffer linked list to be transmitted is obtained from the free buffer linked list. If = 0, the storage type of the current buffer node is modified, and the buffer node is filled into the temporary buffer linked list and returned to the buffer node when all data information is encapsulated;
[0071] Obtain the storage capacity occupied by the data information collected by each communication interface in the local interface class , and calculate the total storage capacity occupied by the data information in the corresponding communication interface The expression is:
[0072] ;
[0073] According to the total storage capacity occupied by the data information in the communication interface , calculate the total storage capacity occupied by the data information collected in the local interface class The expression is:
[0074] ;
[0075] Obtain the default capacity of the buffer node corresponding to each communication interface , and calculate the total default capacity of the buffer nodes in the corresponding communication interface , the expression is:
[0076] ;
[0077] According to the total storage capacity occupied by the data information collected in the local interface class and the total default capacity of the buffer nodes in the corresponding communication interface , calculate the unit capacity difference Q m ;
[0078] ;
[0079] According to the default capacity of the buffer node corresponding to each communication interface and the total storage capacity occupied by the data information in the corresponding communication interface , calculate the interface capacity difference , the expression is:
[0080] ;
[0081] Determine whether the difference in unit capacity is greater than 0 and whether the difference in interface capacity is greater than 0;
[0082] If Q m > 0, then construct a temporary storage area, obtain all buffer nodes corresponding to the interface capacity difference greater than 0, intercept the interface capacity difference in each buffer node, fill it into the temporary storage area, and store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively; obtain the interface capacity difference all buffer nodes corresponding to < 0, merge the obtained corresponding interface capacity difference in the temporary storage area into the corresponding buffer nodes, store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively, if the capacity of the temporary storage area is greater than 0 after adjustment, then fill the temporary storage area into the temporary buffer linked list, and delete the temporary storage area. After all buffer nodes in the transmission buffer linked list are transmitted, the buffer nodes in each temporary buffer and interface buffer return to the initial state;
[0083] If Q m < 0, then obtain the remaining capacity L of the buffer nodes in the temporary buffer linked list, and determine whether the remaining capacity L of the buffer nodes in the temporary buffer linked list is greater than the capacity difference Q m ;
[0084] If L > Q m when, obtain all buffer nodes corresponding to the interface capacity difference greater than 0, intercept the interface capacity difference in each buffer node, fill it into the corresponding buffer node in the temporary buffer linked list, and store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively; obtain the interface capacity difference all buffer nodes corresponding to < 0, merge the obtained corresponding interface capacity difference in the buffer nodes of the temporary buffer linked list into the corresponding buffer nodes, store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively. After all buffer nodes in the transmission buffer linked list are transmitted, the buffer nodes in each temporary buffer and interface buffer return to the initial state;
[0085] If L < Q m when, then set the priority levels of each communication interface in the local interface class, and sequentially obtain the corresponding buffer nodes from the free buffer linked list from high to low, obtain all buffer nodes corresponding to the interface capacity difference greater than 0, intercept the interface capacity difference in each buffer node, fill it into the corresponding buffer node in the temporary buffer linked list, and store the corresponding data information collected by the communication interface into the corresponding buffer nodes respectively; obtain the interface capacity difference For all buffer nodes corresponding to less than 0, the interface capacity differences obtained from the buffer nodes of the temporary buffer linked list are merged into the corresponding buffer nodes, and the corresponding data information collected by the communication interface is respectively stored in the corresponding buffer nodes. If there is no capacity in the buffer nodes of the temporary buffer linked list, it is determined that the output buffer overflows abnormally. After the buffer nodes of the buffer linked list to be transmitted are transmitted, they are refilled into the free buffer linked list. After all the buffer nodes of the buffer linked list to be transmitted are transmitted, the buffer nodes of each temporary buffer and interface buffer are restored to the initial state.
[0086] It should be noted that the system configures an interface buffer for each local interface class, including a buffer linked list to be transmitted and a free buffer linked list; the temporary buffer includes a temporary buffer linked list for temporarily storing data; when the communication interface collects data, the system obtains buffer nodes from the free buffer linked list to store the data and puts them into the buffer linked list to be transmitted. If the data volume is 0, the storage type of the buffer node is modified and put into the temporary buffer linked list. The system calculates the unit capacity difference and the interface capacity difference according to the storage capacity of the collected data and the default capacity of the buffer node. If the unit capacity difference is greater than 0, it means that the capacity of this buffer needs to be reduced and added to the temporary buffer linked list; if the unit capacity difference is less than 0, it means that capacity needs to be borrowed from the temporary buffer linked list. According to the judgment of the interface capacity difference, when capacity needs to be increased, the system first tries to borrow capacity from the buffer nodes inside the interface, and then considers borrowing from the temporary buffer linked list. When the remaining capacity of the temporary buffer linked list is not enough to meet the demand, the system will obtain new buffer nodes from the free buffer linked list according to the priority level of the communication interface until the temporary buffer linked list is exhausted and no more nodes can be obtained from the free linked list, and the system will report a buffer overflow exception. After all the buffer nodes in the buffer linked list to be transmitted are transmitted, the system will restore them to the initial state, that is, rejoin the free buffer linked list.
[0087] According to this embodiment, the system can easily adapt to different interfaces and different types of data, improving adaptability. By dynamically adjusting the capacity and state of buffer nodes, the system can more effectively utilize limited buffer resources, reduce resource waste, and by optimizing the use of buffers, the system can reduce the waiting time for data transmission and improve the efficiency of data processing and transmission.
[0088] Furthermore, the priority levels of the communication interfaces in the local interface class include the evaluation scores obtained by weighted calculation according to the transmission speed, transmission stability, and importance of the transmitted data information of each communication interface. The higher the evaluation score, the higher the priority level of each communication interface in the local interface class. The calculation expression is:
[0089] ;
[0090] Wherein, Z is the comprehensive score corresponding to the communication interface, S is the transmission speed score, and W 1 is the transmission speed weight, K is the transmission stability score, and W 2 is the transmission stability weight, G is the importance score of the transmitted data information, and W 3 is the importance weight of the transmitted data information, and W 1 +W 2 +W 3 = 1.
[0091] It should be noted that S is the transmission speed score, which is calculated based on the transmission rate and bandwidth parameters of the communication interface. The expression is:
[0092] ;
[0093] Wherein, R is the transmission rate; W_R is the transmission rate weight, B is the bandwidth, W_B is the bandwidth weight, and W_R + W_B = 1;
[0094] K is the transmission stability score, which is calculated based on the packet loss rate, error rate, and retransmission rate parameters of the communication interface. The expression is:
[0095] ;
[0096] Wherein, P is the packet loss rate, E is the error rate, RT is the retransmission rate, W_P is the packet loss rate weight, W_E is the error rate weight, W_RT is the retransmission rate weight, and W_P + W_E + W_RT = 1.
[0097] G is the importance score of the transmitted data information, which is preset by the administrator and is divided into high-priority, medium-priority, low-priority, and non-critical data. The score corresponding to the high priority is 4 points, the score corresponding to the medium priority is 3 points, the score corresponding to the low priority is 2 points, and the score corresponding to the non-critical data is 1 point.
[0098] In this embodiment, by comprehensively considering the transmission speed, stability, and importance of data information, the performance and priority of each communication interface can be more accurately evaluated, thereby optimizing the resource allocation, giving priority to allocating resources to the communication interfaces with better performance and greater importance, and improving the overall transmission efficiency and performance of the system; at the same time, by considering the transmission stability, the system can give priority to ensuring the data transmission of the communication interfaces with higher stability, and reduce the system instability factors caused by transmission errors or packet losses.
[0099] Among them, the weights can be adjusted according to the actual needs or preferences of the system to make the system more flexible and configurable. For example, when a large amount of data needs to be transmitted quickly, the weight of the transmission speed can be increased; in scenarios where data integrity and reliability need to be ensured, the weight of the transmission stability can be increased.
[0100] When a buffer overflow exception occurs, an overflow instruction message for the corresponding interface is sent to the cloud server according to the data transmission protocol.
[0101] S4. Package each data information in each buffer node in the buffer linked list to be transmitted into a data frame, pack the data frames in the buffer nodes into data packets respectively, and send the data packets to the cloud server using a network interface.
[0102] Among them, step S4 includes the following sub-steps:
[0103] Read the data information in the buffer nodes corresponding to each communication interface in each buffer linked list to be transmitted;
[0104] Construct the first four bytes of data according to the data transmission protocol, encapsulate each data information in each buffer node into a data frame, and then pack all the data frames in the same buffer node into a data packet;
[0105] Send the data packet to the server using the ETH0 network interface.
[0106] In this embodiment, the first four bytes of data are constructed according to the data transmission protocol. Among them, the first byte is used to determine whether the data information is an instruction packet type, the second byte represents the specific type of the instruction. If the first byte is an instruction packet type, the specific types of the second byte include the request instruction for allocating a development board, the request failure instruction, the request success instruction, the GPIO instruction type, the buffer overflow instruction type, and the USB descriptor transmission instruction type. If it is a request instruction type for allocating a development board, the third byte represents the corresponding embedded experimental development board model information. If it is a GPIO instruction type, the third byte represents the signal type, and the signal types include high level, low level, positive pulse, and negative pulse. If it is a buffer overflow instruction type, the third byte represents the corresponding buffer interface address. If it is a USB descriptor transmission instruction type, the subsequent data of the USB device descriptor instruction represents the USB descriptor information, and the fourth byte represents the number of data frames included in the current buffer node.
[0107] It should be noted that in this embodiment, a set of data transmission protocols between the embedded development board, the buffer, and the cloud server is provided. Through this protocol, the cloud server can apply for development board resources from the remote experimental platform management system; the transmission of the above USB, CAN, UART, and HDMI data between the remote experimental system and the cloud server will not be chaotic, and the protocol is simple and clear, easy to parse and encapsulate data frames, improving the adaptability.
[0108] It also includes that the cloud server receives the data packet transmitted by the network interface, parses the first four bytes of the data packet according to the data transmission protocol, removes the first four bytes of each data frame, and obtains the corresponding data information.
[0109] In this embodiment, each interface is a bidirectional communication connection. That is, data can be sent to the embedded experimental development board through the cloud server. The buffer receives and parses the network data packets from the cloud server and then sends them to the corresponding interfaces or pins of the development board. Through the data mapping and forwarding in these two directions, functions such as data interaction and instruction issuance between the cloud server and the embedded experimental development board are realized, providing services such as development board debugging and control for cloud server customers. Among them, this system is designed and implemented based on the STM32MP157 development board.
[0110] On the other hand, the present invention also provides an embedded remote experiment platform control system. As the data transmission method of the embedded remote experiment platform described above, the system includes an embedded experimental development board, a local interface acquisition module, a buffer module, a network interface module, and a cloud server. Among them,
[0111] The embedded experimental development board is communicatively connected to the local interface acquisition module, and the local interface acquisition module is used to acquire the data information transmitted in each communication interface on the embedded experimental development board;
[0112] The buffer module is communicatively connected between the local interface acquisition module and the network interface module, and between the network interface module and the cloud server respectively. The buffer module is used to adjust and balance the storage capacity of each buffer node. The data information acquired by each communication interface is sent to the cloud server through the network interface module.
[0113] Create an experimental platform list and a cloud server customer list in the system. Each embedded experimental development board and buffer form a remote experiment platform, which manages the remote experiment platform and the cloud server respectively. The remote experiment platform includes an experiment platform ID, an embedded experimental development board model, and the IP address of the remote experiment service system. The cloud server includes the IP address of the cloud server customer and the ID of the embedded experimental development board occupied by it;
[0114] This system can implement the function of adding a new experimental platform, adding a node to the experimental platform list, and allocating ID, configuring IP, and development board model information;
[0115] This system can implement the function of experimental platform allocation: when receiving an experimental platform application signal, determine whether there is an idle development board that meets the conditions according to the experimental platform list and the applied development board model. If not, send a request failure signal to the cloud server; if so, record the ID of the development board that meets the conditions, mark it as occupied, and create a cloud server customer node and add it to the cloud server list; when receiving the signal that the cloud server customer ends using, delete the cloud server customer node and mark the corresponding experimental platform as idle.
[0116] It should be noted that the system can adapt to the access of various types of development boards. The system construction is simple, it is easy to add and delete development board resources, it will not damage the development boards added to the remote experiment platform, and there is no need to redesign the experimental development board for the remote experiment platform, which can save resources.
[0117] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data transmission method for an embedded remote experiment platform, characterized in that: The method The following steps are involved: S1, using the local interface class to obtain the corresponding data information on the embedded experimental development board; S2, constructing a temporary buffer and an interface buffer, each interface buffer is provided with a to-be-transmitted buffer linked list and an idle buffer linked list, the temporary buffer is provided with a temporary buffer linked list, and both the temporary buffer linked list and the idle buffer linked list include a number of buffer nodes; S3, the to-be-transmitted buffer list of the interface buffer obtains the buffer node corresponding to the data information from the free buffer list, and stores the corresponding data information into the corresponding buffer node in the to-be-transmitted buffer list. If any buffer node has excess capacity or surplus capacity, the capacity of the buffer node is adjusted according to the temporary buffer list; According to the storage capacity of the collected data and the default capacity of the buffer node, the unit capacity difference and the interface capacity difference are calculated. If the unit capacity difference is greater than 0, it means that the capacity of the buffer needs to be reduced and added to the temporary buffer list; If the unit capacity difference is less than 0, it means that capacity needs to be borrowed from the temporary buffer list. According to the interface capacity difference, when the capacity needs to be increased, the system first tries to borrow capacity from the buffer node inside the interface, and then considers borrowing from the temporary buffer list. When the remaining capacity of the temporary buffer list is insufficient to meet the demand, the system will obtain new buffer nodes from the free buffer list according to the priority level of the communication interface. When the temporary buffer list is exhausted and no more nodes can be obtained from the free list, the system will report a buffer overflow exception. After all the buffer nodes in the buffer list to be transmitted have completed the transmission, the system will restore them to the initial state, that is, re-add them to the free buffer list; S4, encapsulate each data information in each buffer node in the transmission buffer linked list into a data frame, respectively package the data frames in the buffer nodes into data packets, and use the network interface to send the data packets to the cloud service end.
2. The data transmission method of an embedded remote experiment platform according to claim 1, characterized in that: In step S1, the local interface class is used to obtain the corresponding data information on the embedded experimental development board respectively, wherein the local interface class includes five communication interfaces: HDMI, UART, GPIO, CAN and USB, and the number of local interface classes and embedded experimental development boards are both several, and the local interface class and the embedded experimental development board are arranged in a one-to-one correspondence, and the corresponding data information on the corresponding embedded experimental development board is collected respectively according to each communication interface in each local interface class.
3. The data transmission method of an embedded remote experiment platform according to claim 2, characterized in that: In step S2, a temporary buffer and an interface buffer are constructed, each interface buffer is provided with a to-be-transmitted buffer list and an idle buffer list, the temporary buffer is provided with a temporary buffer list, the temporary buffer list and the idle buffer list both include a number of buffer nodes, wherein the number of interface buffers is equal to the number of local interface classes, the interface buffer is used to receive data information collected in the corresponding local interface class, the storage data type of each buffer node of the idle buffer list respectively corresponds to the storage data type of the data information collected by each communication interface, the buffer node of the temporary buffer list receives the storage data type of the data information collected by each communication interface; and each buffer node has corresponding identification information.
4. The data transmission method of an embedded remote experiment platform according to claim 3 is characterized in that: The identification information of the buffer node includes the buffer node type, buffer node status information, buffer pointer, buffer node default capacity, buffer node adjustment identifier and buffer node adjustment status. The buffer node type includes an interface buffer node and a temporary buffer node. The buffer node status information includes an idle buffer status or a pending transmission buffer status. The buffer node adjustment identifier indicates whether the buffer node needs to adjust its capacity. The buffer node adjustment status indicates whether the buffer node is being adjusted. The buffer node adjustment identifier and the buffer node adjustment status are both Boolean values.
5. The data transmission method of an embedded remote experiment platform according to claim 4, characterized in that: In step S3, the buffer list to be transmitted of the interface buffer obtains the buffer node corresponding to the data information from the free buffer list, and stores the corresponding data information into the corresponding buffer node in the buffer list to be transmitted. If any buffer node has excess capacity or surplus capacity, the capacity of the buffer node is adjusted according to the temporary buffer list, which includes the following sub-steps: Get the number of data information collected by each communication interface in each local interface class , m For the m A local interface class, i For the m The i-th communication interface in the local interface class, and determine whether it is greater than 0; like >0, the waiting-to-be-transmitted buffer list obtains the corresponding buffer node from the free buffer list. =0, the storage type of the current buffer node is modified, and the buffer node is filled into the temporary buffer list, and returned to the buffer node when all data information is encapsulated; Get the data information occupied by each communication interface in the local interface class , and calculate the total storage capacity of the data information in the corresponding communication interface The expression is: ; According to the total storage capacity of data information in the communication interface , calculate the total storage capacity of the data information collected in the local interface class The expression is: ; Get the default capacity of the buffer node corresponding to each communication interface , and calculate the default capacity sum of the buffer nodes in the corresponding communication interface , the expression is: ; According to the total storage capacity of the data information collected in the local interface class The sum of the default capacities of the buffer nodes in the corresponding communication interface , calculate the unit capacity difference Q m ; ; According to the default capacity of the buffer node corresponding to each communication interface The total storage capacity of the data information in the corresponding communication interface , calculate the interface capacity difference , the expression is: ; Determine whether the unit capacity difference is greater than 0 and whether the interface capacity difference is greater than 0; like Q m >0, a temporary storage area is constructed to obtain the interface capacity difference All buffer nodes corresponding to the value greater than 0, and intercept the interface capacity difference in each buffer node, fill it into the temporary storage area, and store the corresponding data information collected by the communication interface into the corresponding buffer node respectively; obtain the interface capacity difference For all buffer nodes corresponding to the capacity difference of the interface obtained in the temporary storage area, the corresponding interface capacity difference is merged into the corresponding buffer node, and the corresponding data information collected by the communication interface is stored in the corresponding buffer node respectively. If the capacity of the temporary storage area after adjustment is greater than 0, the temporary storage area is filled into the temporary buffer list, and the temporary storage area is deleted. After all the buffer nodes in the transmission buffer list are transmitted, the buffer nodes of each temporary buffer area and the interface buffer area are restored to the initial state; like Q m <0, obtain the remaining capacity L of the buffer node of the temporary buffer linked list, and determine whether the remaining capacity L of the buffer node of the temporary buffer linked list is greater than the capacity difference Q m ; If L> Q m When the interface capacity difference is obtained All buffer nodes corresponding to the value greater than 0, and intercept the interface capacity difference in each buffer node, fill it into the corresponding buffer node of the temporary buffer list, and store the corresponding data information collected by the communication interface into the corresponding buffer node respectively; obtain the interface capacity difference For all buffer nodes corresponding to the data capacity difference less than 0, the corresponding interface capacity difference obtained from the buffer nodes of the temporary buffer list is merged into the corresponding buffer nodes, and the corresponding data information collected by the communication interface is stored in the corresponding buffer nodes respectively. After all the buffer nodes of the transmission buffer list are transmitted, the buffer nodes of each temporary buffer zone and interface buffer zone are restored to the initial state; If L< Q m When the priority of each communication interface in the local interface class is set, the corresponding buffer nodes are obtained from the free buffer list from high to low, and the interface capacity difference is obtained. All buffer nodes corresponding to the value greater than 0, and intercept the interface capacity difference in each buffer node, fill it into the corresponding buffer node of the temporary buffer list, and store the corresponding data information collected by the communication interface into the corresponding buffer node respectively; obtain the interface capacity difference For all buffer nodes corresponding to a capacity difference less than 0, the corresponding interface capacity difference obtained from the buffer nodes of the temporary buffer list is merged into the corresponding buffer nodes, and the corresponding data information collected by the communication interface is stored in the corresponding buffer nodes respectively. If there is no capacity in the buffer nodes of the temporary buffer list, it is determined that the output buffer overflow is abnormal, and the buffer nodes of the waiting transmission buffer list are refilled into the free buffer list after the transmission of each buffer node of the waiting transmission buffer list. After all the buffer nodes of the waiting transmission buffer list are transmitted, the buffer nodes of each temporary buffer zone and the interface buffer zone are restored to their initial state.
6. The data transmission method of an embedded remote experiment platform according to claim 5, characterized in that: The priority of each communication interface in the local interface class includes an evaluation score obtained by weighted calculation according to the transmission speed, transmission stability and importance of transmission data information of each communication interface. The higher the evaluation score, the higher the priority of each communication interface in the local interface class. The calculation expression is: ; Where Z is the comprehensive score of the corresponding communication interface, S is the transmission speed score, W1 is the transmission speed weight, K is the transmission stability score, W2 is the transmission stability weight, G is the transmission data information importance score, W3 is the transmission data information importance weight, and W1+W2+W3=1.
7. The data transmission method of an embedded remote experiment platform according to claim 6, characterized in that: In step S4, each data information in each buffer node in the buffer linked list to be transmitted is encapsulated into a data frame, the data frames in the buffer nodes are respectively packaged into data packets, and the data packets are sent to the cloud service end using a network interface, which includes the following sub-steps: Read the data information in the buffer node corresponding to each communication interface in each buffer chain list to be transmitted; Construct the first four bytes of data according to the data transmission protocol, encapsulate each data information in each buffer node into a data frame, and then pack all data frames in the same buffer node into a data packet; Use the ETH0 network interface to send data packets to the server.
8. The data transmission method of the embedded remote experiment platform according to claim 7 is characterized in that: The first four bytes of data are constructed according to the data transmission protocol, wherein the first byte is used to determine whether the data information is an instruction packet type, the second byte indicates the specific type of the instruction, if the first byte is an instruction packet type, the specific type of the second byte includes an allocation development board request instruction, a request failure instruction, a request success instruction, a GPIO instruction type, a buffer overflow instruction type, and a USB descriptor transfer instruction type, if it is an allocation development board request instruction type, the third byte indicates the corresponding embedded experimental development board model information, if it is a GPIO instruction type, the third byte indicates the signal type, and the signal type includes a high level, a low level, a positive pulse, and a negative pulse, if it is a buffer overflow instruction type, the third byte indicates the corresponding buffer interface address, if it is a USB descriptor transfer instruction type, the USB device descriptor instruction subsequent data indicates the USB descriptor information, and the fourth byte indicates the number of data frames contained in the current buffer node.
9. The data transmission method of the embedded remote experiment platform according to claim 8, characterized in that: It also includes the cloud server receiving the data packet transmitted by the network interface, parsing the first four bytes of the data packet according to the data transmission protocol, removing the first four bytes of each data frame, and obtaining the corresponding data information.
10. An embedded remote experiment platform control system, characterized in that: The data transmission method of the embedded remote experiment platform as described in any one of claims 1 to 9, the system includes an embedded experiment development board, a local interface acquisition module, a buffer module, a network interface module and a cloud server, wherein: The embedded experiment development board is in communication connection with the local interface acquisition module, and the local interface acquisition module is used to collect data information transmitted in each communication interface on the embedded experiment development board; The buffer module is respectively communicatively connected between the local interface acquisition module and the network interface module and between the network interface module and the cloud server. The buffer module is used to adjust and balance the storage capacity of each buffer node. The data information collected by each communication interface is sent to the cloud server through the network interface module.
Citation Information
Patent Citations
Remote sharing embedded experimental development platform equipment
CN211181151U
Communication buffer manager and method therefor
CN1868193A