Serial port management method and device

By adopting a serial port management method that combines time-slice polling and device file management in the intelligent converged terminal of the distribution area, the problem of low serial port resource utilization was solved, and the data transmission and reception efficiency and resource utilization were improved.

CN115168275BActive Publication Date: 2026-03-31FIBERHOME TELECOMMUNICATION TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-01
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In the intelligent converged terminal of the distribution area, when multiple application modules share serial port resources, the existing technology has low serial port resource utilization and low data transmission and reception efficiency, which can easily lead to task timeouts and resource waste, especially when the serial port is busy.

Method used

The serial port data transmission and reception is managed by time-slice polling. By establishing device profiles and dynamically adjusting and correcting parameters, the serial port data reception and transmission process is optimized, thereby improving the data frame reception efficiency and resource utilization.

Benefits of technology

By using time-slice polling and device file management, unnecessary waiting time is reduced, improving the utilization rate of serial port resources and the efficiency of data transmission and reception, and optimizing the serial port management process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168275B_ABST
    Figure CN115168275B_ABST
Patent Text Reader

Abstract

A serial port management method and device, the serial port management method comprising: in response to a serial port data transceiving request from an application module, sending a request data to a serial port; receiving serial port data from a serial port of a hanging device in a time slice polling manner and caching the serial port data; when no serial port data is received in a time slice, ending the receiving, thereby completing the receiving of a frame of serial port data, and sending the stored serial port data to the application module. The serial port management method can effectively improve the transceiving efficiency of serial port data and the utilization efficiency of serial port resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to a serial port management method and apparatus. Background Technology

[0002] The smart distribution transformer combine terminal unit is an intelligent data acquisition and control terminal installed in low-voltage distribution areas. It meets the needs of high-performance concurrency, large-capacity storage, multiple data acquisition objects, localized analysis and decision-making, and collaborative computing. It has functions such as data acquisition, equipment operation status monitoring, and power metering, and supports the development needs of marketing, power distribution, and emerging businesses.

[0003] Many devices are usually connected to the serial port of the intelligent converged terminal in the distribution area. To adapt to different business needs, multiple application modules (APPs) are often installed on the intelligent converged terminal in the distribution area. Multiple APPs may need to access serial port resources. How to coordinate the use of serial port resources by various APPs and improve the utilization rate of serial port resources is a problem of concern in this field. Summary of the Invention

[0004] At least one embodiment of this disclosure provides a serial port management method, including: responding to a serial port data transmission and reception request from an application module, sending request data to a serial port; receiving serial port data from a downstream device of the serial port in a time-slice polling manner and buffering it; ending reception when no serial port data is received within a certain time slice, thereby completing the reception of a frame of serial port data, and sending the stored serial port data to the application module.

[0005] In some examples, receiving and caching serial port data from the downstream device of the serial port in a time-slice polling manner includes: determining whether a file corresponding to the device exists, the file including the device's port number, address, and communication parameters; and creating a file for the device if the file does not exist.

[0006] In some examples, receiving and caching serial port data from the downstream device of the serial port in a time-slice polling manner further includes: when the file exists, obtaining a correction parameter for the time value of the time slice from the file to determine the time value of the time slice, and performing time-slice polling based on the time value of the time slice to receive the serial port data.

[0007] In some examples, the serial port management method further includes adjusting the correction parameter based on the read time and actual number of bytes of the current serial port data frame. The read time is converted into the expected number of bytes to be read through the communication parameters of the device; the adjusted correction parameter is calculated as the expected number of bytes to be read / the actual number of bytes.

[0008] In some examples, the serial port management method further includes: instructing the application module to modify the timeout of the device by monitoring the correction parameters, wherein the time slice polling is completed within the timeout period.

[0009] In some examples, the serial port management method further includes: sorting tasks with the same priority on the serial port according to the correction parameters.

[0010] In some examples, the serial port management method further includes: sending heartbeat information to the device based on the file to determine whether the device is online, and reporting abnormal information when it is determined that the device is offline.

[0011] In some examples, the serial port management method further includes: monitoring whether the serial port data has been read completely based on time-slice polling; if not, warning the application module to modify the device's timeout period according to the file, wherein the time-slice polling is completed within the timeout period.

[0012] In some examples, receiving and buffering serial port data from the downstream device of the serial port in a time-slice polling manner includes determining the time value of the time slice, which includes calculating the base time slice time value based on the serial port data transmission and reception request.

