Motor driver and communication method, device, equipment and system thereof

By configuring the working mode of the network controller through software, the motor driver realizes communication between the upper computer and the main site controller, solving the problem of difficulty in the existing technology of additional hardware dependence and protocol switching, reducing manufacturing costs and improving flexibility and Adaptability.

CN119211316APending Publication Date: 2024-12-27SHENZHEN INVT ELECTRIC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411461941.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

Existing motor drivers require additional hardware interfaces in EtherCAT communications, which adds manufacturing costs and complexity, and makes it difficult to flexibly switch different communication protocols.

Method used

The network controller's working mode is configured through software, and its working mode is adjusted to meet different communication needs, so as to realize communication between the host computer and the master controller, reducing dependence on additional hardware and supporting switching of multiple communication protocols.

Benefits of technology

It reduces the manufacturing cost of motor drivers, improves flexibility and adaptability, realizes communication between the same communication port through different protocols, and simplifies the debugging and maintenance process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211316A_ABST
    Figure CN119211316A_ABST
Patent Text Reader

Abstract

The invention discloses a motor driver and a communication method, device, equipment and system thereof, and relates to the field of motor control, the method comprises the communication method of the motor driver, and the communication method comprises the following steps: adjusting the current working mode of a network controller in the motor driver based on the current communication demand of the motor driver; wherein the current working mode is an upper computer debugging mode or a slave station control mode; running a protocol stack corresponding to the current working mode; and in response to the triggering of the network controller, analyzing the message received by the communication port of the motor driver by using the protocol stack. According to the invention, the manufacturing cost of the motor driver can be reduced, the working mode of the network controller is configured through software, switching among different communication protocols is realized, and the flexibility and adaptability of the motor driver are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of motor control, and in particular to a motor driver and a communication method, device, equipment and system thereof. Background Art

[0002] At present, the EtherCAT (Ethernet for ControlAutomation Technology) communication port and the host computer debugging communication port of motor drivers such as servo drives or frequency converters are set independently. The EtherCAT communication port is used to communicate with the EtherCAT master controller to realize the field control function, and the host computer debugging communication port is used to connect to the PC (Personal Computer) host computer to realize the function code parameter setting, monitoring, oscilloscope debugging, etc. This communication scheme of independently setting two communication ports requires additional hardware interfaces for the motor driver, such as additional communication chips and connectors, which increases the manufacturing cost of the motor driver.

[0003] Therefore, how to provide a solution to the above technical problems is a problem that those skilled in the art need to solve at present. Summary of the invention

[0004] The purpose of the present invention is to provide a motor driver and a communication method, device, equipment and system thereof, which can reduce the manufacturing cost of the motor driver, configure the working mode of the network controller through software, realize switching between different communication protocols, and improve the flexibility and adaptability of the motor driver.

[0005] In order to solve the above technical problems, the present invention provides a communication method for a motor driver, comprising:

[0006] Based on the current communication requirements of the motor driver, adjusting the current working mode of the network controller in the motor driver; wherein the working mode of the network controller includes a host computer debugging mode and a slave station control mode;

[0007] Running a protocol stack corresponding to the current working mode;

[0008] In response to the triggering of the network controller, the message received by the communication port of the motor driver is parsed using the protocol stack.

[0009] Optionally, the current communication requirement includes a first communication requirement corresponding to communication with a host computer;

[0010] The process of adjusting the current working mode of the network controller in the motor driver based on the current communication demand of the motor driver includes:

[0011] When the motor driver is in a power-on initialization process, determining that the current communication requirement is the first communication requirement;

[0012] The current working mode of the network controller in the motor driver is adjusted to the host computer debugging mode.

[0013] Optionally, the current communication requirement includes a first communication requirement corresponding to communication with a host computer;

[0014] The process of adjusting the current working mode of the network controller in the motor driver based on the current communication demand of the motor driver includes:

[0015] When the current working mode of the network controller is the slave control mode, monitoring the slave operation state of the motor driver;

[0016] When the slave operation state satisfies a switching condition, determining the current communication demand of the motor driver as the first communication demand;

[0017] The current working mode of the network controller in the motor driver is adjusted to the host computer debugging mode.

[0018] Optionally, when the slave operation state meets the switching condition, before determining that the current communication requirement of the motor driver is the first communication requirement, the communication method of the motor driver further includes:

[0019] When the operation state of the slave station is not the operation-ready state, it is determined that the switching condition is satisfied.

[0020] Optionally, when the operation state of the slave station is not an operation-ready state, the process of determining whether the switching condition is satisfied includes:

[0021] When the slave operation state is not an operation-ready state, obtaining a current count value of an error register of the motor driver;

[0022] If the current count value reaches a preset value, it is determined that the switching condition is met.

[0023] Optionally, the current communication requirement includes a second communication requirement corresponding to communication with the master station controller;

[0024] The process of adjusting the current working mode of the network controller in the motor driver based on the current communication demand of the motor driver includes:

[0025] Utilizing the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver, and obtaining the current type of the message;

[0026] If the current type is the first type corresponding to communication with the master station controller, determining that the current communication requirement of the motor driver is the second communication requirement;

[0027] The current working mode of the network controller in the motor driver is adjusted to the slave control mode.

