Underground coal mine RS485 adaptive baud rate communication method
By using baud rate adaptive technology and CRC verification code in the RS485 bus communication system underground in the coal mine, the problems of cumbersome baud rate configuration and poor equipment compatibility are solved, the system flexibility and stability are improved, and the underground in the coal mine are ensured. Reliability and safety of the equipment.
Patent Information
- Application Number
- CN202411340352.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing RS485 bus communication system has cumbersome baud rate configuration in coal mines, poor equipment compatibility, and insufficient communication stability, resulting in large system flexibility and maintenance workload, which may cause safety accidents.
By realizing baud rate adaptation on the branch station, using CRC verification code to ensure information integrity, automatically switch baud rate to match the communication between the master and slave devices, using the branch station as the main device to connect to card readers, sensors, and power supplies and switch slave devices to achieve adaptive matching of baud rate.
It improves the flexibility and compatibility of the system, reduces maintenance workload, enhances communication stability, avoids communication interruption problems caused by baud rate mismatch, and ensures the reliability and safety of underground equipment of coal mines.
Smart Images

Figure CN119276652A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of safety monitoring and precise positioning, and relates to an RS485 adaptive baud rate communication method in an underground coal mine. Background Art
[0002] In coal mines, safety monitoring and precise positioning are crucial to ensuring personnel safety and improving production efficiency. Traditional coal mine underground communication systems usually use wired communication, among which bus communication based on RS485 interface is a common solution. RS485 bus communication has advantages such as long-distance transmission, high transmission rate and strong anti-interference ability, but it also has the following defects:
[0003] Baud rate configuration is cumbersome: Existing RS485 bus communication systems usually require pre-configuration of baud rates for master and slave devices, which increases the complexity of on-site installation and commissioning. Once configured, the baud rate cannot be changed at will, limiting the flexibility of the system and making it difficult to adapt to the needs of different transmission rates and interference environments. For example, in a monitoring system underground in a coal mine, different baud rates may need to be selected according to different monitoring areas and equipment types to ensure the real-time and reliability of data.
[0004] Poor device compatibility: Since different devices may support different baud rates, it is difficult to be compatible with multiple devices on one bus, which is not conducive to system integration and expansion, and limits the diversity of system functions. For example, in the safety monitoring system underground in a coal mine, it may be necessary to connect sensors and controllers produced by different manufacturers, and these devices may support different baud rates, making it difficult to communicate on the same bus.
[0005] Insufficient communication stability: Baud rate mismatch or configuration error may lead to communication interruption, affecting the reliability and stability of the system, and may even cause safety accidents. For example, in the gas monitoring system underground in a coal mine, if the communication between the sensor and the controller is interrupted, the gas concentration data may not be transmitted in time, thus causing a safety accident.
[0006] High maintenance workload: The existing system requires regular inspection and maintenance of the baud rate configuration, which increases the maintenance workload and reduces work efficiency. For example, during the equipment inspection in the coal mine, it is necessary to check whether the baud rate configuration of each device is correct and make necessary adjustments, which increases the workload of the inspection personnel and reduces the inspection efficiency. Summary of the invention
[0007] In view of this, the object of the present invention is to provide a RS485 adaptive baud rate communication method for underground coal mines. It is applied to the master-slave communication mode based on RS485 bus in underground coal mines. The substation is used as the master device and can connect the slave devices such as card reader, sensor, power supply, switch, etc. through RS485 bus. The baud rate of the substation can only be configured and switched between the supported options, and the baud rate of the substation cannot be set arbitrarily. When the master and slave devices on the bus send information, the CRC check code of the information will be attached at the end of the information, and the integrity of the information can be checked. The slave device with unmatched baud rate will monitor all signals on the bus. As long as the monitored information cannot pass the CRC check, the baud rate will be switched to match. Once the information on the bus is received, it can pass the CRC check, then it indicates that the baud rate matching has successfully received the completed data information. According to this method, RS485 baud rate adaptation is realized in underground coal mines, and the problem of difficult baud rate matching of RS485 bus of underground coal mine equipment is solved.
[0008] In order to achieve the above object, the present invention provides the following technical solutions:
[0009] An RS485 adaptive baud rate communication method for underground coal mines, the method comprising the following steps:
[0010] The substation acts as the master device, connecting the slave devices such as the card reader, sensor, power supply and switch through the RS485 bus. The baud rate of the substation can only be configured and switched between the supported options, and the baud rate of the substation cannot be set arbitrarily;
[0011] When sending information, the master and slave devices on the bus will attach a CRC check code to the end of the information to verify the integrity of the information;
[0012] The slave device with unmatched baud rate will monitor all signals on the bus. If the monitored information cannot pass the CRC check, the baud rate will be switched to match.
[0013] Once the information received on the bus passes the CRC check, it indicates that the baud rate matches successfully and the completed data information is received.
[0014] Furthermore, the method further comprises the following steps:
[0015] After the slave device is powered on, it configures the baud rate as the preferred option by default and starts to monitor the communication information on the bus;
[0016] When monitoring information, the slave device will perform CRC check on the information;
[0017] If the CRC check passes, it means that the baud rate of the slave device matches that of the master device successfully;
[0018] If the CRC check fails, it means that the baud rate match is unsuccessful. At this time, the slave device will automatically switch to the next supported baud rate option and start listening to the communication information on the bus again;
[0019] If the slave device fails to monitor any information within the specified time, it will continue to switch to the next baud rate option for another try;
[0020] After the baud rate matches successfully, the slave device will wait to establish communication with the master device;
[0021] If the communication connection cannot be successfully established within the specified time, the slave device will re-enter the baud rate monitoring state;
[0022] If the master device and the slave device are disconnected for more than the specified time after successfully establishing communication, the slave device will re-enter the baud rate monitoring state;
[0023] When the master device needs to switch the baud rate, it broadcasts a configuration information frame, which contains the time interval for reconfiguring the baud rate and the address information of the slave device;
[0024] After receiving this information, the slave device starts the timer and sends the response frames in the order of their ranking;
[0025] After the baud rate reconfiguration time interval is over, the slave device will re-enter the baud rate adaptation state to match the new baud rate.
[0026] An RS485 adaptive baud rate communication system for underground coal mines, comprising:
[0027] Master device: used to control the communication process and connect the slave devices such as card readers, sensors, power supplies and switches through RS485 bus;
[0028] Slave device: includes card reader, sensor, power supply and switch, connected to the master device through RS485 bus and able to receive control instructions from the master device;
[0029] Communication bus: used to connect the master device and the slave device and transmit data signals;
[0030] Baud rate adaptive module: used to realize the adaptive adjustment of baud rate, including CRC check module and baud rate switching module;
[0031] CRC check module: used to check the integrity of the transmitted data;
[0032] Baud rate switching module: used to automatically switch the baud rate according to the CRC check result until the match is successful.
[0033] Furthermore, the system further comprises:
[0034] Configuration software: used to configure the baud rate options of the master and slave devices.
[0035] The beneficial effects of the present invention are:
[0036] (1) Using CRC as the integrity check for transmitted data can significantly reduce the capacity burden of the MCU, speed up the transmission efficiency of bus data, and improve the operating efficiency of bus equipment in coal mines.
[0037] (2) The substation uses a pure software method to achieve baud rate adaptation, which can reduce on-site installation and maintenance work and improve the communication compatibility of equipment between systems, thereby making multiple devices compatible on one bus and facilitating system integration and expansion.
[0038] (3) The substation can switch the bus baud rate through the configuration software, which improves the effectiveness and flexibility of bus communication. The baud rate can be configured according to the requirements of the on-site application environment to adapt to the application requirements of different transmission rates and different interference environments, while also reducing the system maintenance workload.
[0039] (4) If the slave device is disconnected from communication for more than a specified period of time, the baud rate can be re-adapted, which improves the communication stability between the master and slave devices and avoids communication anomalies caused by incorrect configuration.
[0040] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0042] Figure 1 It is the bus data frame structure;
[0043] Figure 2 This is a schematic diagram of bus monitoring;
[0044] Figure 3 Reconfigure the data frame structure for the baud rate;
[0045] Figure 4 Reconfigure the transmission timing for the baud rate;
[0046] Figure 5 This is the schematic diagram of RS485 transceiver circuit in coal mine underground;
[0047] Figure 6 This is the baud rate adaptation flow chart. DETAILED DESCRIPTION
[0048] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0049] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0050] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0051] (1) RS485 bus baud rate adaptive method
[0052] The underground substation of the coal mine is connected to card readers, sensors, power supplies, switches and other devices through the RS485 bus. The substation is the master device of the RS485 bus, and other devices are mounted on the bus as slave devices. The baud rate of the master device can only be switched between the baud rate options that support the configuration, and the baud rate cannot be set arbitrarily for communication. The master and slave devices on the bus use DMA to send and receive information, which can reduce the operating burden of the MCU. At the same time, it can also ensure that the bus data is transmitted strictly according to the RS485 bus timing. When the master and slave devices send information, the CRC check code of the information will be attached at the end of the information, such as Figure 1 As shown in Figure 1, the CRC checksum can check the integrity of the transmitted data to ensure that the device receives the correct information. (See Figure 1 )
[0053] A newly powered device will configure the baud rate to the first option by default and monitor all information on the bus, such as Figure 2 As shown, in order to ensure the baud rate matching speed and success rate, the master device needs to ensure that at least two messages are transmitted on the bus per second. When there is only one slave device on the bus, the baud rate is matched by monitoring the request information sent regularly by the master device. When there are multiple devices on the bus, the monitoring device will monitor the request information of the master device and the reply information of other slave devices, which can speed up the baud rate matching speed. After monitoring a complete message, the monitoring device performs CRC check according to the structure of the sent message. The CRC check passes, indicating that the monitoring device has received a complete message. The monitoring device can only receive the complete message when the baud rate is successfully matched, indicating that the baud rate of the monitoring device is successfully matched. If the CRC check fails, it means that the current baud rate match fails and needs to be re-matched. The monitoring device switches the baud rate to the next option and listens to the bus information again. The monitoring device will cyclically switch among the supported baud rate options until the baud rate is successfully matched. In addition, the unmatched slave device will monitor for a certain time after each baud rate switch. If the baud rate match is not achieved within the specified time, it will automatically switch to the next baud rate for monitoring until a matching baud rate is found, thereby achieving baud rate adaptation. According to the application requirements of coal mines, multiple baud rate configurations can be set for switching to meet the usage requirements of different application scenarios in coal mines. (See Figure 2 )
[0054] (2) Baud rate rematching method
[0055] In the master-slave communication system, when the master and slave devices have completed the baud rate matching, if the baud rate needs to be modified again, the master device will send a frame of broadcast configuration information through the bus. This broadcast frame not only contains the time interval for re-baud rate configuration, but also the address numbers of all slave devices on the current bus. After receiving this broadcast frame, the slave device will parse its content and extract the configuration information related to itself, especially determine its own address number and sorting position from the broadcast frame. (See Figure 3 )
[0056] After receiving the broadcast configuration information from the slave device, it will extract the ranking of the device in the information and the time interval for reconfiguring the baud rate. Then the timer is turned on for timing management, and the slave device sends response frames in turn according to its ranking control timing in the configuration information frame. Then wait for the time interval for reconfiguring the baud rate to arrive and re-enter the baud rate adaptive state to obtain the information sent by the master device on the bus after modifying the baud rate, and use the information for baud rate adaptive. However, if the slave device does not receive the broadcast configuration information within the specified time, resulting in failure to re-enter the baud rate adaptive state, then this will cause the slave device to be unable to communicate normally with the master device. If the communication between the slave device and the master device is interrupted for more than the specified time, the slave device will automatically re-enter the baud rate adaptive state and try to communicate with the master device again.
[0057] (See Figure 4 )
[0058] (3) RS485 transceiver circuit
[0059] The RS485 data transceiver circuit includes a serial port controller, an optical coupler, an RS485 transceiver, and an EMC protection circuit. The serial port controller is responsible for data transmission and reception through DMA, and the optical coupler performs photoelectric isolation to protect the serial port controller. The RS485 transceiver is responsible for converting the serial port signal into an RS485 differential signal for transmission. The EMC protection circuit improves the anti-interference ability of the equipment in an electromagnetic radiation environment. The impedance is matched in parallel at the RS485 line terminal to prevent signal reflection and improve signal quality. The RS485 communication connection diagram is as follows: Figure 5 As shown. (See Figure 5 )
[0060] process:
[0061] In the underground communication system of coal mines, in order to achieve adaptive adjustment of baud rate, the substation is usually used as the master device, connected to slave devices such as card readers, sensors, power supplies and switches through the RS485 bus. The baud rate of the substation is limited to configuration switching between supported options. Users need to select the appropriate baud rate according to the actual use requirements of the coal mine site, and the baud rate setting of the substation cannot be changed at will.
[0062] During the communication process, the information sent by the master and slave devices will have a CRC checksum appended to the end to ensure the integrity of the information. Specifically, after the slave device is powered on, the baud rate is configured as the preferred option by default and starts to listen to the communication information on the bus. When the information is listened to, the slave device will perform a CRC check on the information. If the CRC check passes, it means that the received data is correct, indicating that the baud rate of the slave device matches the master device successfully. If the CRC check fails, it means that the baud rate match is unsuccessful. At this time, the slave device will automatically switch to the next supported baud rate option and start listening to the communication information on the bus again.
[0063] If the slave device fails to monitor any information within the specified time, it will continue to switch to the next baud rate option for an attempt. After the baud rate is successfully matched, the slave device will wait to establish communication with the master device. If the communication connection is not successfully established within the specified time, the slave device will re-enter the baud rate monitoring state. Similarly, if the master device and the slave device are disconnected for more than the specified time after successfully establishing communication, the slave device will also re-enter the baud rate monitoring state.
[0064] When the master device needs to switch the baud rate, it broadcasts a configuration information frame, which contains the time interval for reconfiguring the baud rate and the address information of the slave device. After receiving the information, the slave device will start the timer and send response frames in order of their ranking. After the time interval for reconfiguring the baud rate ends, the slave device will re-enter the baud rate adaptive state to match the new baud rate. The master device will complete the baud rate switching before the time interval for reconfiguring the baud rate arrives.
[0065] This adaptive baud rate adjustment method can effectively meet the needs of RS485 communication equipment in coal mines for baud rate adaptation and ensure the reliability and stability of communication. (See Figure 6 ).
[0066] Embodiment 1
[0067] System Configuration:
[0068] Main equipment: underground substation in coal mine, responsible for controlling the entire communication system and connecting slave equipment such as card readers, sensors, power supplies, switches, etc. through RS485 bus.
[0069] Slave devices: card readers, sensors, power supplies, switches and other devices are connected to the master device through the RS485 bus and can receive control instructions from the master device.
[0070] Baud rate options: 9600bps, 19200bps, 38400bps
[0071] Steps:
[0072] Device power-on: After all devices are powered on, the slave device will configure the baud rate to the preferred option of 9600bps by default.
[0073] Monitor bus: The slave device starts to monitor the communication information on the bus.
[0074] CRC check: After receiving information from the device, a CRC check is performed.
[0075] Baud rate matching:
[0076] If the CRC check passes, it means that the baud rate matches successfully and a communication connection is established between the slave device and the master device.
[0077] If the CRC check fails, it means the baud rate does not match, and the slave device automatically switches to the next baud rate option 19200bps and listens to the information on the bus again.
[0078] Cyclic matching: The slave device switches between supported baud rate options in a cycle until the baud rate matches successfully or all options are tried.
[0079] Communication establishment: After the baud rate is matched successfully, the slave device and the master device establish a stable communication connection and exchange data.
[0080] Embodiment 2
[0081] Scenario: The coal mine underground monitoring system needs to replace the sensor, and the baud rate of the new sensor is different from the original sensor.
[0082] Steps:
[0083] Send configuration information: The master device sends broadcast configuration information via the bus, including the new baud rate option and the address numbers of all slave devices.
[0084] Receiving configuration information: After receiving the configuration information, the new sensor parses and extracts the configuration information related to itself, including the new baud rate option and its own address number.
[0085] Timer management: The new sensor starts the timer and sends response frames in sequence according to the ranking order in the configuration information.
[0086] Baud rate switching: After the baud rate reconfiguration time interval ends, the new sensor enters the baud rate adaptive state, re-listens to the information on the bus, and automatically switches the baud rate to match.
[0087] Communication establishment: After the baud rate is matched successfully, the new sensor establishes a communication connection with the main device and starts data transmission.
[0088] Embodiment 3
[0089] Scenario: Communication interruption occurs in the underground monitoring system of a coal mine, and troubleshooting is required.
[0090] Steps:
[0091] Detect interruption: The system detects that the communication with a slave device is interrupted.
[0092] Retry connection: The system tries to reestablish the communication connection with the slave device.
[0093] Timeout processing: If the connection cannot be successfully established within the specified time, the slave device is considered to be faulty and a fault alarm or isolation processing is performed.
[0094] Rematching: After the fault is repaired, the slave device re-enters the baud rate adaptive state and tries to establish a communication connection with the master device.
[0095] Embodiment 4
[0096] Scenario: The underground monitoring system of a coal mine needs to be upgraded, including replacing the master device or slave device.
[0097] Steps:
[0098] Device replacement: Replace an old device with a new master or slave device.
[0099] Baud rate configuration: Reconfigure the system's baud rate according to the baud rate option of the new device.
[0100] Adaptive matching: All devices re-enter the baud rate adaptive state, automatically match the baud rate, and establish a stable communication connection.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A RS485 adaptive baud rate communication method for underground coal mines, characterized in that: The method comprises the following steps: The substation acts as the master device, connecting the slave devices such as the card reader, sensor, power supply and switch through the RS485 bus. The baud rate of the substation can only be configured and switched between the supported options, and the baud rate of the substation cannot be set arbitrarily; When sending information, the master and slave devices on the bus will attach a CRC check code to the end of the information to verify the integrity of the information; The slave device with unmatched baud rate will monitor all signals on the bus. If the monitored information cannot pass the CRC check, the baud rate will be switched to match. Once the information received on the bus passes the CRC check, it indicates that the baud rate matches successfully and the completed data information is received.
2. A RS485 adaptive baud rate communication method for underground coal mine according to claim 1, characterized in that: The method further comprises the following steps: After the slave device is powered on, it configures the baud rate as the preferred option by default and starts to monitor the communication information on the bus; When monitoring information, the slave device will perform CRC check on the information; If the CRC check passes, it means that the baud rate of the slave device matches that of the master device successfully; If the CRC check fails, it means that the baud rate match is unsuccessful. At this time, the slave device will automatically switch to the next supported baud rate option and start listening to the communication information on the bus again; If the slave device fails to monitor any information within the specified time, it will continue to switch to the next baud rate option for another try; After the baud rate matches successfully, the slave device will wait to establish communication with the master device; If the communication connection cannot be successfully established within the specified time, the slave device will re-enter the baud rate monitoring state; If the master device and the slave device are disconnected for more than the specified time after successfully establishing communication, the slave device will re-enter the baud rate monitoring state; When the master device needs to switch the baud rate, it broadcasts a configuration information frame, which contains the time interval for reconfiguring the baud rate and the address information of the slave device; After receiving this information, the slave device starts the timer and sends the response frames in the order of their ranking; After the baud rate reconfiguration time interval is over, the slave device will re-enter the baud rate adaptation state to match the new baud rate.
3. An RS485 adaptive baud rate communication system for underground coal mines, characterized in that: include: Master device: used to control the communication process and connect the slave devices such as card readers, sensors, power supplies and switches through RS485 bus; Slave device: includes card reader, sensor, power supply and switch, connected to the master device through RS485 bus and able to receive control instructions from the master device; Communication bus: used to connect the master device and the slave device and transmit data signals; Baud rate adaptive module: used to realize the adaptive adjustment of baud rate, including CRC check module and baud rate switching module; CRC check module: used to check the integrity of the transmitted data; Baud rate switching module: used to automatically switch the baud rate according to the CRC check result until the match is successful.
4. The RS485 adaptive baud rate communication system for underground coal mine according to claim 3, characterized in that: The system further comprises: Configuration software: used to configure the baud rate options of the master and slave devices.
Citation Information
Patent Citations
RS485 communication interface automatic baud rate and communication address detection method
CN103916284A
Communication interface matching method, device and controller
CN103986610A
Automatic MODBUS-RTU communication baud rate matching method
CN104052579A
RS485 bus-based self-adaptive monitoring analysis method for communication of electric power Internet of Things terminal
CN113691412A
Baud rate self-adaption method and device, computer equipment and storage medium
CN118300915A