[0013] In some examples, determining the time slice value also includes a correction parameter for calculating the time slice value based on the serial port data transmission and reception request; the time slice value is determined by the base time slice value and the correction parameter.

[0014] At least one embodiment of this disclosure also provides a serial port management device, including a processor and a memory. The memory stores computer-executable code, and when the computer-executable code is executed, the serial port management method provided in any of the above embodiments is performed.

[0015] At least one embodiment of this disclosure also provides a computer-readable storage medium having computer-executable code stored thereon, wherein when the computer-executable code is executed, it performs the serial port management method provided in any of the preceding embodiments. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments will be briefly described below. Obviously, the drawings described below only relate to some embodiments of this disclosure and are not intended to limit this disclosure.

[0017] Figure 1A-1B A schematic block diagram of an intelligent converged terminal;

[0018] Figure 2 A flowchart illustrating the steps of a serial port management method provided in at least one embodiment of this disclosure;

[0019] Figure 3 A schematic diagram of a device file provided for at least one embodiment of this disclosure;

[0020] Figure 4 This is a schematic diagram illustrating the steps of a serial port management method provided in another embodiment of the present disclosure;

[0021] Figure 5 A schematic diagram illustrating the steps of a serial port management method provided in yet another embodiment of this disclosure;

[0022] Figure 6 A schematic diagram of a serial port management device provided in at least one embodiment of this disclosure; and

[0023] Figure 7 This is a schematic diagram of a storage medium provided for at least one embodiment of the present disclosure. Detailed Implementation

[0024] The technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Referring to the non-limiting exemplary embodiments shown in the drawings and detailed in the following description, the exemplary embodiments of this disclosure and their various features and advantageous details will be explained more fully. It should be noted that the features shown in the figures are not necessarily drawn to scale. Descriptions of known materials, components, and process technologies are omitted in this disclosure so as not to obscure the exemplary embodiments of this disclosure. The examples given are intended only to facilitate understanding of the implementation of the exemplary embodiments of this disclosure and to further enable those skilled in the art to implement the exemplary embodiments. Therefore, these examples should not be construed as limiting the scope of the embodiments of this disclosure.

[0025] Unless otherwise defined, the technical or scientific terms used in this disclosure shall have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. Without conflict, embodiments of this disclosure and features thereof may be combined with each other to obtain new embodiments.

[0026] Figure 1A-1B This is a schematic block diagram of an intelligent converged terminal. (For example...) Figure 1A As shown, the smart converged terminal for the distribution area includes multiple serial ports (e.g., serial port A, serial port B), each corresponding to a port number. Each serial port may connect to multiple devices, such as meters, circuit breakers, and sensors. In this case, multiple connected devices share the port number corresponding to that serial port to access the serial port resources. For example, the terminal and these devices can exchange data via the RS485 serial channel.

[0027] To adapt to different business needs, intelligent converged terminals in distribution areas often install multiple application modules (APPs), such as intelligent circuit breaker APPs (for example, interacting with circuit breakers) and environmental information acquisition APPs (for example, interacting with sensors). When multiple APPs interact with their corresponding devices through the same serial port, for example, in combination... Figure 1A As shown, when the smart circuit breaker app and the environmental information acquisition app interact with the circuit breaker and sensor respectively via serial port B, the effective allocation of serial port resources becomes an issue. For example, a serial port management module (app) can be set up on the terminal to manage the serial port resources.

[0028] For example, each application module interacts with the serial port management module via the Message Queuing Telemetry Transport (MQTT) protocol. Figure 1B As shown, there is an MQTT broker in the smart converged terminal of the distribution area, and various apps interact through the broker and MQTT messages.

[0029] When an application module needs to use serial port resources to interact with the corresponding serial port device, it sends a corresponding message (such as a data transmission / reception request) to the Broker according to the interface of the serial port management module. The Broker publishes the interface message to the serial port management module through the MQTT message mechanism. The serial port management module sets parameters such as serial port baud rate, parity bit, and parity method according to the relevant parameters in the interface message, and then sends the request data to the corresponding device through the serial port.

[0030] In one serial port management method, the serial port management module waits according to the timeout period in the interface parameters. After the timeout period ends, it returns the data received in its serial port receiving area to the Broker. The MQTT Broker then publishes the data to the corresponding application module according to the subscribed topic, thus completing one (i.e., one frame) data transmission and reception operation.