[0028] Optionally, when the current working mode of the network controller is the host computer debugging mode;

[0029] The process of using the protocol stack to parse the message received by the communication port of the motor driver includes:

[0030] Utilizing the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver, and obtaining the current type of the message;

[0031] If the current type is the second type corresponding to the communication with the host computer, and the IP message header type and the UDP message header port number both meet the host computer communication configuration conditions, the data in the message is parsed.

[0032] In order to solve the above technical problems, the present invention further provides a communication device for a motor driver, comprising:

[0033] An adjustment module, used for adjusting the current working mode of the network controller in the motor driver based on the current communication requirements of the motor driver; wherein the working mode of the network controller includes a host computer debugging mode and a slave station control mode;

[0034] A control module, used for running a protocol stack corresponding to the current working mode;

[0035] The data processing module is used to respond to the triggering of the network controller and use the protocol stack to parse the message received by the communication port of the motor driver.

[0036] In order to solve the above technical problems, the present invention further provides a motor driver, comprising:

[0037] Communication port, network controller;

[0038] Memory for storing computer programs;

[0039] A processor is used to implement the steps of the communication method for the motor driver as described in any one of the above when executing the computer program.

[0040] In order to solve the above technical problems, the present invention further provides a motor control system, comprising a host computer, a master station controller and a plurality of motor drivers as described above.

[0041] The present invention provides a communication method for a motor driver. The current working mode of a network controller of the motor driver is flexibly configured based on the current communication demand of the motor driver, and a protocol stack corresponding to the current working mode is run, so that messages received by a communication port are parsed through the corresponding protocol stack, so that the motor driver can communicate with a host computer and a master station controller through the same communication port, without installing additional physical interfaces and related hardware components, thereby reducing the manufacturing cost of the motor driver. The working mode of the network controller is configured by software to switch between different communication protocols, thereby improving the flexibility and adaptability of the motor driver.

[0042] The present invention also provides a communication device for a motor driver, a motor driver, and a motor control system, which have the same beneficial effects as the communication method for the motor driver mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A flow chart of the steps of a communication method for a motor driver provided by the present invention;

[0045] Figure 2 A flow chart of the steps of another communication method of a motor driver provided by the present invention;

[0046] Figure 3 A schematic diagram of the structure of a communication system for a motor driver provided by the present invention;

[0047] Figure 4 A schematic diagram of the structure of a motor driver provided by the present invention;

[0048] Figure 5 A schematic diagram of the structure of a motor control system provided by the present invention;

[0049] Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION

[0050] The core of the present invention is to provide a motor driver and its communication method, device, equipment and system, which can reduce the manufacturing cost of the motor driver, configure the working mode of the network controller through software, realize switching between different communication protocols, and improve the flexibility and adaptability of the motor driver.

[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] First, please refer to Figure 1 The present invention provides a communication method for a motor driver, comprising:

[0053] S101: Based on the current communication requirements of the motor driver, adjust the current working mode of the network controller in the motor driver; wherein the working mode of the network controller includes a host computer debugging mode and a slave station control mode.

[0054] To facilitate understanding of the solution of this embodiment, the motor driver is first introduced. The motor driver includes but is not limited to a frequency converter or a servo driver. The motor driver in this embodiment includes a network controller and a communication port. The communication port here is externally connected to a host computer or a master station controller. Specifically, the communication port is connected to the host computer through a host computer network cable, and is connected to the master station controller through a master station controller network cable. The communication port is internally connected to the network controller in the motor driver. Among them, the master station controller can be specifically an EtherCAT master station controller, and the motor driver is an EtherCAT slave.

[0055] In this embodiment, the current working mode of the network controller of the motor driver is adjustable, which is specifically determined according to the current communication demand of the motor driver, and the communication demand of the motor driver includes but is not limited to the first communication demand corresponding to the communication with the host computer and the second communication demand corresponding to the communication with the master station controller. It can be understood that when the communication port of the motor driver is connected to the host computer through the host computer network cable, the current communication demand of the motor driver is characterized as the first communication demand, and when the communication port of the motor driver is connected to the master station controller through the master station controller network cable, the current communication demand of the motor driver is characterized as the second communication demand.

[0056] It can be understood that different communication requirements of the motor driver may require different configuration parameters and communication protocols of the network controller. For example, when communicating with the host computer, it may be necessary to set a specific baud rate, data bit, stop bit, etc., while when communicating with the master controller, different network configuration and real-time requirements may be required. For example, when the communication requirement of the motor driver is the first communication requirement (communication with the host computer), the network controller may adopt the corresponding communication protocol, and when the communication requirement becomes the second communication requirement (communication with the master controller), the network controller may need to switch to the EtherCAT protocol or other appropriate industrial Ethernet protocols. Therefore, it is necessary to adjust the network controller to the corresponding working mode, including adjusting the configuration parameters of the network controller, which involves writing specific registers or changing the settings through the interface to match the communication requirements of the motor driver, so that the messages sent by the host computer or host controller can be transmitted and processed. Specifically, if the current communication requirement is the first communication requirement, the current working mode is adjusted to the upper computer debugging mode, and the configuration parameters of the network controller are adjusted according to the requirements of communication with the upper computer; if the current communication requirement is the second communication requirement, the current working mode is adjusted to the slave station control mode, and the configuration parameters of the network controller are adjusted according to the requirements of communication with the master station controller.

