Self-adaptive baud rate negotiation method, system, equipment and medium
By employing an adaptive baud rate negotiation method, binary search, and packet loss rate testing, the IO-Link communication rate is dynamically adjusted, solving the communication efficiency limitation problem caused by fixed baud rates in existing technologies and improving the system's performance and stability in complex environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-03-27
AI Technical Summary
The fixed baud rate in the existing IO-Link protocol cannot utilize the excess bandwidth potential of the physical channel, resulting in suboptimal communication efficiency and limiting the improvement of overall system performance, especially in complex electromagnetic environments and diverse wiring conditions.
An adaptive baud rate negotiation method is adopted, which uses a binary search algorithm to select the highest available baud rate and combines packet loss rate testing to dynamically adjust the communication rate to adapt to channel conditions, ensuring stability and efficiency.
It improves the data transmission performance of the communication system under excellent channels and enhances its survivability under poor channels, achieving adaptability and robustness in complex industrial environments.
Smart Images

Figure CN121750156A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation technology, specifically to an adaptive baud rate negotiation method, system, device, and medium. Background Technology
[0002] With the rapid development of industrial automation technology, higher demands are being placed on the real-time performance, integration, and environmental adaptability of distributed I / O systems. In modern intelligent manufacturing, logistics, and robotics applications, it is often necessary to process multiple types of signals simultaneously on a single control node: connecting a large number of underlying sensors and actuators (such as photoelectric switches, RFID readers, valve islands, etc.) while integrating high-speed digital / analog I / O modules. The IO-Link protocol, as a point-to-point serial communication protocol independent of fieldbuses, has become the standard interface for connecting underlying devices due to its powerful parameter configuration and diagnostic functions.
[0003] IO-Link is a fieldbus-independent point-to-point serial communication protocol for connecting sensors and actuators, and it has become an IEC 61131-9 international standard. One of its core features is the definition of three fixed communication baud rates: COM1 (4.8 kbps), COM2 (38.4 kbps), and COM3 (230.4 kbps). During the device power-on initialization phase, the IO-Link master station and the device (such as the sensor or actuator described below) attempt to establish a communication connection through a fixed handshake sequence (Wake-up, SD0, SD1, SD2). This negotiation mechanism stipulates that the master station must start by attempting the highest rate, COM3. If this fails, it will degrade to COM2, then COM1, until a valid response is received from the device. Once the connection is established, the baud rate remains fixed throughout the communication cycle.
[0004] The closest existing technology is the fixed baud rate and initialization negotiation mechanism defined in the IO-Link protocol specification itself, which is clearly described in its official specification documents such as "IO-Link Interface and System Specification". This technology is the common standard followed by all compliant IO-Link master modules and devices.
[0005] While the aforementioned standard protocols achieve basic interoperability, their inherent limitations become increasingly apparent in practical industrial applications, especially in complex electromagnetic environments and diverse cabling conditions. The three baud rates specified in the standard are pre-set fixed values. When the connection cable between the IO-Link master station and the device is short, of high quality, or in a favorable electromagnetic environment, the actual transmission capacity of the physical channel may far exceed the bandwidth required by COM3 (230.4 kbps). However, existing technologies cannot utilize this excess bandwidth potential to provide higher communication rates, resulting in communication efficiency falling short of its optimal state under current physical conditions and limiting the improvement of overall system performance. Summary of the Invention
[0006] The purpose of this invention is to provide an adaptive baud rate negotiation method, system, device, and medium, which solves the problems in the prior art.
[0007] This invention is achieved through the following technical solution:
[0008] In a first aspect, embodiments of the present invention provide an adaptive baud rate negotiation method, applied to an adaptive baud rate negotiation system, the system including a device and a master station supporting extended baud rates, the method comprising:
[0009] If the device supports extended baud rate, then obtain a list of available baud rates that are supported by both the main station and the device, and sort the baud rates in the list of available baud rates in descending order of their numerical values;
[0010] The highest available baud rate is determined by performing a binary search loop filter based on the available baud rate list.
[0011] The packet loss rate is tested based on the highest available baud rate to determine the working baud rate;
[0012] After the master station and the device have been operating stably according to the working baud rate, the communication quality of the master station and the device is checked according to a preset period to obtain the error rate;
[0013] If the error rate exceeds the preset error rate threshold for multiple consecutive periods, then select the next baud rate from the available baud rate list to perform a packet loss rate test and update the working baud rate.
[0014] Preferably, if the device supports extended baud rates, a list of available baud rates jointly supported by the main station and the device is obtained. The baud rates in the list of available baud rates are sorted in descending order of their numerical value, including:
[0015] Determine whether the device supports extended baud rate;
[0016] If the device supports extended baud rates, then the main station receives a baud rate capability bitmap returned by the device, which includes multiple standard baud rates and multiple non-standard extended baud rates.
[0017] The baud rates supported by the main station are determined based on the baud rate capability bitmap, resulting in a set of commonly supported baud rates;
[0018] The baud rates in the baud rate set are sorted from highest to lowest value to obtain a list of available baud rates.
[0019] Preferably, determining whether the device supports extended baud rate includes:
[0020] At the standard baud rate, a query is initiated by writing a command code to the predefined index address of the device from the master station.
[0021] If the device returns a baud rate capability bitmap, then the device supports extended baud rates;
[0022] If the device returns an error message, then the device does not support extended baud rates.
[0023] Preferably, the step of performing a binary search loop to filter the available baud rate list and determine the highest available baud rate includes:
[0024] A binary search loop is performed based on the available baud rate list. Each round of the binary search loop includes:
[0025] Determine the median baud rate in the list of available baud rates;
[0026] Set the intermediate baud rate to the current baud rate of the master station and the device;
[0027] After the setup is complete, start the intensive communication test according to the main station instructions;
[0028] If the intermediate baud rate passes the dense communication test, then the list of available baud rates that are greater than the intermediate baud rate will be used as the list of available baud rates for the next round of filtering.
[0029] If the intermediate baud rate fails the dense communication test, the list of available baud rates that are lower than the intermediate baud rate will be used as the list of available baud rates for the next round of filtering.
[0030] Repeat the binary search loop filtering until the search interval is empty, then take the last baud rate that passes the dense communication test as the highest available baud rate.
[0031] Preferably, the dense communication test involves sending dense communication data from the master station to the device within a preset time period to monitor CRC errors and frame loss rate.
[0032] Preferably, the step of determining the working baud rate by performing packet loss rate testing based on the highest available baud rate includes:
[0033] Initiate the packet loss rate test based on the highest available baud rate;
[0034] If the highest available baud rate passes the packet loss rate test, then the highest available baud rate will be used as the working baud rate for the master station and the device.
[0035] If the highest available baud rate fails the packet loss rate test, then select the next baud rate from the available baud rate list to start the packet loss rate test until the packet loss rate test is passed, and obtain the working baud rate of the master station and the device.
[0036] Preferably, the step of selecting the next available baud rate from the list of available baud rates to start the packet loss rate test if the highest available baud rate fails the packet loss rate test includes:
[0037] If the maximum available baud rate fails the packet loss rate test, the connection between the master station and the device is re-established according to the preset watchdog timer and standard baud rate.
[0038] Once the connection is established, select the next highest available baud rate from the list of available baud rates to start the packet loss rate test.
[0039] Secondly, embodiments of the present invention provide an adaptive baud rate negotiation system, including a master station and devices;
[0040] The master station includes a master controller and a master station physical layer chip;
[0041] The device includes a device controller and a device physical layer chip;
[0042] The main controller is configured to perform the following operations:
[0043] After establishing an initial connection with the device, by exchanging extended capability information, an ordered list of available baud rates supported by both the main station and the device is obtained and generated;
[0044] Based on the ordered list of available baud rates, the highest available candidate baud rate is determined by controlling the baud rate switching of the main station physical layer chip and performing connectivity tests, and using a binary search algorithm to filter and determine the highest available candidate baud rate.
[0045] Starting with the highest available candidate baud rate, the final working baud rate is verified and determined by initiating a targeted packet loss rate test;
[0046] After entering steady-state communication at the specified working baud rate, communication error statistics are periodically read from the master station physical layer chip, and monitoring is performed according to a preset hysteresis strategy.
[0047] When the monitoring results meet the rate reduction conditions, a new round of adaptive negotiation process is triggered to select a new candidate baud rate from the ordered list of available baud rates and perform a packet loss rate test to update the working baud rate.
[0048] Thirdly, embodiments of the present invention provide an electronic device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method of the first aspect described above.
[0049] Fourthly, embodiments of the present invention provide a storage medium storing computer program instructions, which, when executed by a processor, implement the method of the first aspect described above.
[0050] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0051] First, during system initialization, the method establishes a clear decision-making basis for rate selection through capability negotiation and ordered list construction. Subsequently, a binary search algorithm is used instead of the traditional linear rate reduction attempt, enabling the rapid identification of the potential highest available rate with fewer attempts under favorable channel conditions, reducing initial latency in communication establishment. Second, after determining the candidate highest rate, a verification step based on quantitative packet loss rate testing is introduced. This step elevates the rate judgment from simply whether connectivity is possible to whether stable, error-free transmission is possible, avoiding frequent runtime errors caused by selecting a critically unstable rate, thereby improving the reliability of long-term operation after initial connection. Third, after the system enters steady-state operation, channel status is not stopped but continuously monitored through periodic communication quality checks. When the error rate is detected to deteriorate and exceed a threshold over multiple consecutive cycles, a rate reduction and renegotiation process is proactively triggered. This enables the system to cope with dynamic degradation of channel conditions during operation, prioritizing the maintenance of uninterrupted communication links by proactively reducing the rate, enhancing the system's adaptability and robustness in complex industrial environments. Overall, this invention transforms IO-Link communication from a fixed, static connection mode into an intelligent system capable of dynamically balancing and automatically adjusting between pursuing higher transmission efficiency and ensuring stable communication connections based on real-time channel conditions. It not only improves data transmission performance under favorable channel conditions but also enhances survivability under adverse channel conditions. Attached Figure Description
[0052] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be considered as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:
[0053] Figure 1 This is a flowchart illustrating the adaptive baud rate negotiation method provided by the present invention.
[0054] Figure 2 This is a schematic diagram of the adaptive baud rate negotiation system provided by the present invention;
[0055] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0057] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0058] It should be noted that all actions involving the acquisition of signals, information, or data in this invention are carried out in compliance with the relevant data protection laws and regulations of the locality and with authorization from the owner of the relevant device.
[0059] Example 1
[0060] Please see Figure 1 This invention provides an adaptive baud rate negotiation method applied to an adaptive baud rate negotiation system, the system including a device and a master station supporting extended baud rates, the method including:
[0061] S1. If the device supports extended baud rate, obtain a list of available baud rates that are supported by both the main station and the device. The baud rates in the list of available baud rates are sorted in descending order of their numerical values.
[0062] Specifically, extended baud rate refers to a communication rate distinct from the predefined COM1, COM2, and COM3 rates in the IO-Link standard protocol, with a value range that can be higher, lower, or within the standard baud rate. Step S1 begins with the master station and device establishing a basic communication connection via a standard handshake. Subsequently, the master station initiates a capability query request to the device through a pre-defined communication channel, inquiring about the range of baud rates the device supports. Upon receiving the query, the device replies with its supported baud rate set in structured data, such as a bitmap, where each bit represents the support status for a specific baud rate. After receiving the device's reply, the master station compares and performs logical operations on this reply data with its internally stored set of supported baud rates, such as performing a bitwise AND operation, to filter out all baud rates supported by both parties. Then, the master station sorts these common baud rates from highest to lowest value, ultimately generating an ordered list of available baud rates. This process, through systematic capability discovery and data integration, constructs a clear search space for subsequent steps and ensures that the basis for subsequent search operations is a mutually agreed-upon and ordered set of candidate rates.
[0063] S2. Perform a binary search loop filter based on the available baud rate list to determine the highest available baud rate;
[0064] Specifically, the highest available baud rate refers to the highest candidate baud rate that can maintain basic communication connectivity without persistent errors under the current physical channel conditions. Step S2 takes the ordered list of available baud rates output from S1 as input and uses a binary search algorithm for iterative filtering. The algorithm initially sets the search interval to the entire list, determining a candidate baud rate to be tested by calculating an intermediate index. The master station controls the communication link to switch to this candidate rate and performs a brief stability check, such as monitoring frame transmission success or the occurrence of underlying hardware error indications within a set duration. If the check passes, the rate is considered available under the current conditions, and the algorithm raises the lower bound of the search interval to after the current index to continue exploring higher rate intervals. If the check fails or communication is completely interrupted, the rate is considered unavailable, and the algorithm lowers the upper bound of the search interval to before the current index to continue searching in lower rate intervals. This process iterates until the search interval is empty, and the candidate baud rate that passes the last check is determined as the highest available baud rate. This step uses a logarithmic binary search algorithm instead of a linear approach that starts with the highest speed and gradually decreases the speed. This allows for a quicker determination of the approximate upper limit of the channel capacity with fewer attempts, reducing the waiting time in the early stages of negotiation.
[0065] S3. Perform a packet loss rate test based on the highest available baud rate to determine the working baud rate;
[0066] Specifically, packet loss rate testing is a method for quantitatively evaluating the reliability of data transmission at a specific baud rate. It is typically achieved by sending a known test data sequence and statistically analyzing the proportion of data that the receiver fails to receive correctly. Step S3 uses the highest available baud rate determined in S2 as the starting point for verification. The master station and device switch to a dedicated test mode at the target baud rate. The master station generates a test data sequence with good autocorrelation characteristics and continuously sends it to the device via the communication link. After receiving the data, the device typically buffers it and sends it back to the master station as is, or performs a local comparison and returns the statistical results. The master station compares the sent and received data content to count the number of data units that are erroneous or lost during transmission, thereby calculating the actual packet loss rate at the current baud rate. If the calculated packet loss rate is zero, the baud rate is deemed to meet the stability requirements for error-free transmission and is determined as the final working baud rate. If the packet loss rate is not zero, it indicates instability at that rate. The master station lowers the candidate rate to the next lower baud rate in the list and repeats the above test process until a highest rate with a zero packet loss rate is found as the working baud rate. This step overcomes the limitations of relying solely on connectivity judgment by introducing quantized bit error rate verification, ensuring that the selected operating baud rate not only enables connectivity but also provides stable data transmission under current channel conditions.
[0067] S4. After the master station and the device have been operating stably according to the working baud rate, the communication quality of the master station and the device is checked according to a preset period to obtain the error rate;
[0068] Specifically, the error rate is a metric that measures the reliability of a communication link during stable operation, typically referring to the ratio of parity errors or frame errors occurring per unit time or unit of data volume. Step S4 is executed after the operating baud rate is determined and the system enters a stable data transmission phase. A periodic daemon task runs within the master station, triggered at preset time intervals. In each monitoring cycle, the master station obtains raw data such as cyclic redundancy check (CRC) error counts, frame loss counts, or physical layer signal anomaly indications by accessing the internal status registers of its physical layer interface chip or by analyzing statistics from the communication protocol stack. The master station processes this raw data, for example, by dividing the error count by the total number of transmitted frames or the total runtime in that cycle, to obtain an error rate value characterizing the communication quality of the current cycle. This continuous monitoring process provides the system with feedback information about channel state changes over time.
[0069] S5. If the error rate exceeds the preset error rate threshold for multiple consecutive periods, select the next baud rate from the available baud rate list to perform a packet loss rate test and update the working baud rate.
[0070] Specifically, the preset error rate threshold is a pre-set threshold value based on system reliability requirements, used to determine whether the current communication quality has deteriorated to the point where adjustment is necessary. Step S5 operates based on the series of error rate data continuously monitored in S4. The system maintains a state machine or counter to track the continuity of the error rate exceeding the preset threshold. When the error rate is detected to exceed the threshold for multiple consecutive monitoring periods, it indicates that the channel conditions may have continuously deteriorated, and the communication stability at the current operating baud rate can no longer meet the requirements. At this time, the system triggers a dynamic adjustment process. The master station first selects the next lower baud rate from the list of available baud rates generated in S1, i.e., the adjacent baud rate with a lower value, as a new candidate rate. Subsequently, the system executes the packet loss rate test process described in S3 again for this new candidate rate to verify whether communication can be restored to a stable error-free or low-error state at this reduced rate. If the test passes, the rate is updated to the new operating baud rate; if the test still fails, the rate may continue to decrease and the test may be repeated. This step enables the system to proactively respond to negative changes in channel conditions during operation, prioritizing the continuity of communication connections by reducing the data rate, thus achieving adaptation to dynamic environments.
[0071] In some implementations, S1, if the device supports extended baud rates, then a list of available baud rates jointly supported by the main station and the device is obtained. The baud rates in the list are sorted in descending order of numerical value, including:
[0072] S11. Determine whether the device supports extended baud rate;
[0073] Specifically, the process involves determining whether the device supports extended baud rates. This step begins with the master station initiating a capability query. This query is performed after standard IO-Link communication is established, using a vendor-specific parameter channel, such as an ISDU channel, to send a query command to a predefined address on the device. If the device does not support extended baud rate functionality, it will not respond to this specific query or will return a standard error response indicating lack of support. The master station determines whether the device supports extended baud rate negotiation by detecting whether it receives valid, structured capability response data within a predetermined time. This determination establishes the prerequisite for subsequent steps, avoiding the sending of unrecognizable commands to traditional devices, thus ensuring backward compatibility and allowing the new method to coexist with traditional devices within the same system.
[0074] Further, determining whether the device supports extended baud rate includes:
[0075] At the standard baud rate, a query is initiated by writing a command code to the predefined index address of the device from the master station.
[0076] If the device returns a baud rate capability bitmap, then the device supports extended baud rates;
[0077] If the device returns an error message, then the device does not support extended baud rates.
[0078] S12. If the device supports extended baud rates, then the main station receives a baud rate capability bitmap returned by the device, the baud rate capability bitmap including multiple standard baud rates and multiple non-standard extended baud rates.
[0079] Specifically, the baud rate capability bitmap includes multiple standard baud rates and multiple non-standard extended baud rates. Once the master station confirms that the device supports extended functionality, it receives the baud rate capability bitmap in response from the device. This baud rate capability bitmap is a compact data structure, typically a multi-bit data unit, such as a 32-bit integer. Each bit maps to a specific baud rate; a bit set to 1 indicates support for that rate, and a bit set to 0 indicates no support. The baud rates covered by the bitmap include not only the standard baud rates mandated by the IO-Link protocol (such as COM1, COM2, COM3), but also extended baud rates defined by the device manufacturer that exceed the standard range (e.g., 460.8kbps, 921.6kbps). Through this bitmap, the device clearly informs the master station of the full range of communication rates supported by its hardware physical layer. This process completes the digital reporting of device capabilities, providing the master station with the raw data foundation needed for intelligent decision-making.
[0080] S13. Determine the baud rates supported by the main station based on the baud rate capability bitmap to obtain a set of commonly supported baud rates;
[0081] Specifically, after receiving the device's baud rate capability bitmap, the master station does not directly adopt it, but needs to match it with its own capabilities. The master station also maintains a similar bitmap or list representing the baud rates supported by its own hardware. The master station performs a logical comparison operation, such as a bitwise AND operation, between the received device bitmap and its own supported baud rate list. The result of this operation is a new bitmap, where the corresponding bit in the resulting bitmap is 1 only if a certain bit is set to 1 in both the master station's and the device's bitmaps. This resulting bitmap represents the set of baud rates that both the master station and the device's hardware can support; this is called the set of commonly supported baud rates. This step, through the intersection operation of these sets, filters out mutually operable options from the complete set of capabilities of both parties, ensuring that any subsequent rate switching attempts are physically feasible.
[0082] S14. Sort the baud rates in the baud rate set according to their numerical values to obtain a list of available baud rates.
[0083] Specifically, after obtaining the set of commonly supported baud rates, the master station needs to convert this set into an ordered data structure for use by subsequent algorithms. The master station extracts each specific baud rate value from the set of commonly supported baud rates, and then compares and sorts these values according to their magnitude. The sorting rule is usually descending order from high to low, that is, the baud rate with the largest value (the fastest communication rate) is at the beginning of the list, and the baud rate with the smallest value is at the end of the list. The resulting ordered sequence is the list of available baud rates. This list is the direct object of operation for subsequent search and decision algorithms. Sort the rates from high to low, which conforms to the general optimization logic of starting with the optimal performance and gradually reducing performance to ensure stability, providing a structured input for the subsequent efficient binary search algorithm.
[0084] In some implementations, S2, performing a binary search loop to filter the available baud rate list and determine the highest available baud rate, includes:
[0085] A binary search loop is performed based on the available baud rate list. Each round of the binary search loop includes:
[0086] Determine the median baud rate in the list of available baud rates;
[0087] Set the intermediate baud rate to the current baud rate of the master station and the device;
[0088] After the setup is complete, start the intensive communication test according to the main station instructions;
[0089] If the intermediate baud rate passes the dense communication test, then the list of available baud rates that are greater than the intermediate baud rate will be used as the list of available baud rates for the next round of filtering.
[0090] If the intermediate baud rate fails the dense communication test, the list of available baud rates that are lower than the intermediate baud rate will be used as the list of available baud rates for the next round of filtering.
[0091] Repeat the binary search loop filtering until the search interval is empty, then take the last baud rate that passes the dense communication test as the highest available baud rate.
[0092] Specifically, this step takes the available baud rate list generated in S14 as input and aims to efficiently locate the highest available rate under the current channel conditions within the list. The binary search loop filtering process begins by defining the entire available baud rate list as the initial search interval. In each filtering loop, the intermediate index of the current search interval is first calculated to determine the intermediate baud rate corresponding to that index. This intermediate baud rate is the candidate rate to be evaluated in this round. Subsequently, the master station switches its own communication rate to this intermediate baud rate by configuring the registers of its physical layer interface, and simultaneously notifies the device to also switch its communication rate synchronously via command, thereby completing the setting of the current baud rate. After the setting is completed, the master station immediately starts an intensive communication test, which refers to continuously sending a series of communication requests to the device at this intermediate baud rate within a preset short period of time, such as 100 milliseconds, and strictly monitoring the response status and data integrity of each request. The monitoring criteria include, but are not limited to, whether a valid response frame is received, whether the cyclic redundancy check of the response frame is correct, and whether a communication timeout occurs. If all monitored indicators are normal during the test, the intermediate baud rate is considered to have passed the dense communication test, indicating that this rate has basic connectivity and stability under the existing channel conditions. There is still potential to explore higher speeds. Therefore, the lower bound of the search interval is updated to the portion after the current intermediate index, i.e., the sublist of baud rates greater than the intermediate baud rate in the list, as the search interval for the next round. Conversely, if any communication errors or connection losses are detected during the test, the intermediate baud rate is considered to have failed the test, indicating that this rate is unreliable under the current conditions. In this case, the upper bound of the search interval should be updated to the portion before the current intermediate index, i.e., the sublist of baud rates less than the intermediate baud rate in the list, as the search interval for the next round. This binary search loop will continue to be executed repeatedly, halving the size of the search interval in each iteration until the search interval is empty, i.e., it cannot be further divided. At this point, the last baud rate in the entire list that was recorded as having passed the dense communication test during the iteration process is determined as the highest available baud rate. This step introduces a binary search strategy based on an ordered list, reducing the number of attempts to find the highest available rate from a linear complexity proportional to the list length to a logarithmic complexity. Thus, under favorable channel conditions, it can lock in the high rate faster than the traditional method of gradually decreasing the rate from the highest speed, shortening the negotiation time for system initialization.
[0093] Furthermore, the dense communication test involves sending dense communication data from the master station to the device within a preset time period to monitor CRC (Cyclic Redundancy Check) errors and frame loss rate.
[0094] In some implementations, S3, determining the working baud rate by performing a packet loss rate test based on the highest available baud rate, includes:
[0095] S31. Start the packet loss rate test according to the highest available baud rate;
[0096] Specifically, starting with the highest available baud rate obtained through binary search, a more rigorous reliability verification is initiated. The packet loss rate test is a quantitative test evaluating the integrity and accuracy of data transmission at a specific baud rate. Initiating this test means that the master station and the device will switch to a dedicated test mode. In this mode, the master station generates and sends a structured test data sequence with known content, such as a pseudo-random binary sequence with good autocorrelation properties, to the device via the communication link. After receiving the sequence, the device does not perform routine business data processing. Instead, according to a predetermined test protocol, it buffers the received data and returns it to the master station as is in the next communication cycle, or performs real-time comparison locally and returns the statistical results to the master station. Simultaneously with sending the test data, the master station starts a timer or counter to limit the test duration or data volume. This process aims to simulate stable data transmission over a period of time to obtain channel quality indicators that are more statistically significant than rapid connectivity tests.
[0097] S32. If the highest available baud rate passes the packet loss rate test, then the highest available baud rate shall be used as the working baud rate of the master station and the device.
[0098] Specifically, the core criterion for determining whether the maximum available baud rate passes the packet loss rate test is the quantified packet loss rate or bit error rate result. After the master station completes the transmission and reception comparison of the test sequence, it calculates the proportion of data units that are erroneous or lost during this test to the total number of transmissions, i.e., the packet loss rate. The system predefines an acceptable packet loss rate threshold, usually set to zero, i.e., requiring no transmission errors. If the calculated actual packet loss rate is lower than or equal to this preset threshold, the maximum available baud rate is determined to have passed the packet loss rate test, indicating that under the current channel conditions, long-term data transmission at this rate is stable and reliable. At this point, the master station officially determines this maximum available baud rate as the baud rate used in the subsequent stable operation phase of the system, i.e., the operating baud rate. The master station and the equipment then exit the test mode, switch to this rate, and enter the normal application data exchange phase. This decision ensures that the system operates at the highest and most stable performance level supported by the current physical environment after startup.
[0099] S33. If the highest available baud rate fails the packet loss rate test, select the next baud rate from the available baud rate list to start the packet loss rate test until the packet loss rate test is passed, and obtain the working baud rate of the main station and the device.
[0100] Specifically, if the actual packet loss rate calculated at the highest available baud rate exceeds a preset acceptable threshold, the rate is deemed to have failed the test, indicating that its stability in connectivity testing is insufficient to support error-free data transmission. In this case, the system initiates a progressively slower verification process. The master station locates the highest available baud rate that failed the test from the list of available baud rates generated in S14 and selects the next adjacent rate with a lower value—the next baud rate level—as a new candidate for verification. The system then restarts the packet loss rate test process described in S31 at this new rate. This test-judgment-slowdown cycle continues until a baud rate level meets the stability requirements in the packet loss rate test, i.e., passes the test. The first baud rate to pass the test is determined as the final operating baud rate. This step, by introducing rigorous, quantitative stability verification, calibrates the initial results of the binary search, preventing the misjudgment of high rates in a critically stable state as reliable operating rates, thereby improving the system's long-term robustness and ensuring the accuracy of data transmission.
[0101] In some implementations, S33, if the highest available baud rate fails the packet loss rate test, then a baud rate below the highest available baud rate is selected from the available baud rate list to initiate the packet loss rate test, including:
[0102] If the maximum available baud rate fails the packet loss rate test, the connection between the master station and the device is re-established according to the preset watchdog timer and standard baud rate.
[0103] Once the connection is established, select the next highest available baud rate from the list of available baud rates to start the packet loss rate test.
[0104] Specifically, this step describes the system recovery and secure retry mechanism after a high-rate verification failure. The watchdog here refers to a hardware or software timer used to monitor the activity of the communication link. When no valid communication activity is detected within a specified time, the timer times out and triggers a system reset or state recovery. The standard baud rate refers to the fixed communication rate explicitly defined in the IO-Link protocol that all compliant devices must support, such as COM3 (230.4 kbps). When the highest available baud rate fails the packet loss rate test, it means that continuous communication errors or a complete data link interruption may have occurred at that rate. At this time, the communication state may have entered an uncertain or suspended abnormal state. To reliably recover from this abnormal state, the system activates a preset watchdog mechanism. The independent watchdogs at both the master station and the device time out successively due to the lack of valid communication, each triggering a local communication state machine reset. After the reset, both parties fall back to a pre-negotiated or enforced standard baud rate and issue an alarm, then re-execute the standard connection establishment sequence at this rate, such as the wake-up and handshake process specified in the IO-Link protocol. This process ensures that the communication link is re-established at a known and stable base rate. Once the base connection is successfully restored, the master station is ready to attempt adaptive negotiation again. Instead of blindly starting from scratch, the master station uses existing knowledge to select a baud rate one level lower than the previous failed rate from the available baud rate list as a new candidate rate, and then restarts the packet loss rate test. This step, by introducing watchdog monitoring and a forced recovery process to fall back to the standard rate, provides a safety net for the high-risk operation of high-rate attempt failures, preventing a complete communication lock-up or device unresponsiveness due to the negotiation process. It ensures that the system can still return to a usable basic working state in the worst-case scenario, thereby enhancing the fault tolerance and engineering practicality of the entire negotiation process.
[0105] For example:
[0106] 1. Capability Discovery and Initialization
[0107] Step 1.1: The main station initiates a capability query and receives a device response.
[0108] The master station reads data from index 0x5001 at the standard COM3 rate, and the slave station replies to the master station with a 32-bit baud rate capability bitmap.
[0109] Bitmap definition example:
[0110] Bit0: Supports COM1 (4.8kbps)
[0111] Bit1: Supports COM2 (38.4kbps)
[0112] Bit2: Supports COM3 (230.4kbps)
[0113] Bit3: Supports 460.8kbps
[0114] Bit4: Supports 921.6kbps
[0115] Bit5-31: Reserved
[0116] Step 1.2: The main site builds the probe list
[0117] The main station parses the bitmap returned by the device, performs a bitwise AND operation with its own list of supported baud rates, and obtains the set of baud rates that are commonly supported.
[0118] Sort the set by baud rate value from high to low to generate an ordered list of available baud rates, for example, [921600, 460800, 230400].
[0119] Initialize algorithm parameters: list length N=3, low=0, high=2.
[0120] Phase 1: Rapid coarse adjustment - binary search positioning
[0121] The main site calculates the intermediate index: mid=(0+2) / 2=1.
[0122] The master station writes the target baud rate code (e.g., 0x03 represents 460.8kbps) to device index 0x5001 via ISDU. After sending, both sides synchronously switch the set baud rate.
[0123] After a successful switchover, the master station started a 100ms-long intensive communication test at the new baud rate (460.8kbps).
[0124] During this period, the master station continuously sends short frames requesting basic diagnostic data of the device (such as product ID) and monitors the CRC error rate and frame response timeout rate.
[0125] Status: 460.8kbps, no errors.
[0126] Decision: This rate is stable; a higher rate may exist. Let low = mid + 1 = 2.
[0127] Action: In the next loop, we will try mid=(2+2) / 2=2, which is 921.6kbps.
[0128] After switching to 921.6kbps
[0129] Situation: Communication completely lost
[0130] Decision: The handover resulted in a communication interruption.
[0131] Action: Slave: Local watchdog timeout (150ms), automatically falls back to safe baud rate (COM3), waiting for master to wake up again. Master: Detects communication interruption, immediately switches back to COM3, resends standard wake-up sequence to establish connection.
[0132] The loop terminates, and the highest working baud rate of 460.8kbps is found.
[0133] 3. Phase Two: Precise Tuning - Bit Error Rate Verification
[0134] Step 3.1: Start the stress test
[0135] The main station locked the candidate rate Rates[high] (460.8kbps) as the fine-tuning target.
[0136] The master station starts the bit error rate test mode by writing 0x20 through the ISDU command (index 0x5002) and agrees on a test duration of 0x20 (32 seconds).
[0137] Step 3.2: Perform packet loss rate test
[0138] The main site generates a relatively long pseudo-random binary sequence (PRBS).
[0139] The master station sends the sequence to the device via process data transmission.
[0140] After receiving the data, the device performs no processing and directly transmits the entire data block back to the master station in the next cycle via process data. The master station compares the received data with the original sequence. If they match, there is no packet loss; otherwise, there is packet loss. After 10,000 comparisons, the packet loss rate is calculated to be 0%, and the process proceeds to stage three.
[0141] 4. Phase Three: Steady-State Operation and Anomaly Resistance
[0142] Step 4.1: Steady-state protection
[0143] The system runs normally at the final selected baud rate of 460.8kbps.
[0144] The main site initiates a periodic daemon task, which executes once per minute:
[0145] Read the diagnostic register of the PHY chip to obtain the CRC error count.
[0146] Check if the error count exceeds the preset threshold.
[0147] Communication interruption handling:
[0148] The master and slave devices' communication watchdog (3-second timeout) detected a connection loss. Both devices independently performed emergency recovery: resetting the communication state machine and falling back to the safe baud rate (COM3). The master station restarted the standard IO-Link handshake sequence, and after establishing the connection, retried the entire adaptive process (starting from phase one).
[0149] Handling consecutive failures:
[0150] If the watchdog times out three times in a row, the baud rate is locked to the preset "safe baud rate" (such as COM3), and an alarm is sent to the host computer to ensure that the device can continue to operate in at least the standard mode.
[0151] Example 2
[0152] Please see Figure 2 This invention provides an adaptive baud rate negotiation system, including a master station and devices;
[0153] The master station includes a master controller and a master station physical layer chip;
[0154] The device includes a device controller and a device physical layer chip;
[0155] The main controller is configured to perform the following operations:
[0156] After establishing an initial connection with the device, by exchanging extended capability information, an ordered list of available baud rates supported by both the main station and the device is obtained and generated;
[0157] Based on the ordered list of available baud rates, the highest available candidate baud rate is determined by controlling the baud rate switching of the main station physical layer chip and performing connectivity tests, and using a binary search algorithm to filter and determine the highest available candidate baud rate.
[0158] Starting with the highest available candidate baud rate, the final working baud rate is verified and determined by initiating a targeted packet loss rate test;
[0159] After entering steady-state communication at the specified working baud rate, communication error statistics are periodically read from the master station physical layer chip, and monitoring is performed according to a preset hysteresis strategy.
[0160] When the monitoring results meet the rate reduction conditions, a new round of adaptive negotiation process is triggered to select a new candidate baud rate from the ordered list of available baud rates and perform a packet loss rate test to update the working baud rate.
[0161] Specifically, the master station and the device are the core physical entities for implementing the adaptive function. The master station, as the initiator and control center of communication, has core hardware including a master controller and a master station physical layer chip. The master controller is typically a microprocessor or microcontroller, such as a chip based on an ARM Cortex-M core. It is the computational and control center of the entire adaptive algorithm, responsible for executing logical judgments, maintaining data lists, running binary search and hysteresis monitoring algorithms, and coordinating all steps through software instructions. The master station physical layer chip, such as a dedicated IO-Link master transceiver like the MAX14819, is the interface between the master controller and the physical communication medium. It is responsible for executing the low-level operations issued by the master controller, including: generating a specific communication baud rate according to the master controller's configuration; converting the master controller's digital signals into physical signals conforming to the IO-Link electrical specifications and sending them to the line; receiving physical signals from the device and converting them into digital signals; and integrating diagnostic registers that can be read by the master controller to report physical layer communication statuses such as cyclic redundancy check errors and frame loss in real time, providing crucial monitoring data for upper-layer algorithms.
[0162] The device, acting as the responder in the communication, comprises a device controller and a device physical layer chip. The device controller is a relatively resource-efficient microcontroller, such as a chip based on an ARM Cortex-M0+ core, responsible for parsing and responding to various queries and instructions from the master station. For example, upon receiving a capability query, it reads a pre-programmed baud rate capability bitmap from non-volatile memory and replies; upon receiving a baud rate switching instruction, it reconfigures the parameters of its serial communication interface; and in packet loss test mode, it cooperates with the master station to receive and transmit test data. The device physical layer chip, such as the SN65HVD101 IO-Link transceiver, has a function corresponding to but a different role than the master station's physical layer chip. It is responsible for detecting wake-up signals from the master station, converting the device controller's digital signals into line signals for transmission, and converting received line signals before transmitting them to the device controller.
[0163] The main controller also includes: 4 independent UART interfaces supporting programmable baud rates; a hardware CRC calculation unit for fast bit error rate detection; and ample Flash (128KB) and RAM (32KB).
[0164] The main station physical layer chip also includes: configuration and status monitoring via SPI interface; built-in programmable baud rate generator supporting standard and extended baud rates; rich diagnostic information (short circuit, overvoltage, temperature, etc.); independent isolation and protection circuits for each channel, using ADuM3151 high-speed digital isolators and TVS diode arrays for surge protection, and self-resetting fuses for overcurrent protection.
[0165] The device controller also includes support for configurable baud rate UART and hardware CRC check.
[0166] Example 3
[0167] Please see Figure 3 This embodiment provides an electronic device, including at least one processor 301 and a memory 302. Optionally, the device further includes a communication component 303. The processor 301, memory 302, and communication component 303 are connected via a bus 304.
[0168] In a specific implementation, at least one processor 301 executes computer execution instructions stored in memory 302, causing at least one processor 301 to perform the above-described method.
[0169] The specific implementation process of processor 301 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0170] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0171] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0172] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0173] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0174] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0175] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0176] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0177] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0178] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0179] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0180] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0181] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0182] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. An adaptive baud rate negotiation method, characterized in that, Applied to an adaptive baud rate negotiation system, the system including devices and a master station supporting extended baud rates, the method includes: If the device supports extended baud rate, then obtain a list of available baud rates that are supported by both the main station and the device, and sort the baud rates in the list of available baud rates in descending order of their numerical values; The highest available baud rate is determined by performing a binary search loop filter based on the available baud rate list. The packet loss rate is tested based on the highest available baud rate to determine the working baud rate; After the master station and the device have been operating stably according to the working baud rate, the communication quality of the master station and the device is checked according to a preset period to obtain the error rate; If the error rate exceeds the preset error rate threshold for multiple consecutive periods, then select the next baud rate from the available baud rate list to perform a packet loss rate test and update the working baud rate.
2. The method according to claim 1, characterized in that, If the device supports extended baud rates, then a list of available baud rates jointly supported by the main station and the device is obtained. The baud rates in the list of available baud rates are sorted in descending order of numerical value, including: Determine whether the device supports extended baud rate; If the device supports extended baud rates, then the main station receives a baud rate capability bitmap returned by the device, which includes multiple standard baud rates and multiple non-standard extended baud rates. The baud rates supported by the main station are determined based on the baud rate capability bitmap, resulting in a set of commonly supported baud rates; The baud rates in the baud rate set are sorted from highest to lowest value to obtain a list of available baud rates.
3. The method according to claim 2, characterized in that, The step of determining whether the device supports extended baud rate includes: At the standard baud rate, a query is initiated by writing a command code to the predefined index address of the device from the master station. If the device returns a baud rate capability bitmap, then the device supports extended baud rates; If the device returns an error message, then the device does not support extended baud rates.
4. The method according to claim 1, characterized in that, The step of performing a binary search loop to filter the available baud rate list and determine the highest available baud rate includes: A binary search loop is performed based on the available baud rate list. Each round of the binary search loop includes: Determine the median baud rate in the list of available baud rates; Set the intermediate baud rate to the current baud rate of the master station and the device; After the setup is complete, start the intensive communication test according to the main station instructions; If the intermediate baud rate passes the dense communication test, then the list of available baud rates that are greater than the intermediate baud rate will be used as the list of available baud rates for the next round of filtering. If the intermediate baud rate fails the dense communication test, the list of available baud rates that are lower than the intermediate baud rate will be used as the list of available baud rates for the next round of filtering. Repeat the binary search loop filtering until the search interval is empty, then take the last baud rate that passes the dense communication test as the highest available baud rate.
5. The method according to claim 4, characterized in that, The dense communication test involves sending dense communication data from the master station to the device within a preset time period to monitor CRC errors and frame loss rate.
6. The method according to claim 1, characterized in that, The step of determining the working baud rate by performing packet loss rate testing based on the highest available baud rate includes: Initiate the packet loss rate test based on the highest available baud rate; If the highest available baud rate passes the packet loss rate test, then the highest available baud rate will be used as the working baud rate for the master station and the device. If the highest available baud rate fails the packet loss rate test, then select the next baud rate from the available baud rate list to start the packet loss rate test until the packet loss rate test is passed, and obtain the working baud rate of the master station and the device.
7. The method according to claim 6, characterized in that, If the highest available baud rate fails the packet loss rate test, then selecting the next highest available baud rate from the available baud rate list to start the packet loss rate test includes: If the maximum available baud rate fails the packet loss rate test, the connection between the master station and the device is re-established according to the preset watchdog timer and standard baud rate. Once the connection is established, select the next highest available baud rate from the list of available baud rates to start the packet loss rate test.
8. An adaptive baud rate negotiation system, characterized in that, Including the main station and equipment; The master station includes a master controller and a master station physical layer chip; The device includes a device controller and a device physical layer chip; The main controller is configured to perform the following operations: After establishing an initial connection with the device, by exchanging extended capability information, an ordered list of available baud rates supported by both the main station and the device is obtained and generated; Based on the ordered list of available baud rates, the highest available candidate baud rate is determined by controlling the baud rate switching of the main station physical layer chip and performing connectivity tests, and using a binary search algorithm to filter and determine the highest available candidate baud rate. Starting with the highest available candidate baud rate, the final working baud rate is verified and determined by initiating a targeted packet loss rate test; After entering steady-state communication at the specified working baud rate, communication error statistics are periodically read from the master station physical layer chip, and monitoring is performed according to a preset hysteresis strategy. When the monitoring results meet the rate reduction conditions, a new round of adaptive negotiation process is triggered to select a new candidate baud rate from the ordered list of available baud rates and perform a packet loss rate test to update the working baud rate.
9. An electronic device, characterized in that, include: At least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, The method as described in any one of claims 1-7 is implemented when the computer program instructions are executed by the processor.