[0031] In this method, the time to receive data is mainly determined by the timeout period in the interface parameters. When the application module sending the data transmission request sets this parameter, since it does not know how much data will be received in this transmission, it often sets the value to a relatively large value to ensure data integrity. When the serial port request is busy, this will result in a lot of time waiting, wasting serial port resources and easily causing subsequent tasks to time out.

[0032] At least one embodiment of this disclosure provides a serial port management method, including: responding to a serial port data transmission and reception request from an application module, sending request data to a serial port; receiving serial port data from a downstream device of the serial port in a time-slice polling manner and buffering it; ending reception when no serial port data is received within a certain time slice, thereby completing the reception of a frame of serial port data, and sending the stored serial port data to the application module.

[0033] The serial port management method provided in this disclosure improves data transmission and reception efficiency and serial port resource utilization by performing time-slice polling to read data during the reception of a frame of serial port data.

[0034] Figure 2 This is a flowchart illustrating the steps of a serial port management method provided in at least one embodiment of this disclosure. Figure 2 As shown, the serial port management method includes the following steps S21-S23.

[0035] Step S21: In response to the serial port data transmission and reception request from the application module, send request data to the serial port.

[0036] When the serial port management module receives a serial port data transmission / reception request from another application module, it sends the request data to the corresponding serial port.

[0037] For example, the serial port data transmission and reception request includes relevant device information. The serial port management module can parse the corresponding information from the data transmission and reception request to complete the transmission of the requested data.

[0038] For example, the address and port number of the device requesting serial data transmission and reception can uniquely identify the device, allowing the serial port management module to send the request data to the specified downstream device via the serial port.

[0039] For example, the serial port data transmission and reception request can also include the device's communication parameters. The serial port management module sets parameters such as serial port baud rate, parity bit, and parity method according to these communication parameters, and then sends the request data to the serial port accordingly.

[0040] Step S22: Receive serial port data from the downstream device of the serial port in a time-slice polling manner and buffer it.

[0041] After the serial port management module sends request data to the serial port, it begins time-slice polling of the serial port. The serial port then forwards the request data to the corresponding downstream device. The downstream device responds by sending the requested information to the serial port, for example, storing it in the serial port receive buffer. The serial port management module continuously reads the contents of the serial port receive buffer within the time slice, that is, it reads the serial port data in the receive buffer periodically according to the time slice value. For example, the serial port management module can store the received serial port data into the serial port receive area.

[0042] For example, the base time slice value can be calculated using the communication parameters mentioned above. This calculation is based on the baud rate, data bits, parity bits, and stop bits obtained from these communication parameters. For instance, the base time slice value can be obtained according to the following formula:

[0043] Base time slice time value (ms) = baud rate (baud / s) ÷ 1000 × data bits / (1 + data bits + 1 + stop bits) ÷ 8 × M

[0044] The time unit of the basic time slice is ms, and the baud rate unit is baud / s. So, first divide by 1000 to get the number of waves transmitted per millisecond. In the serial port, each wave is equal to one bit. Therefore, the actual number of bits transmitted per millisecond is obtained. Because there are start bits (one byte), parity bits (one byte), and stop bits, not all transmitted bits are data. After conversion using the above formula, the actual number of data bits is obtained. Then, divide by 8 to get the number of bytes transmitted. M is the predetermined length (number of bytes) of the serial port data frame. For example, it is a positive integer greater than or equal to 4, such as 5, 8, or 10. The above result is then multiplied by M to obtain the time value of the basic time slice.

[0045] For example, the time value of a time slice can be determined by the base time slice time value and the correction parameters mentioned above.

[0046] Considering that the above-mentioned basic time slice value is a theoretical value, in the actual serial port data transmission and reception process, due to reasons such as line aging and slow response of downstream devices, the actual expected time value for reading five bytes may differ from the theoretical value. Therefore, a correction parameter needs to be added. The correction parameter is multiplied by the basic time slice value to obtain the actual time slice value.

[0047] For example, the correction parameter can be dynamically calculated by recording the number of bytes in the most recent N serial port data frames read and the read time. For example, N is an integer greater than or equal to 5, such as 8, 10, or 15. The read time can be converted into the expected number of bytes to be read through the device's communication parameters, and the value of the correction parameter can be calculated as the expected number of bytes to be read / the actual number of bytes read. For example, it can be the total number of bytes expected to be read in the most recent N reads / the actual total number of bytes of serial port data (i.e., N frames of data) read in those N reads.