[0057] Before executing this step, an operation of determining the current communication requirements of the motor driver is also included. In a specific embodiment, the current communication requirements can be determined by the user based on the selection instructions output by the interactive interface, or the motor driver can automatically identify the current communication requirements and set them according to actual engineering needs. This embodiment is not limited here.

[0058] Since the working mode of the network controller in this embodiment is adjustable and can support multiple communication protocols, the network controller can switch between different protocols by adjusting the working mode, thereby communicating with the host computer and the master station controller using different communication protocols, and adapting to different communication standards and protocols through software configuration. Since there is no need to equip each communication protocol with a dedicated physical interface, the number of hardware interfaces can be reduced.

[0059] S102: Run the protocol stack corresponding to the current working mode.

[0060] It can be understood that the network controller activates and executes a specific protocol stack in its currently configured working mode to achieve effective communication with the host computer or master station controller. The protocol stack is a collection of communication protocols that are stacked according to a specific hierarchical structure to jointly realize functions such as data transmission, encapsulation and decapsulation. When the network controller switches to a specific working mode, it will start the protocol stack corresponding to the working mode so that the network controller can communicate with the host computer or master station through the corresponding protocol stack to ensure the correct transmission of data.

[0061] For example, if the current working mode of the network controller is set to the slave control mode, the EtherCAT protocol stack will be run. The EtherCAT protocol stack contains all the protocol layers required to implement EtherCAT communication, from the physical layer to the application layer. By running the EtherCAT protocol stack, the network controller can achieve efficient and real-time industrial communication and control in the slave control mode. If the current working mode of the network controller is set to the host computer debugging mode, the LWIP (LightWeight IP) protocol stack will be run. LWIP is a lightweight TCP / IP protocol stack designed for embedded systems. It implements network protocols such as the IP layer (Internet Protocol Layer), ICMP layer (Internet Control Message Protocol Layer), UDP layer (User Datagram Protocol Layer), TCP layer (Transmission Control Protocol Layer) and network interface layer. The LWIP protocol stack is characterized by its low resource usage and is suitable for use on embedded devices with limited memory and processing power. By running the LWIP protocol stack, the network controller can provide stable and reliable network communication services in the host computer debugging mode, facilitating remote monitoring, configuration, fault diagnosis and other operations of the equipment.

[0062] S103: In response to the triggering of the network controller, the message received by the communication port of the motor driver is parsed using the protocol stack.

[0063] In this embodiment, when the communication port of the motor driver receives a message sent by the host computer or the master station controller, the hardware interface of the network controller will capture the message and trigger the protocol stack to parse the message. The data of the parsed message will be passed to the upper layer application, and the application will perform corresponding operations based on these data, such as updating the device status, executing control commands, etc. Correspondingly, the network controller will confirm whether to generate a response message, which is a confirmation of the received message or a reply to the data request. The response message is constructed using the protocol stack, including the necessary response data and the format specified by the protocol. Then the network controller sends the response message back to the host computer or the master station controller through the communication port to ensure that the motor driver can correctly receive, parse and respond to the communication request from the host computer or the master station controller, thereby realizing effective data exchange and execution of control instructions.

[0064] It can be understood that debugging using a host computer does not require the help of an EtherCAT controller and can be done independently, thereby improving ease of use and flexibility and reducing costs.

[0065] As an optional embodiment, the motor driver can be built by a main control chip and its peripheral components. The main control chip includes a network controller and a processor core (CPU (Central Processing Unit) or MCU (Microcontroller Unit)). The processor core is responsible for executing firmware or software programs and switching its working mode by reading and writing the registers of the network controller. The firmware or software running on the main control chip contains instructions for configuring and controlling the network controller. These instructions can be low-level codes that directly operate the hardware, or higher-level drivers or services. The network controller usually has a set of configuration registers that determine the working mode and behavior of the network controller. The processor core or driver switches the network controller to the corresponding working mode (such as EtherCAT mode) by writing to these registers. The firmware or software code is stored in the flash memory (Flash) connected to the processor core. When the system starts, these codes are loaded into RAM (Random Access Memory) and executed by the processor core. The flash memory itself does not directly control the network controller. When the main control chip is powered on or reset, the processor core will load the startup code from the flash memory. The startup code executes the initialization process, including configuring the network controller. The initialization code will set the current working mode of the network controller through the driver or directly operate the hardware. By writing the configuration value to the specific register of the network controller, the processor core switches the network controller to the corresponding current communication mode. After the network controller configuration is completed, the processor core loads and runs the corresponding protocol stack and starts processing network communication. It can be understood that the above steps S101-S103 can all be implemented by the processor core. Specifically, when the message arrives through the communication port (such as the Ethernet port) of the motor driver, the hardware part of the network controller (such as the MAC (Media Access Control, Media Access Control) controller) will first capture these messages. The hardware of the network controller will notify the processing core through an interrupt or other mechanism that a new message has arrived. After receiving the trigger, the processing core will suspend the current task and execute the relevant code of the protocol stack to parse the message. After the message is parsed, the processing core will perform corresponding operations according to the content of the message, such as updating motor parameters, executing control commands or preparing response data.