[0048] The correction parameter reflects the real-time communication rate between the terminal and the device. The larger the correction parameter, the slower the communication rate and the more severe the data transmission and reception delay.

[0049] Step S23: If no serial port data is received within a certain time slice, the reception ends, thus completing the reception of one frame of serial port data, and the stored serial port data is sent to the application module.

[0050] By continuously polling within the time slice, if the serial port management module does not receive any serial port data within a certain time slice, it will determine that the serial port data transmission and reception has been completed, stop waiting, and return the serial port data stored in the serial port receiving area to the application module, thereby completing one (one frame) of serial port data transmission and reception.

[0051] In other embodiments, in order to improve the terminal's ability to manage downstream devices, the devices can be archived and various information about the devices can be stored. That is, the devices are abstracted into archives and managed in the serial port management module. In this way, the serial port management module will store various information about the devices, thereby improving the management capabilities of the devices.

[0052] For example, on the smart converged terminal of the distribution area, the serial port management module mainly sends and receives messages of 698.45 and 645. In these two protocols, the address fields are in fixed positions, which are easy to parse and do not require any additional resources. The data sending interface of the serial port management module contains the communication parameters of the device, so a simple file can be created in the serial port management module for management.

[0053] Figure 3 An example of a device profile is shown. Figure 3 As shown, a device's file can contain information such as the device's address, port number, and communication parameters.

[0054] For example, a device can be uniquely identified by its address and port number. Therefore, once a device profile is established, the serial port management module can autonomously access the device based on the profile, thereby improving the device's awareness and management capabilities.

[0055] For example, a heartbeat message can be sent to the device to determine if it is online, and an abnormal message can be reported when the device is offline.

[0056] For example, through the archives, simple tasks can be sent to the device during idle periods to perform keep-alive verification. The keep-alive verification can also be used to check whether the wiring between the smart converged terminal and the meter in the distribution area is normal. If any abnormality is found, relevant alarms can be sent to detect problems early.

[0057] For example, the archive can also include correction parameters for time slice values. Since the correction parameters largely depend on the device's communication capabilities, these correction parameters can be stored in the device's archive by creating an archive for the device. This allows the device's correction parameters to be retrieved directly from the archive during subsequent data reads, eliminating the need for repeated calculations and saving resources.

[0058] For example, since the correction parameters can reflect the real-time communication rate between the terminal and the device, tasks with the same priority on the serial port can be sorted according to the correction parameters, and the order of serial port data transmission can be optimized by creating archives.

[0059] For example, in a serial data transmission interface, only 0 and 1 represent priority. When the number of concurrent tasks is high, tasks with similar priorities and similar processing times can be sorted. In this case, the device's correction parameters can be referenced, and tasks from devices with lower correction parameters in the file, i.e., higher communication rates, can be processed first, thereby improving the overall task completion rate.

[0060] For example, time-slice polling completes within the timeout period set by the application module for the corresponding device, meaning the total time of time-slice polling will not exceed the set timeout. If serial port data is still received within the last time slice, it indicates that the data frame may not have been read completely, meaning the timeout setting is too short. In this case, the corresponding device can be associated with the device file, and a warning can be issued to the application module so that it can modify the timeout corresponding to the device. In this scenario, the serial port management method can also include: monitoring whether the serial port data frame has been read completely based on the time-slice polling results; if not, warning the application module to modify the timeout parameter of the corresponding device based on the device file.

[0061] For example, in some examples, step S22 above may include: determining whether a file exists for the device, and creating a file for the device when no file exists.

[0062] For example, the serial port management module parses the device's port number, address, communication parameters, and other information based on the serial port data transmission and reception requests, and then checks whether a corresponding file exists based on that port number and address. If no file exists, a file is created for the device.

[0063] For example, step S22 may also include: when a file exists, obtaining the correction parameter of the time slice time value from the file to determine the time slice time value, and performing time slice polling based on the time slice time value to receive serial port data.

[0064] For example, the serial port management method also includes adjusting the correction parameter based on the total time and data length (number of bytes) of this data reception.

[0065] For example, the latest corrected parameters can be dynamically calculated using the actual length (number of bytes) of the serial port data frame read this time and the reading time. The reading time can be converted into the expected number of bytes to be read using the device's communication parameters, and the value of the adjusted corrected parameters can be calculated as the expected number of bytes to be read / the actual number of bytes read.

[0066] Dynamically adjusting the correction parameters in preparation for the next data transmission and reception can further improve data transmission efficiency. The adjusted correction parameters can be stored in the corresponding device's file, and the latest correction parameters can be retrieved directly from the file during the next data transmission and reception.

[0067] For example, since the correction parameters can reflect the real-time communication rate between the terminal and the device, the correction parameters in the monitoring archive can also guide the application module to modify the timeout parameters of the corresponding device.

[0068] For example, if the monitored correction parameter is consistently large (e.g., greater than a predetermined value), it indicates that the device's real-time communication rate is low. In this case, the application module can be guided to increase the timeout parameter of the corresponding device to improve the integrity of the received data frames. If the monitored correction parameter is consistently small (e.g., less than a predetermined value), it indicates that the device's real-time communication rate is high. In this case, the application module can be guided to decrease the timeout parameter of the corresponding device to reduce unnecessary waiting and improve the efficiency of data transmission and reception.

[0069] For example, when the serial port management module sends data to an address that is not stored, it will create a file to store the relevant information. Since the number of devices connected to the serial port is actually limited, the storage space consumption of this file is not very large. Furthermore, if no app uses this address for communication for a period of time, the file will be deleted to ensure that the storage space usage is low.

[0070] Figure 4 A flowchart illustrating the steps of a serial port management method provided in other embodiments of this disclosure. For example... Figure 4As shown, the serial port management method includes: responding to a serial port data transmission / reception request from an application module, sending request data to the serial port (step S41); determining whether a file corresponding to the device exists (step S42), for example, the existence of a file corresponding to the device can be determined based on the serial port data transmission / reception request; when no file exists, creating a file for the device based on the serial port data reception request (step S43); when a file exists, obtaining the correction parameter of the time slice time value from the file, thereby determining the time slice time value (step S44); performing time slice polling based on the time slice time value to receive serial port data (step S45); after data is returned, determining whether any time slice returned data is empty, and ending reception if empty (step S46); recording the total time and data length of this data reception, and adjusting the correction parameter to prepare for the next data transmission / reception (step S47); and returning all the serial port data received this time to the corresponding application module (step S48).

[0071] In other examples, access to devices can be initiated autonomously through archives, thereby enhancing device management capabilities.

[0072] Figure 5 A flowchart illustrating the steps of a serial port management method provided in some embodiments of this disclosure. For example... Figure 5 As shown, the serial port management method includes: determining whether the port corresponding to the file is busy; when the port is idle, sending simple data as a heartbeat request to the device corresponding to the file (step S51); for example, the port number and address of the device can be obtained from the file information to locate the device; for example, a general meter frame such as voltage can be sent as a heartbeat request; determining whether the corresponding data has been received (step S52); when the corresponding data is returned, determining that the device is online (step S53); when no data is returned, determining that the device is offline and reporting it (step S54); or when no data is returned, sending a heartbeat again after a period of time; if no data is returned, determining that the device is offline and reporting it.

[0073] At least one embodiment of this disclosure also provides a serial port management device, applicable to the serial port management method provided in any of the above embodiments. The serial port management device can be a terminal device (such as a smart converged terminal for distribution areas, a personal computer, a mobile phone, etc.), or a workstation, server, cloud service, etc.

[0074] Figure 6 This is a schematic diagram of a serial port management device provided in at least one embodiment of the present disclosure. It should be noted that... Figure 6 The serial port management device shown is merely an example and does not impose any limitation on the functionality and scope of use of the embodiments of this disclosure.

[0075] like Figure 6As shown, the serial port management device 400 may include a processor 410 (e.g., a central processing unit, a graphics processing unit, etc.) and a memory (e.g., including a storage device 480, a read-only memory 420, and a random access memory 430). The processor 410 can perform various appropriate actions and processes according to a program stored in the read-only memory (ROM) 420 or a program loaded from the storage device 480 into the random access memory (RAM) 430. The RAM 430 also stores various programs and data required for the operation of the serial port management device 400. The processor 410, ROM 420, and RAM 430 are interconnected via a bus 440. An input / output (I / O) interface 450 is also connected to the bus 440.