[0066] Based on the above, the main control chip can be selected but not limited to dual-core 32-core RISC-V processor main control chip, external FLASH (flash memory) storage firmware, built-in 2M on-chip SRAM (Static Random Access Memory), built-in 4-port Ethernet switch controller, built-in 3-port EtherCAT slave controller, external 4MSPIFLASH, 2-way 10M / 100M network port. SPI (Serial Peripheral Interface Flash Memory) FLASH is used to store the firmware of the motor driver, the communication port (network port) is used to connect to the communication master station such as EtherCAT master station controller or host computer, the dual network ports have built-in switch function, as long as the host computer network cable is disconnected and the master station controller network cable is plugged in, flexible networking can be achieved on site. Of course, it should also be noted that when EtherCAT is networked, the network signal should enter from the input network port and exit from the output network port. It can be understood that in addition to implementing the motor control algorithm of the servo drive or inverter and the performance parts such as current loop, speed loop and position loop control, the main control chip also needs to implement functional code management, parameter setting, terminal signal processing, keyboard human-computer interaction and industrial communication. In industrial communication, the mainstream industrial Ethernet EtherCAT communication is implemented, and the upper layer implements CoE (Controller of Ethernet) application. When performing EtherCAT communication, EtherCAT CoE communication is run to realize servo axis control, and the Ethernet dual-port switch communication function is realized at the same time, the LWIP protocol stack is run, and the upper layer implements the custom protocol to connect to the PC host computer.

[0067] It can be seen that in this embodiment, the current working mode of the network controller of the motor driver is flexibly configured based on the current communication requirements of the motor driver, and the protocol stack corresponding to the current working mode is run so that the message received by the communication port is parsed through the corresponding protocol stack, so that the motor driver can communicate with the host computer and the main station controller through the same communication port, without the need to install additional physical interfaces and related hardware components, thereby reducing the manufacturing cost of the motor driver. The working mode of the network controller is configured by software to achieve switching between different communication protocols, thereby improving the flexibility and adaptability of the motor driver.

[0068] Based on the above embodiments:

[0069] In an exemplary embodiment, the current communication demand includes a first communication demand corresponding to communication with a host computer;

[0070] Based on the current communication requirements of the motor drive, the process of adjusting the current operating mode of the network controller in the motor drive includes:

[0071] When the motor driver is in a power-on initialization process, determining the current communication demand as the first communication demand;

[0072] Adjust the current working mode of the network controller in the motor driver to the host computer debugging mode.

[0073] In this embodiment, due to different working modes of the network controller, the running protocol stack is different, such as in the host computer debugging mode, the running protocol stack is the LWIP protocol stack, and in the slave control mode, the running protocol stack is the EtherCAT protocol stack. Different protocol stacks have different parsing operations on messages. As a general TCP / IP protocol stack, LWIP needs to be able to handle multiple network protocols and data packets, while the EtherCAT protocol stack mainly implements the application layer and transport layer of industrial Ethernet. It assumes that the parsing of the underlying Ethernet frame has been completed. The EtherCAT protocol stack focuses on processing EtherCAT-specific data structures and commands, rather than parsing general Ethernet frames. Therefore, in the present embodiment, when the motor driver is in the process of power-on initialization, the communication demand when the motor driver does not recognize that it is connected to the host computer or the master station controller is determined as the first communication demand, so that the current working mode of the network controller is set to the host computer debugging mode to run the LWIP protocol stack, which is a universal TCP / IP protocol stack that can handle a variety of network protocols and data packets, so that the received universal message is parsed through the LWIP protocol stack. This setting ensures that the motor driver can still communicate through the standard network protocol without clarifying its connection object. Of course, in the subsequent operation process, once the motor driver receives and parses enough information through the LWIP protocol stack, it identifies that it is connected to the host computer or the master station controller, and it can switch the current working mode of the network controller according to the actual situation. Through the scheme of this embodiment, the motor driver can flexibly switch the current working mode and protocol stack of the network controller according to different operation stages and requirements, thereby optimizing its performance and function.

[0074] In an exemplary embodiment, the current communication demand includes a first communication demand corresponding to communication with a host computer;

[0075] Based on the current communication requirements of the motor drive, the process of adjusting the current operating mode of the network controller in the motor drive includes:

[0076] When the current working mode of the network controller is the slave control mode, the slave operation status of the motor driver is monitored;

[0077] When the operation state of the slave station meets the switching condition, determining the current communication demand of the motor driver as the first communication demand;

[0078] Adjust the current working mode of the network controller in the motor driver to the host computer debugging mode.

[0079] In this embodiment, when the network controller works in the slave control mode, the motor driver acts as an EtherCAT slave, and the slave operation state of the motor driver is continuously monitored. The slave operation state is a state that characterizes whether the motor driver can correctly perform tasks according to the instructions of the master controller, which can be specifically determined by the corresponding operation code. The slave operation state is matched with the switching condition. If the switching condition is met, the current communication demand is determined as the first communication demand, and the current working mode of the network controller is switched to the host computer debugging mode. The slave operation state is automatically monitored and the mode is switched according to the preset conditions, which reflects the intelligence level of the system and reduces the need for manual intervention. The switching condition can be preset, or reach a certain operating time, etc., which can be set according to the actual engineering needs. This embodiment is not specifically limited here.