[0076] Typically, the following devices can be connected to I / O interface 450: input devices 460 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 470 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 480 including, for example, magnetic tapes, hard disks, etc.; and communication devices 490. Communication device 490 allows serial port management device 400 to communicate wirelessly or wiredly with other electronic devices to exchange data. Although Figure 6 A serial port management device 400 including various devices is shown, but it should be understood that it is not required to implement or have all of the devices shown, and the serial port management device 400 may alternatively implement or have more or fewer devices.

[0077] For example, according to embodiments of this disclosure, the above-described serial port management method can be implemented as a computer software program. For instance, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program including program code for executing the above-described serial port management method. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 490, or installed from a storage device 480, or installed from a ROM 420. When the computer program is executed by the processor 410, it can perform the functions defined in the serial port management method provided in embodiments of this disclosure.

[0078] At least one embodiment of this disclosure also provides a storage medium for storing non-transitory computer program executable code (e.g., computer executable instructions), which, when executed by a computer, can implement the serial port management method described in any embodiment of this disclosure; or, when executed by a computer, the non-transitory computer program executable code can implement the serial port management method described in any embodiment of this disclosure.

[0079] Figure 7 This is a schematic diagram of a storage medium provided according to an embodiment of the present disclosure. For example... Figure 7 As shown, the storage medium 700 non-temporarily stores computer program executable code 701. For example, when the computer program executable code 701 is executed by a computer, one or more steps in the serial port management method described above can be performed.

[0080] For example, the storage medium 700 can be used in the aforementioned serial port management device 400. For example, the storage medium 700 can be... Figure 6 The memory 420 in the serial port management device 400 shown.

[0081] Figure 7 A serial port management device for a chip is provided in some other embodiments of this disclosure, which is applicable to the serial port management method provided in any of the above embodiments.

[0082] The above description is merely an exemplary embodiment of this disclosure and is not intended to limit the scope of protection of this disclosure, which is determined by the appended claims.

Claims

1. A serial port management method, comprising: sending a request data to a serial port in response to a serial port data transceiving request from an application module; receiving serial port data from a device hung to the serial port in a time slice polling manner and caching the serial port data; ending the receiving when no serial port data is received in a time slice, thereby completing a frame of serial port data receiving, and sending the cached serial port data to the application module; wherein the receiving serial port data from the device hung to the serial port in a time slice polling manner and caching the serial port data comprises: determining whether there is a profile corresponding to the device; when there is the profile, obtaining a correction parameter of a time value of the time slice from the profile, thereby determining the time value of the time slice, performing time slice polling according to the time value of the time slice to receive the serial port data.

2. The serial port management method of claim 1, wherein, The receiving serial port data from the device hung to the serial port in a time slice polling manner and caching the serial port data further comprises: when there is no profile, establishing a profile for the device, wherein the profile comprises a port number, an address and a communication parameter of the device.

3. The serial port management method of claim 1, further comprising: adjusting the correction parameter according to a reading time and an actual byte number of the serial port data frame, wherein the reading time is converted into an expected reading byte number by the communication parameter of the device; and the adjusted correction parameter is calculated as the expected reading byte number / the actual byte number.

4. The serial port management method of claim 3, further comprising: guiding the application module to modify a timeout time of the device by monitoring the correction parameter, wherein the time slice polling is completed within the timeout time. 5.The serial port management method of claim 1, further comprising: sorting tasks of the same priority of the serial port according to the correction parameter. 6.The serial port management method of claim 2, further comprising: sending heartbeat information to the device according to the profile to determine whether the device is online, reporting abnormal information when it is determined that the device is not online.

7. The serial port management method of claim 2, further comprising: monitoring whether the serial port data is read completely according to a time slice polling situation, and if not, warning the application module to modify a timeout time of the device according to the profile, wherein the time slice polling is completed within the timeout time.

8. The serial port management method of claim 1, wherein, The receiving serial port data from the device hung to the serial port in a time slice polling manner and caching the serial port data comprises determining a time value of the time slice, determining the time value of the time slice comprises determining a basic time slice time value and a correction parameter. 9.A serial port management apparatus, comprising: a processor, and a memory, wherein the memory stores computer executable code which, when executed, performs the serial port management method of any one of claims 1-8.

Citation Information

Patent Citations

  • MPU and FPGA extended multi-serial-port implementation method

    CN109857685A

  • System for punctually sending and receiving serial data and a method for sending and receiving the serial data

    US20010056514A1