[0080] The solution of this embodiment allows the network controller to switch between the slave control mode and the host computer debugging mode, and the motor driver can adapt to different operating environments and requirements, thereby improving the overall flexibility of the system. In addition, it can quickly switch to the host computer debugging mode when necessary, making the debugging and maintenance of the motor driver more efficient and reducing downtime.

[0081] In an exemplary embodiment, when the slave operation state meets the switching condition, before determining that the current communication demand of the motor driver is the first communication demand, the communication method of the motor driver further includes:

[0082] When the slave operation state is not in the operation ready state, it is determined that the switching condition is met.

[0083] In this embodiment, the operation state of the slave station is represented by a status code. When the status code is 0x08, it means that the slave station is in the operation-ready state, that is, the OP state. If the status code is not 0x08, it means that the slave station is not in the operation-ready state, that is, the slave station is not in the normal operation state, including but not limited to the error state, initialization state or other abnormal operation state, etc. The error state means that the slave station may have encountered a fault or error and cannot execute the command normally. The initialization state means that the slave station may be in the initialization process and is not ready to operate. Other abnormal operation states mean that the slave station may be in maintenance mode, standby mode or other non-operational state. In order to simplify problem diagnosis and restore communication, the operation state of the slave station is not in the operation-ready state, and it is determined that the switching condition is met, that is, the current communication demand of the motor driver is determined to be the first communication demand, so that the current working mode of the network controller will be switched to the host computer debugging mode. In the host computer debugging mode, the host computer can directly communicate with the motor driver to perform more detailed diagnosis and configuration operations.

[0084] By adopting the solution of this embodiment, the abnormal state of the slave station can be automatically identified and corresponding measures can be taken to solve the problem, thereby improving the self-diagnosis capability and reliability of the motor driver, helping to quickly locate and solve the problem, reduce downtime, and improve production efficiency.

[0085] In an exemplary embodiment, when the operation state of the slave station is not in the operation-ready state, the process of determining whether the switching condition is satisfied includes:

[0086] When the slave operation state is not in the operation ready state, the current count value of the error register of the motor driver is obtained;

[0087] If the current count value reaches the pre-set value, it is determined that the switching condition is met.

[0088] In the present embodiment, when the operation state of the slave station is not in the operation-ready state, the current count value of the error register of the motor driver is obtained. The error register of EtherCAT is an internal counter for recording the number of errors of the device. It can be understood that the error register is usually located at the register address 0x30C. It can be understood that if a slave station occasionally appears in the non-operation-ready state, it may be just a momentary fluctuation, but if the current count value of the error register is very high and reaches the pre-designed value, it indicates that there may be a continuous or serious problem. Based on the combination of the two, the possibility of mis-switching can be reduced, which helps to maintain the stable operation of the system and reduce the disturbance that may be caused by mode switching. Among them, the pre-designed value can be set to 0xFF. For an 8-bit counter, 0xFF represents the maximum count value. Of course, the pre-designed value can also be set according to the expected network stability and error tolerance, and can be set according to the actual engineering needs. This embodiment is not specifically limited here.

[0089] In a specific embodiment, considering that when the network controller is running in the slave control mode, the user can disconnect the network cable and communication port of the master controller and connect the network cable of the host computer to the communication port for debugging the host computer. It can be understood that when the network cable of the master controller is disconnected, the communication between the master controller and the slave will be interrupted. On the one hand, the slave may detect that the communication link is lost, and the error register starts to record the communication error. On the other hand, the slave expects to receive data or commands from the master within a specific time. If the network cable of the master controller is disconnected, the slave will not receive these data, resulting in timeout errors. These errors will also be recorded by the error register, which will cause the count value of the error register to accumulate.

[0090] Since the accumulated count value of the error register can quickly reflect the communication problem, the network controller can quickly respond to the user's operation of disconnecting the network cable of the master controller and connecting the network cable of the host computer, and automatically or after user confirmation, switch to the host computer debugging mode. The user does not need to perform complex configurations, but only needs to simply disconnect and connect the network cable, and the system can automatically or through simple operations Enter the debugging mode, and the maintenance personnel can quickly start the debugging process without waiting or performing additional steps to switch modes. In the case of emergency debugging or maintenance, the overall availability of the system and user experience are improved.

[0091] In an exemplary embodiment, the current communication demand includes a second communication demand corresponding to communication with a master station controller;

[0092] Based on the current communication requirements of the motor drive, the process of adjusting the current operating mode of the network controller in the motor drive includes:

[0093] Use the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver to obtain the current type of the message;

[0094] If the current type is the first type corresponding to communication with the master controller, determining that the current communication requirement of the motor driver is the second communication requirement;

[0095] Adjust the current working mode of the network controller in the motor driver to the slave control mode.

[0096] Combined with the above, during the power-on initialization process of the motor driver, the network controller in the motor driver is first switched to the host computer debugging mode to parse the received message through the LWIP protocol stack. The current type of the message here specifically refers to the Ethernet type. In Ethernet communication, the Ethernet type field (also called Ethernet frame type or protocol type) is a two-byte (16-bit) value located after the destination MAC address and source MAC address in the header of the Ethernet frame. This field is used to indicate which upper layer protocol the data carried in the Ethernet frame payload belongs to. If the Ethernet type is 0x88A4, this Ethernet type is reserved for the EtherCAT protocol. Therefore, if the motor driver receives a message with an Ethernet type of 0x88A4, it recognizes that this message is sent by the master controller (usually the central controller of the industrial control system) for real-time control and monitoring of the motor driver. That is, if the Ethernet type of the message parsed by the LWIP protocol stack is 0x88A4, the message will be regarded as communication from the master controller. At this time, the current communication demand of the motor driver is determined to be the second communication demand, the current working mode of the network controller in the motor driver is adjusted to the slave control mode, the EtherCAT protocol stack is run, and the EtherCAT protocol stack is used for subsequent message processing. The data of the response message is obtained and replied to the master controller, and operations including servo axis synchronization control are realized. This ensures that the motor driver can communicate with the master controller efficiently and in real time as an EtherCAT slave.

[0097] By parsing the Ethernet type field, the network controller can automatically identify and adapt to different communication requirements without manual intervention. The switch from host computer debugging mode to slave control mode is seamless, ensuring that the motor drive can quickly enter the real-time control state and ensure that the correct protocol stack is used to process specific types of messages, thereby improving the reliability and efficiency of the motor drive.

[0098] It can be understood that in this embodiment, the Ethernet type corresponding to 0x88A4 is determined as the first type.

[0099] In an exemplary embodiment, when the current working mode of the network controller is the host computer debugging mode;

[0100] The process of using the protocol stack to parse the message received by the communication port of the motor driver includes:

[0101] Use the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver to obtain the current type of the message;

[0102] If the current type is the second type corresponding to the host computer communication, and the IP message header type and the UDP message header port number both meet the host computer communication configuration conditions, the data in the message is parsed.

[0103] In combination with the above, if the Ethernet type is 0x800, this Ethernet type can be used to indicate that the payload contains an IPv4 data packet. Considering that the host computer usually uses the standard IP protocol for communication, when the Ethernet type is 0x0800, it can be determined that the received message is sent by the host computer (such as a personal computer or a monitoring server) running the IPv4 protocol. If the Ethernet type of the message parsed by the LWIP protocol stack is 0x800, the message will be regarded as a communication from the host computer, and operations in the host computer debugging mode may be performed, such as configuration parameters, software updates or monitoring status. In this embodiment, the Ethernet type corresponding to 0x800 is determined as the second type.

[0104] It can be understood that the Ethernet type of the message is located in the header of the Ethernet frame, which is used to indicate which network layer protocol the data contained in the Ethernet frame payload belongs to. The IP message header protocol type is located in the header of the IP data packet, which is used to indicate which transport layer protocol the data contained in the IP data packet payload belongs to. The UDP message header port number is located in the header of the UDP data segment, which is used to indicate which application or service the UDP data should be sent to. Each layer in the LWIP protocol stack will parse the data according to the header information and pass it to the correct upper layer protocol or application. Specifically, the Ethernet layer checks the Ethernet type field, identifies that the payload is an IPv4 data packet, removes the Ethernet header, and passes the remaining data to the IP layer. The IP layer checks the IP protocol field, identifies that the payload is a UDP data packet, removes the IP header, and passes the remaining data to the UDP layer. The UDP layer checks the port number field, identifies the target port number, removes the UDP header, and passes the remaining message data to the application listening to the port number.

[0105] On this basis, after determining that the Ethernet type is the second type corresponding to the host computer communication, this embodiment sequentially identifies whether the IP header type and the UDP header port number meet the host computer communication configuration conditions. Specifically, it identifies whether the IP header type is 17. If so, it determines that the IP header type meets the host computer communication configuration conditions. If not, it indicates that the message is not a message sent by the host computer and no processing is performed. After determining that the IP header type meets the host computer communication configuration conditions, it determines whether the UDP header port number is 0x100. If so, it determines that the IP header type meets the host computer communication configuration conditions. If not, it indicates that the message is not a message sent by the host computer and no processing is performed. The IP header type and UDP header port number that meet the host computer communication configuration conditions are not limited to 17 and 0x100. They can be configured and agreed upon according to actual engineering needs. This embodiment does not limit this. If the current type is the second type corresponding to the communication with the host computer, and the IP header type and UDP header port number meet the host computer communication configuration conditions, it is determined that the message is sent by the host computer, then continue to run the program, parse the data in the message sent by the host computer, and respond to the data, get the response data and send it to the host computer to realize the function code reading and writing, parameter setting and data oscilloscope functions. This message parsing and communication configuration condition recognition mechanism ensures that the motor driver can effectively communicate with the host computer while avoiding unnecessary interference and errors.

[0106] Based on the above embodiments, Figure 2, the communication method of the motor driver is explained in detail. After the motor driver is powered on, the network controller is initialized as an Ethernet controller, that is, the current working mode of the network controller is initialized as the host computer debugging mode, and then the LWIP protocol stack and application layer related parameters are initialized, and the LWIP protocol stack and application are run to determine whether the Ethernet type of the received message is 0x0800. If the Ethernet type is 0x0800, determine whether the IP message header protocol type of the message is 17. If not, perform the operation of determining whether the Ethernet type of the received message is 0x0800. If so, determine whether the UDP message header port number of the received message is 0x100, if yes, parse the host computer data and reply, if no, execute the operation of judging whether the Ethernet type of the received message is 0x0800, if the Ethernet type is not 0x0800, judge whether the Ethernet type is 0x88A4, if not 0x88A4, execute the operation of judging whether the Ethernet type of the received message is 0x0800, if it is 0x88A4, initialize the network controller as the EtherCAT slave controller, that is, initialize the current working mode of the network controller to the slave control mode, initialize the EtherCAT protocol stack and application layer related parameters, run the EtherCAT protocol stack and EtherCAT The CoE application parses the EtherCAT master controller data and replies, and determines whether the EtherCAT status (slave operation status) is 0x08. If so, it executes the operation of parsing the EtherCAT master controller data and replying. If not, it determines whether the current count value of the EtherCAT error register 0x30C is 0xFF. If not, it executes the operation of parsing the EtherCAT master controller data and replying. If so, it executes the operation of initializing the network controller as an Ethernet controller.

[0107] In summary, the present invention solves the problem of convenient debugging of servo drives or inverter host computers in the field of industrial control, realizes that EtherCAT communication control and PC host computer debugging share the Ethernet interface, and can save the host computer communication interface such as USB, serial port or additional Ethernet port, etc., realizes the integration of EtherCAT and Ethernet communication, improves ease of use, and when using a PC host computer for debugging, it does not need to rely on the EtherCAT controller and can be performed independently, thereby improving flexibility and reducing costs.

[0108] Second, please refer to Figure 3 The present invention also provides a communication device for a motor driver, comprising:

[0109] The adjustment module 11 is used to adjust the current working mode of the network controller in the motor driver based on the current communication requirements of the motor driver; wherein the working mode of the network controller includes a host computer debugging mode and a slave station control mode;

[0110] A control module 12, used to run a protocol stack corresponding to the current working mode;

[0111] The data processing module 13 is used to respond to the triggering of the network controller and analyze the message received by the communication port of the motor driver using the protocol stack.

[0112] It can be seen that in this embodiment, the current working mode of the network controller of the motor driver is flexibly configured based on the current communication requirements of the motor driver, and the protocol stack corresponding to the current working mode is run so that the message received by the communication port is parsed through the corresponding protocol stack, so that the motor driver can communicate with the host computer and the main station controller through the same communication port, without the need to install additional physical interfaces and related hardware components, thereby reducing the manufacturing cost of the motor driver. The working mode of the network controller is configured by software to achieve switching between different communication protocols, thereby improving the flexibility and adaptability of the motor driver.

[0113] In an exemplary embodiment, the current communication demand includes a first communication demand corresponding to communication with a host computer;

[0114] Based on the current communication requirements of the motor drive, the process of adjusting the current operating mode of the network controller in the motor drive includes:

[0115] When the motor driver is in a power-on initialization process, determining the current communication demand as the first communication demand;

[0116] Adjust the current working mode of the network controller in the motor driver to the host computer debugging mode.

[0117] In an exemplary embodiment, the current communication demand includes a first communication demand corresponding to communication with a host computer;

[0118] Based on the current communication requirements of the motor drive, the process of adjusting the current operating mode of the network controller in the motor drive includes:

[0119] When the current working mode of the network controller is the slave control mode, the slave operation status of the motor driver is monitored;

[0120] When the operation state of the slave station meets the switching condition, determining the current communication demand of the motor driver as the first communication demand;

[0121] Adjust the current working mode of the network controller in the motor driver to the host computer debugging mode.

[0122] In an exemplary embodiment, when the slave operation state meets the switching condition, before determining that the current communication demand of the motor driver is the first communication demand, the communication device of the motor driver further includes:

[0123] The determination module is used to determine whether the switching condition is met when the operation state of the slave station is not the operation-ready state.

[0124] In an exemplary embodiment, when the operation state of the slave station is not in the operation-ready state, the process of determining whether the switching condition is satisfied includes:

[0125] When the slave operation state is not in the operation ready state, the current count value of the error register of the motor driver is obtained;

[0126] If the current count value reaches the pre-set value, it is determined that the switching condition is met.

[0127] In an exemplary embodiment, the current communication demand includes a second communication demand corresponding to communication with a master station controller;

[0128] Based on the current communication requirements of the motor drive, the process of adjusting the current operating mode of the network controller in the motor drive includes:

[0129] Use the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver to obtain the current type of the message;

[0130] If the current type is the first type corresponding to communication with the master controller, determining that the current communication requirement of the motor driver is the second communication requirement;

[0131] Adjust the current working mode of the network controller in the motor driver to the slave control mode.

[0132] In an exemplary embodiment, when the current working mode of the network controller is the host computer debugging mode;

[0133] The process of using the protocol stack to parse the message received by the communication port of the motor driver includes:

[0134] Use the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver to obtain the current type of the message;

[0135] If the current type is the second type corresponding to the host computer communication, and the IP message header type and the UDP message header port number both meet the host computer communication configuration conditions, the data in the message is parsed.

[0136] Third, please refer to Figure 4 The present invention also provides a motor driver, comprising:

[0137] Communication port 21, network controller 22;

[0138] A memory 23, used for storing computer programs;

[0139] The processor 24 is used to implement the steps of the communication method for the motor driver as described in any one of the above embodiments when executing the computer program.

[0140] For the introduction of the motor driver in the present application, please refer to the above embodiments, and the present invention will not be described in detail here.

[0141] The motor driver provided by the present invention has the same beneficial effects as the communication method of the motor driver mentioned above.

[0142] Fourth, please refer to Figure 5 The present invention also provides a motor control system, including a host computer, a master station controller and a plurality of motor drivers as described above.

[0143] Among them, the motor driver includes a main control chip, an SPI FLASH connected to the main control chip, the main control chip in the first motor driver is connected to two PHYs (Physical Layer Device, referring to a chip or device that implements physical layer functions in Ethernet technology) through MII (Media Independent Interface), PHY1 is used to connect to the EtherCAT master station controller or host computer through the first communication port, PHY2 is used to network with the next level motor driver through the second communication port, the first communication port of the i-th motor driver is connected to the second communication port of the i-1th motor driver, the second communication port of the i-th motor driver is connected to the first communication port of the i+1th motor driver, and the second communication port of the last i-th motor driver is suspended, i=2, 3, ..., n, n is the total number of motor drivers. In this embodiment, flexible networking can be achieved by switching the host computer network cable and the host controller network cable.

[0144] Fifth, please refer to Figure 6 The present invention further provides a computer-readable storage medium 30, on which a computer program 31 is stored. When the computer program 31 is executed by a processor, the steps of the communication method of the motor driver described in any one of the embodiments above are implemented.

[0145] The computer-readable storage medium 30 may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0146] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0147] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A communication method for a motor driver, characterized in that: include: Based on the current communication requirements of the motor driver, adjusting the current working mode of the network controller in the motor driver; wherein the working mode of the network controller includes a host computer debugging mode and a slave station control mode; Running a protocol stack corresponding to the current working mode; In response to the triggering of the network controller, the message received by the communication port of the motor driver is parsed using the protocol stack.

2. The communication method of the motor driver according to claim 1, characterized in that: The current communication requirement includes a first communication requirement corresponding to communication with a host computer; The process of adjusting the current working mode of the network controller in the motor driver based on the current communication demand of the motor driver includes: When the motor driver is in a power-on initialization process, determining that the current communication requirement is the first communication requirement; The current working mode of the network controller in the motor driver is adjusted to the host computer debugging mode.

3. The communication method of the motor driver according to claim 1, characterized in that: The current communication requirement includes a first communication requirement corresponding to communication with a host computer; The process of adjusting the current working mode of the network controller in the motor driver based on the current communication demand of the motor driver includes: When the current working mode of the network controller is the slave control mode, monitoring the slave operation state of the motor driver; When the slave operation state satisfies a switching condition, determining the current communication demand of the motor driver as the first communication demand; The current working mode of the network controller in the motor driver is adjusted to the host computer debugging mode.

4. The communication method of the motor driver according to claim 3, characterized in that: When the slave operation state meets the switching condition, before determining that the current communication requirement of the motor driver is the first communication requirement, the communication method of the motor driver further includes: When the operation state of the slave station is not the operation-ready state, it is determined that the switching condition is satisfied.

5. The communication method of the motor driver according to claim 4, characterized in that: When the operation state of the slave station is not in the operation-ready state, the process of determining whether the switching condition is satisfied includes: When the slave operation state is not an operation-ready state, obtaining a current count value of an error register of the motor driver; If the current count value reaches a preset value, it is determined that the switching condition is met.

6. The communication method of the motor driver according to any one of claims 1 to 5, characterized in that: The current communication requirement includes a second communication requirement corresponding to communication with the master station controller; The process of adjusting the current working mode of the network controller in the motor driver based on the current communication demand of the motor driver includes: Utilizing the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver, and obtaining the current type of the message; If the current type is the first type corresponding to communication with the master station controller, determining that the current communication requirement of the motor driver is the second communication requirement; The current working mode of the network controller in the motor driver is adjusted to the slave control mode.

7. The communication method of the motor driver according to claim 6, characterized in that: When the current working mode of the network controller is the host computer debugging mode; The process of using the protocol stack to parse the message received by the communication port of the motor driver includes: Utilizing the protocol stack corresponding to the debugging mode of the host computer to parse the message received by the communication port of the motor driver, and obtaining the current type of the message; If the current type is the second type corresponding to the communication with the host computer, and the IP message header type and the UDP message header port number both meet the host computer communication configuration conditions, the data in the message is parsed.

8. A communication device for a motor driver, characterized in that: include: An adjustment module, used for adjusting the current working mode of the network controller in the motor driver based on the current communication requirements of the motor driver; wherein the working mode of the network controller includes a host computer debugging mode and a slave station control mode; A control module, used for running a protocol stack corresponding to the current working mode; The data processing module is used to respond to the triggering of the network controller and use the protocol stack to parse the message received by the communication port of the motor driver.

9. A motor driver, characterized in that: include: Communication port, network controller; Memory for storing computer programs; A processor, configured to implement the steps of the communication method for the motor driver as described in any one of claims 1 to 7 when executing the computer program.

10. A motor control system, characterized in that: It includes a host computer, a master station controller and a plurality of motor drivers as claimed in claim 9.