Motor drive method, electronic speed controller, and motor drive system
By storing the drive parameters in the programmable non-volatile storage unit of the electronic speed regulator and implementing a backup mechanism and CRC check, the complexity of motor model replacement caused by the solidification of drive parameters in the existing technology is solved, and the convenience and reliability of motor drive are achieved.
Patent Information
- Application Number
- CN202511100412.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-08-07
AI Technical Summary
In the existing technology, the driving parameters of the electronic speed regulator are fixed in the read-only memory of the microcontroller unit and cannot be modified dynamically. As a result, when the motor model is changed, professionals need to modify the source code, which increases labor costs and the risk of leakage, and complicates version management.
The drive parameters are stored in the drive parameter storage area and backup area of the microcontroller's programmable non-volatile storage unit, and through data verification and CRC check mechanisms, dynamic parameter updates and backups are supported, allowing non-professionals to modify them safely.
It achieves the convenience and reliability of motor drive parameters, reduces maintenance costs and leakage risks, avoids program errors caused by misoperation, and improves the flexibility and stability of the system.
Smart Images

Figure CN120601812B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of motor control technology, and in particular to a motor driving method, an electronic speed regulator, and a motor driving system. Background Art
[0002] As a key electronic component for controlling motors, the core control functions of an electronic speed controller (ESC) are typically implemented by a microcontroller. In traditional designs, the ESC control algorithm is divided into two main components: algorithmic drive parameters and software control algorithms. The drive parameters, serving as the fundamental data for the control algorithm, are typically hard-coded as constants in the microcontroller's read-only memory (ROM), becoming read-only data during program execution.
[0003] In the above design, when the controlled motor model needs to be changed, the operator cannot modify these parameters through conventional means because the drive parameters are defined as program constants. The only viable solution is to modify the control program source code. This not only requires professional programming knowledge but also may lead to the following problems: non-professionals can easily mistakenly modify other program segments when modifying the source code, introducing potential errors; frequent source code modifications increase the risk of algorithm leaks; maintenance requires professional technicians, increasing labor costs; and the need to maintain multiple program versions for different motor models significantly increases the complexity of version management.
[0004] The above content is only used to assist in understanding the technical solution of this application and does not constitute an admission that the above content is prior art. Summary of the Invention
[0005] The main purpose of this application is to provide a motor driving method, an electronic speed regulator and a motor driving system, aiming to improve the convenience and reliability of motor driving.
[0006] To achieve the above objectives, the present application proposes a motor driving method, which includes:
[0007] Acquire driving parameters of an electronic speed regulator, and store the driving parameters in a driving parameter storage area and a driving parameter backup area of a microcontroller of the electronic speed regulator; the driving parameters include a parameter number parameter based on their data format; the driving parameter storage area and the driving parameter backup area are defined in a programmable non-volatile storage unit of the microcontroller; the microcontroller further includes an initialization driving parameter area and an operation driving parameter area, the initialization driving parameter area including the initialization driving parameters;
[0008] performing data verification on the driving parameters in the driving parameter storage area and the driving parameter backup area based on the parameter number parameter of the driving parameters, and reading the driving parameters in the initialization driving parameter area, the driving parameter storage area or the driving parameter backup area according to the result of the data verification and configuring them in the operation driving parameter area;
[0009] The motor is driven to operate based on the driving parameters in the operation driving parameter area.
[0010] In one embodiment, the electronic speed regulator is communicatively connected to a host computer, and the method further includes:
[0011] Obtaining control instructions sent by the host computer;
[0012] Downloading target drive parameters based on the control instruction and configuring them in the operation drive parameter area;
[0013] And / or, configuring the driving parameters of the operation driving parameter area in the driving parameter storage area based on the control instruction.
[0014] In one embodiment, after the step of obtaining the control instruction sent by the host computer, the method further includes:
[0015] The initialization driving parameters of the initialization driving parameter area are configured in the driving parameter storage area, the driving parameter backup area and the operating driving parameter area based on the control instruction.
[0016] In one embodiment, the driving parameters further include driving verification parameters based on their data format; when the driving parameters in the driving parameter storage area and the driving parameter backup area both pass data verification, the method further includes:
[0017] Performing CRC check on the driving parameters in the driving parameter storage area and the driving parameter backup area based on the driving check parameter;
[0018] When at least one of the driving parameters in the driving parameter storage area and the driving parameter backup area passes the CRC check, the driving parameters in the driving parameter storage area or the driving parameter backup area are configured in the operating driving parameter area according to the result of the CRC check.
[0019] In one embodiment, when only one of the driving parameters in the driving parameter storage area and the driving parameter backup area passes the CRC check, the method further includes:
[0020] The driving parameters that pass the CRC check are used to overwrite the driving parameters that fail the CRC check.
[0021] In one embodiment, when the driving parameters in both the driving parameter storage area and the driving parameter backup area fail the CRC check, the method further includes:
[0022] Stop executing subsequent steps and issue an alarm.
[0023] In one embodiment, the driving parameters further include a program version parameter based on the data format thereof; when configuring the driving parameters in the driving parameter storage area or the driving parameter backup area in the running driving parameter area, the method further includes:
[0024] Performing pairing processing on the driving parameters in the running driving parameter area and the initialization driving parameters in the initialization driving parameter area based on the program version parameters of the driving parameters;
[0025] According to the result of the pairing process, the current driving parameters in the operation driving parameter area are maintained or the initialization driving parameters are configured in the operation driving parameter area.
[0026] In one embodiment, the step of storing the driving parameters in the driving parameter storage area and the driving parameter backup area of the microcontroller of the electronic speed regulator includes:
[0027] Synchronously writing the driving parameters into the driving parameter storage area and the driving parameter backup area;
[0028] Read the written drive parameters from the drive parameter storage area and the drive parameter backup area respectively, and perform CRC check;
[0029] If at least one of the drive parameter storage area and the drive parameter backup area fails the CRC check, the corresponding sector is erased and rewritten;
[0030] If the CRC check still fails after rewriting the preset number of times, the corresponding drive parameter storage area and / or drive parameter backup area will be marked.
[0031] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic speed regulator, which includes a microcontroller, and the microcontroller includes a drive parameter storage area, a drive parameter backup area, an initialization drive parameter area and an operation drive parameter area; wherein, the drive parameter storage area and the drive parameter backup area are defined in the programmable non-volatile storage unit of the microcontroller, and the initialization drive parameter area includes the initialization drive parameters; the electronic speed regulator uses the motor driving method.
[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a motor drive system, which uses the motor drive method, or the motor drive system includes the electronic speed regulator.
[0033] The motor driving method, the electronic speed regulator and the motor driving system provided by the application store the driving parameters in the programmable non-volatile storage unit and implement the backup mechanism, so that the source code does not need to be changed to realize the safe update when the parameters are modified, the data checking mechanism is used to ensure the parameter integrity, the non-professional personnel are allowed to safely modify the driving parameters, the source code modification requirement is avoided, the maintenance cost and the risk of leakage are reduced, and the convenience and reliability of the motor driving are improved. BRIEF DESCRIPTION OF DRAWINGS
[0034] The drawings incorporated in the specification and constituting a part of the specification illustrate embodiments consistent with the present application and, together with the specification, serve to explain the principles of the application.
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced as follows. Obviously, those skilled in the art can obtain other drawings from these drawings without any creative effort.
[0036] Figure 1 The flowchart provided for the first embodiment of the motor driving method of the present application;
[0037] Figure 2 The flowchart provided for the second embodiment of the motor driving method of the present application;
[0038] Figure 3 The flowchart provided for the third embodiment of the motor driving method of the present application;
[0039] Figure 4 The flowchart provided for the fourth embodiment of the motor driving method of the present application;
[0040] Figure 5 The flowchart provided for the fifth embodiment of the motor driving method of the present application;
[0041] Figure 6 The flowchart provided for the sixth embodiment of the motor driving method of the present application.
[0042] The purpose implementation, functional features and advantages of the present application will be further described with reference to the drawings combined with the embodiments. DETAILED DESCRIPTION
[0043] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application, and are not used to limit the present application.
[0044] In order to better understand the technical solutions of the present application, the drawings in the specification and the specific embodiments will be described in detail.
[0045] The main solution of the embodiment of the present application is: obtaining the driving parameters of the electronic speed regulator, and storing the driving parameters in the driving parameter storage area and driving parameter backup area of the microcontroller of the electronic speed regulator; the driving parameters include a parameter number parameter based on their data format; the driving parameter storage area and the driving parameter backup area are defined in the programmable non-volatile storage unit of the microcontroller; the microcontroller also includes an initialization driving parameter area and an operation driving parameter area, and the initialization driving parameter area includes the initialization driving parameters; then, based on the parameter number parameter of the driving parameters, the driving parameters of the driving parameter storage area and the driving parameter backup area are data verified, and according to the result of the data verification, the driving parameters of the initialization driving parameter area, the driving parameter storage area or the driving parameter backup area are read and configured in the operation driving parameter area; finally, the motor is driven to operate based on the driving parameters of the operation driving parameter area.
[0046] In this embodiment, for ease of description, the following description is made with the identification of the electronic speed regulator as the execution subject.
[0047] In existing technology, electronic speed controllers (ESCs), as key electronic components for controlling motors, typically implement their core control functions in microcontrollers. Traditionally, the ESC control algorithm is divided into two main components: algorithmic drive parameters and software control algorithms. The drive parameters, serving as the fundamental data for the control algorithm, are typically hard-coded as constants in the microcontroller's read-only memory (ROM), becoming read-only data during program execution.
[0048] In the above design, when the controlled motor model needs to be changed, the operator cannot modify these parameters through conventional means because the drive parameters are defined as program constants. The only viable solution is to modify the control program source code. This not only requires professional programming knowledge but also may lead to the following problems: non-professionals can easily mistakenly modify other program segments when modifying the source code, introducing potential errors; frequent source code modifications increase the risk of algorithm leaks; maintenance requires professional technicians, increasing labor costs; and the need to maintain multiple program versions for different motor models significantly increases the complexity of version management.
[0049] The solution provided by this application, by storing the drive parameters in a programmable non-volatile storage unit and implementing a backup mechanism, can achieve secure updates without changing the source code when the parameters are modified. At the same time, a data verification mechanism is used to ensure parameter integrity, allowing non-professionals to safely modify the drive parameters, avoiding the need to modify the source code, reducing maintenance costs and the risk of leakage, and improving the convenience and reliability of motor drive.
[0050] It should be noted that the execution subject of the embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device, an electronic governor, etc. capable of realizing the above functions. The electronic governor is taken as an example to describe the embodiment and the following embodiments.
[0051] In the prior art, the drive parameters of the electronic governor are usually fixed in the read-only memory of the microcontroller unit in the form of constants and cannot be dynamically modified. When different types of motors need to be adapted, the drive parameters must be adjusted by modifying the program source code, which not only requires the intervention of professional technicians, but also has the risk of modifying the program logic, source code leakage and high maintenance cost of multiple versions. For example, when a certain industrial production line needs to frequently replace motors of different specifications, it needs to recompile and burn the program every time, which prolongs the downtime of the equipment.
[0052] In order to solve the above problems, a mechanism capable of independently storing drive parameters and supporting dynamic updating is needed. Considering the reliability of parameter storage, a single storage area may cause data loss due to hardware failure, so a redundant backup mechanism is needed. At the same time, the validity of the parameters directly affects the control accuracy of the motor, so a data integrity verification method must be established. In addition, when the stored data is abnormal, the system needs to have automatic recovery capability to ensure basic running function.
[0053] Based on this, the embodiment of the present application provides a motor drive method, referring to Figure 1 , the method comprises steps S100-S300, wherein:
[0054] Step S100, obtaining the drive parameters of the electronic governor, and storing the drive parameters in the drive parameter storage area and the drive parameter backup area of the microcontroller of the electronic governor; the drive parameters include the number of parameters based on their data format; the drive parameter storage area and the drive parameter backup area are defined in the programmable non-volatile storage unit of the microcontroller; the microcontroller further includes an initialization drive parameter area and a running drive parameter area, and the initialization drive parameter area includes initialization drive parameters.
[0055] In this embodiment, the drive parameter storage area and the drive parameter backup area refer to two independent areas divided in the programmable non-volatile storage unit of the microcontroller, such as different sectors of the FLASH memory, for storing the drive parameters. By setting the drive parameter storage area and the drive parameter backup area at the same time, data loss caused by a single point storage failure can be prevented. The parameter number parameter is a specific field in the drive parameter data format, such as a 16-bit integer to record the total number of parameters, which is used to quickly verify whether the data in the storage area and the backup area are complete. The initialized drive parameter area includes initialized drive parameters. The data type of the initialized drive parameter is a global variable. When the program is defined, the initial value of the variable is assigned as the initialization value of the drive parameter. The initialized drive parameter area can be defined in the fixed parameter storage unit of the microcontroller, such as the ROM area, and runs as a read-write data segment (RW-data) when the program is running. The operation drive parameter area can be defined in the real-time operation data cache area of the microcontroller, such as a specific address segment in the RAM, as a storage of the operation drive parameters defined in the program. The data type is also a global variable. When the program is running, the initialization drive parameters, the drive parameters stored in the drive parameter storage area, and the drive parameters stored in the drive parameter backup area will be loaded according to the situation. It is used to load the currently effective drive parameters in real time to drive the target motor to run.
[0056] Step S200, data verification is performed on the driving parameters in the driving parameter storage area and the driving parameter backup area based on the parameter number parameter of the driving parameters, and the driving parameters in the initialization driving parameter area, the driving parameter storage area or the driving parameter backup area are read according to the result of the data verification and configured in the running driving parameter area.
[0057] In this embodiment, a parameter number verification is performed on the driving parameters in the driving parameter storage area. If the verification passes, this step is completed and a result "driving parameter storage area passed verification" is output. If the verification fails, a parameter number verification is performed on the driving parameters in the driving parameter backup area. If the verification passes, this step is completed and a result "driving parameter backup area passed verification" is output. If the verification fails, this step is completed and a result "driving parameter storage area and driving parameter backup area failed verification" is output. Specifically, the parameter number verification of the driving parameter storage area and the driving parameter backup area can be used to distinguish whether the driving parameter storage area and the driving parameter backup area store parameters. The basis is that according to the above driving parameter data format design, the driving parameter storage area and the driving parameter backup area are two FLASH areas divided from the ROM in the micro control unit. When no data is written, the two FLASH areas in the program running micro control unit will be overwritten by the high level "1". At this time, the parameter number parameter read out will not match the parameter number parameter defined by the program. At this time, the parameter number parameter in the driving parameter storage area and the driving parameter backup area can be read to distinguish whether the driving parameters have been written and perform corresponding operations: when the data verification result is "the driving parameter storage area passes the verification", the driving parameters in the driving parameter storage area are read and configured in the said running driving parameter area; when the data verification result is "the driving parameter backup area passes the verification", the driving parameters in the driving parameter backup area are read and configured in the said running driving parameter area. If both the driving parameter storage area and the driving parameter backup area fail the verification, the initialization driving parameters in the initialization driving parameter area are read and configured in the said running driving parameter area.
[0058] Step S300: driving the motor to operate based on the driving parameters in the operation driving parameter zone.
[0059] In this embodiment, when the drive parameter configuration of the operation drive parameter area is completed, the motor can be driven and controlled according to the drive parameter.
[0060] In this embodiment, the method first synchronously writes the drive parameters into the drive parameter storage area and the drive parameter backup area, then reads the parameter number parameter from the two areas, and determines the integrity of the data based on the parameter number parameter. Based on the result of the data verification, the drive parameters of the initialization drive parameter area, the drive parameter storage area, or the drive parameter backup area are read and configured in the operation drive parameter area. After the drive parameter configuration is completed in the operation drive parameter area, the parameters in the operation drive parameter area output PWM signals through the microcontroller to drive the motor operation. For example, in drone applications, when replacing a motor of a different model, only the data in the operation drive parameter area, the drive parameter storage area, and the backup area need to be downloaded and updated through the host computer, without the need to re-burn the entire control program.
[0061] Compared to existing solutions, which tightly couple drive parameters with program code, parameter modifications require recompiling the program. This solution, however, physically isolates the parameter storage area from the program storage area, allowing parameter updates to be independent of program execution. For example, while existing solutions require recompiling the firmware to modify the motor starting current parameter, this solution allows direct modification of drive parameters in the drive parameter storage area, drive parameter backup area, and running drive parameter area. Furthermore, the dual storage area design and parameter verification mechanism improve data reliability, preventing system failures caused by data corruption in a single area.
[0062] Through the above technical solution, this application realizes the decoupling of drive parameters and program logic, so that the motor parameters can be adjusted without modifying the program source code, reducing the risk of program errors caused by misoperation. At the same time, the dual storage area and verification mechanism improve the fault tolerance of parameter storage, and can still guarantee the basic operation function of the system in the event of hardware anomalies. For example, when the storage area loses part of the data due to an unexpected power outage, the system can automatically switch to the backup area or initialize the parameters to avoid complete shutdown of the equipment.
[0063] In one possible implementation, reference Figure 2 , the electronic speed regulator is communicatively connected to the host computer, and the method further includes steps S410 to S420, wherein:
[0064] Step S410, obtaining the control instruction sent by the host computer;
[0065] Step S420, downloading target driving parameters based on the control instruction and configuring them in the operation driving parameter area;
[0066] And / or, configuring the driving parameters of the operation driving parameter area in the driving parameter storage area based on the control instruction.
[0067] In this embodiment, a data transmission channel is established between the electronic speed regulator and the external control device, which can be implemented using serial communication, CAN bus, or wireless communication modules to receive external commands and transmit drive parameters. A control command refers to a command sent by a host computer containing an operation type and parameter data. Specifically, it can be encapsulated in a preset protocol format, such as including a command code, parameter length, and a checksum field, to achieve remote control of the electronic speed regulator. The target drive parameters refer to the configuration data that needs to be updated to the operating drive parameter area. Specifically, it can include motor control parameters, PID coefficients, or speed curves. Adaptation to different motors is achieved through dynamic loading.
[0068] In this embodiment, the control instructions may include a "parameter download" instruction and a "parameter solidification" instruction. When the host computer sends a "parameter download" instruction to the electronic speed regulator, the microcontroller parses the instruction content and writes the target drive parameters directly into the running drive parameter area, overwriting the original configuration data, thereby realizing parameter updates without modifying the program source code. In addition, when the host computer sends a "parameter solidification" instruction to the electronic speed regulator, the microcontroller copies the contents of the running drive parameter area to the drive parameter storage area to realize persistent storage of parameters. For example, in the scenario of changing the motor model, the operator sends a new parameter instruction through the host computer, and the electronic speed regulator immediately applies the new parameters to drive the motor. At the same time, the new parameters can be backed up to the storage area to avoid repeated configuration.
[0069] Compared with the existing technology, the existing technology only allows the adjustment of drive parameters by modifying the program source code, which leads to high maintenance costs and the risk of source code leakage. However, this solution introduces a host computer communication interface so that the drive parameters can be dynamically updated through external instructions without involving program source code modification. In the existing technology, the drive parameters are solidified in a read-only storage area and cannot adapt to different motor control requirements. However, this solution supports dynamic loading and persistent storage of parameters by separating the operating parameter area and the storage area, thereby improving system flexibility. Through the above technical solution, the present application realizes remote dynamic configuration of drive parameters, avoids the risk of program errors or confidentiality leakage caused by source code modification, and reduces dependence on professional engineers. At the same time, through the collaborative work of the operating parameter area and the storage area, it ensures that the parameter update process does not affect the operating stability of the control algorithm, and supports rapid switching of multiple versions of parameters, which significantly reduces the maintenance cost during multi-motor adaptation.
[0070] In one possible implementation, reference Figure 3 After the step of obtaining the control instruction sent by the host computer, the method further includes step S430: configuring the initialization driving parameters of the initialization driving parameter area in the driving parameter storage area, the driving parameter backup area and the running driving parameter area based on the control instruction.
[0071] In this embodiment, the control instructions may also include a "factory restore" instruction. When the host computer sends the "factory restore" instruction to the electronic speed controller, the microcontroller reads the preset default drive parameters (i.e., the initialization drive parameters) from the initialization drive parameter area and simultaneously writes these initialization drive parameters to the drive parameter storage area, the drive parameter backup area, and the operating drive parameter area. For example, when the electronic speed controller is first started or a parameter anomaly is detected, the host computer may send an initialization instruction to restore the drive parameter storage area and the backup area to their original parameters, while simultaneously loading the initialization parameters into the operating parameter area. This forcibly synchronizes the parameter contents of the three areas to their initial state, preventing operating parameter errors caused by parameter corruption in the storage or backup areas.
[0072] Compared with the existing technology, in the traditional solution, the drive parameters are solidified in the ROM and cannot be overwritten. When the default parameters need to be restored, the program must be re-burned. However, this solution triggers the synchronization of multi-area parameters through control instructions, and parameter initialization can be achieved without modifying the program. At the same time, the reliability of parameter recovery is ensured by overwriting the non-volatile storage area. Through the above technical solution, the present application can quickly restore the default values of all parameter areas when the motor is replaced or the parameters are abnormal, eliminating the risk of parameter errors caused by manual modification of the source code. The forced synchronization mechanism of the initialization parameters ensures the consistency of the drive parameter storage area, backup area and running area, avoiding system failures caused by damage to the parameters of a single area.
[0073] In a feasible implementation manner, the driving parameters further include driving verification parameters based on their data format; Figure 4 When the driving parameters in the driving parameter storage area and the driving parameter backup area pass the data verification, the method further includes steps S510 to S520, wherein:
[0074] Step S510, performing CRC check on the driving parameters in the driving parameter storage area and the driving parameter backup area based on the driving check parameter;
[0075] In step S520, when at least one of the driving parameters in the driving parameter storage area and the driving parameter backup area passes the CRC check, the driving parameters in the driving parameter storage area or the driving parameter backup area are configured in the operating driving parameter area according to the result of the CRC check.
[0076] In this embodiment, the driver verification parameter refers to verification data used to verify the integrity of the driver parameters. Specifically, it can be implemented using a CRC checksum. This checksum is generated using a preset checksum algorithm and appended to the driver parameter data to detect errors during data transmission or storage. The CRC checksum refers to a cyclic redundancy check algorithm, specifically implemented using a standard checksum method such as CRC-16 or CRC-32. By calculating the checksum value of the driver parameter and comparing it with the stored driver verification parameter, it determines whether the data has been tampered with or damaged.
[0077] In this embodiment, after the driving parameters in the driving parameter storage area and the driving parameter backup area have both passed preliminary data verification, a CRC check is further performed on both using the driving check parameter. Specifically, a CRC check value is calculated for the driving parameters in the driving parameter storage area and the driving parameter backup area, and then compared and checked with the driving check parameters stored therein to obtain a check result. If the check result shows that both the driving parameter storage area and the driving parameter backup area pass the CRC check (i.e., the CRC check value calculated based on the driving parameter storage area and the driving parameter backup area is the same as the value of the corresponding driving check parameter), the driving parameters in the driving parameter storage area are read into the running driving parameter area as the driving parameters of the software control algorithm, and this step is terminated. Similarly, if the check result shows that the CRC check in the driving parameter storage area passes but the CRC check in the driving parameter backup area fails, the driving parameters in the driving parameter storage area are read into the running driving parameter area as the driving parameters of the software control algorithm, and this step is terminated. If the check result shows that the CRC check in the driving parameter backup area passes but the CRC check in the driving parameter storage area fails, the driving parameters in the driving parameter backup area are read into the running driving parameter area as the driving parameters of the software control algorithm, and this step is terminated. This process ensures that even if data in a certain storage area is damaged, valid parameters can still be obtained through redundant backup and double verification mechanisms, avoiding motor control failure due to a single storage area failure.
[0078] Compared with existing technologies, existing solutions rely solely on fixed drive parameters in a single storage area and lack data integrity verification and redundant backup mechanisms. If the parameter storage area becomes corrupted due to unexpected power outages or electromagnetic interference, this can cause motor control anomalies or even shutdowns. This solution, by introducing drive verification parameters and a dual-storage area redundancy design, combined with a CRC check mechanism, automatically switches to valid backup data in the event of data corruption, significantly improving the system's fault tolerance.
[0079] Through the above technical solution, this application solves the control failure problem caused by abnormal drive parameter storage, ensures the integrity and availability of drive parameters through double verification and redundant backup mechanism, thereby reducing the motor operation failure rate and improving the reliability and stability of the electronic speed regulator.
[0080] In a feasible implementation manner, when only one of the driving parameters in the driving parameter storage area and the driving parameter backup area passes the CRC check, the method further includes: overwriting the driving parameters that fail the CRC check with the driving parameters that pass the CRC check.
[0081] In this embodiment, the overwrite operation refers to writing the verified correct drive parameters to the storage area that has not passed the verification. It can be specifically implemented through a sector erase and data rewrite process to repair abnormal data and maintain the consistency of dual-area data. Specifically, when the data in the drive parameter storage area fails the CRC check due to aging of the storage medium or electromagnetic interference, and the data in the drive parameter backup area passes the check, the correct data in the backup area will be extracted and completely written to the corresponding sector of the storage area. In this process, the original data in the storage area will be erased, and then the backup area data will be written byte by byte. If the storage area data passes the check but the backup area fails, a reverse overwrite operation is performed. This process is automatically executed during the startup phase of the microcontroller without manual intervention, ensuring that the running drive parameter area is always loaded with valid data.
[0082] Compared with existing technologies, traditional solutions rely only on a single storage area and have no data repair mechanism, which directly leads to system failure when the data in the storage area is damaged. This solution uses dual-area redundant storage and an automatic overwrite mechanism to quickly restore data integrity when a single area data is abnormal, avoiding system downtime caused by local storage failures. Through the above technical solution, this application solves the problem of the system being unable to self-repair when drive parameters are abnormal due to storage medium damage or external interference, improves the operating stability of the electronic speed controller under complex working conditions, and reduces the maintenance requirements caused by data errors.
[0083] In a feasible implementation manner, when the driving parameters in both the driving parameter storage area and the driving parameter backup area fail to pass the CRC check, the method further includes stopping execution of subsequent steps and issuing an alarm.
[0084] In this embodiment, the alarm refers to the issuance of an abnormal signal by hardware or software, which can be implemented by flashing an LED indicator, beeping a buzzer, or sending an error code to the host computer. Specifically, when the data in the drive parameter storage area and the drive parameter backup area cannot pass the CRC check, it indicates that the data integrity of the two redundant storage areas has been destroyed. At this time, the microcontroller actively terminates the motor drive process to avoid loading the wrong parameters into the operation drive parameter area, which causes the motor to lose control. At the same time, the alarm mechanism is triggered, and the operator is notified through an audible and visual signal or a communication interface to intervene in maintenance in time. This process is automatically executed during the system startup phase to ensure that the motor drive link will only be entered when the check is passed.
[0085] Compared with the existing technology, the traditional solution only relies on fixed parameters in a single storage area and cannot identify parameter damage. It may directly use wrong parameters to run and cause motor abnormalities. However, this solution uses dual redundant storage combined with a verification mechanism to actively stop running and alarm when the parameters are damaged, avoiding the risk of motor loss of control due to incorrect configuration, and providing maintenance personnel with clear fault indications. In this way, the present application effectively solves the problem of drive parameter damage caused by abnormal parameter storage media, preventing erroneous parameters from being loaded into the operating environment, resulting in subsequent control algorithm drive errors causing equipment damage. When both backup data fail, the operation is stopped immediately to avoid equipment damage or safety accidents caused by abnormal motor operation due to parameter errors. At the same time, the alarm mechanism is used to shorten troubleshooting time and reduce maintenance costs.
[0086] In a feasible implementation manner, the driving parameter further includes a program version parameter based on its data format; Figure 5 When configuring the driving parameters in the driving parameter storage area or the driving parameter backup area in the running driving parameter area, the method further includes:
[0087] Step S610 , pairing the driving parameters in the running driving parameter area with the initialization driving parameters in the initialization driving parameter area based on the program version parameters of the driving parameters;
[0088] Step S620 : maintaining the current driving parameters in the operation driving parameter area or configuring the initialization driving parameters in the operation driving parameter area according to the result of the pairing process.
[0089] In this embodiment, the program version parameter is the coding information in the driver parameter used to identify the version of the software control algorithm corresponding to the driver parameter, which can be implemented by increasing numbers or letter combinations, such as char version[8], V1.2, Build2023, etc. The program version parameter is defined as an independent field in the driver parameter data format and is used to establish the version correlation between the driver parameter and the software control algorithm. Pairing processing refers to comparing the program version parameter of the current driver parameter in the running driver parameter area with the program version parameter of the initialized driver parameter to determine whether the two are compatible or not.
[0090] In this embodiment, when the driving parameters of the driving parameter storage area or the driving parameter backup area are configured in the running driving parameter area, the program version parameters of the running driving parameter area are compared with the program version parameters of the initialization driving parameter area. If they are the same, this step is completed; if they are not the same, it means that the program version has been updated. At this time, the initialization driving parameter area is read into the running driving parameter area as the program software control algorithm driving parameters.
[0091] In this embodiment, after the microcontroller completes data verification in the drive parameter storage area and the backup area, it is necessary to further perform version verification. For example, when the drive parameter program version parameter configured in the running drive parameter area is displayed as V2.0, and the program version parameter in the initialization drive parameter area is V1.5, the system will determine whether to continue to use the V2.0 version parameters based on the preset version compatibility rules. If the software control algorithm only supports versions V1.5 and below, the initialization drive parameters will be automatically overwritten to the running drive parameter area. This process is implemented through the version parsing module built into the microcontroller, and the version verification and parameter replacement operations are completed during the parameter loading phase.
[0092] Compared with the existing technology, traditional electronic speed regulators lack a drive parameter version management mechanism. When the user mistakenly updates the drive parameters or upgrades the software control algorithm, control anomalies caused by the mismatch between the parameter version and the algorithm are likely to occur. This solution actively identifies the version during the parameter loading phase by introducing program version parameters and an automatic pairing mechanism, effectively avoiding motor control failures caused by version conflicts. In this way, the present application can actively identify the version compatibility of the drive parameters and the software control algorithm to prevent control logic errors caused by version mismatches. In the scenario of motor model replacement or software upgrade, the system can automatically select a compatible version of the drive parameters, reducing the need for manual intervention. When it is detected that the operating parameter version is too old or there is a compatibility risk, it automatically restores to the verified initialization parameters to ensure the operational reliability of the motor control system.
[0093] In one possible implementation, reference Figure 6 The step of storing the driving parameters in the driving parameter storage area and the driving parameter backup area of the microcontroller of the electronic speed regulator includes steps S710 to S740, wherein:
[0094] Step S710, synchronously writing the driving parameters into the driving parameter storage area and the driving parameter backup area;
[0095] Step S720, reading the written driving parameters from the driving parameter storage area and the driving parameter backup area respectively, and performing CRC check;
[0096] Step S730: If at least one of the drive parameter storage area and the drive parameter backup area fails the CRC check, the corresponding sector is erased and rewritten;
[0097] Step S740: If the CRC check still fails after rewriting the preset number of times, the corresponding driving parameter storage area and / or driving parameter backup area is marked.
[0098] In this embodiment, synchronous writing refers to saving the same driving parameter to the storage area and the backup area at the same time, which can be implemented by using a double-buffer writing mechanism. This operation can ensure that the initial states of the data in the two storage areas are consistent. With reference to the above, CRC checking refers to a cyclic redundancy check algorithm, which is used to detect possible data errors in the storage process. Sector erasing refers to clearing the entire block of data in the non-volatile storage unit, which can be implemented by using the built-in flash memory controller of the MCU. This operation can eliminate data writing abnormalities caused by physical damage to the storage unit. Marking refers to setting an identification bit for the storage area that fails the check, which can be implemented by using an independent flag register. This identification can prevent subsequent operations from continuing to use the damaged storage area.
[0099] Specifically, in the parameter storage phase, the driving parameter is written to the storage area and the backup area in parallel to establish a dual data copy. After the writing is completed, the system reads the data of the two areas and performs CRC checking, for example, the process is automatically triggered at each power-on initialization. If a region fails the check, the sector where the region is located is erased and re-written, for example, the maximum number of retries is set to 3. When the retry count is exhausted and the check still fails, the system marks the damaged area as unusable, for example, records the abnormal area address in the parameter configuration table.
[0100] Compared with the prior art, the traditional scheme only solidifies the driving parameter in the ROM area and has no data checking mechanism. Once the storage unit is physically damaged or data writing error occurs, it will directly cause the control algorithm to run abnormally. The present method realizes data redundancy backup through double-area storage and multiple checking mechanisms, and can dynamically detect and repair storage abnormalities, thereby significantly improving the parameter storage reliability. Thus, the present application effectively solves the problem of invalid driving parameters caused by damage to the storage medium or writing errors. The double storage structure avoids the risk of single point failure, the CRC checking and retry mechanism can automatically repair temporary data errors, and the damaged area marking function prevents the system from continuously using abnormal storage units. These technical means jointly ensure the integrity and availability of the driving parameter after multiple erase and write operations, thereby reducing the probability of motor control failure caused by parameter storage abnormalities.
[0101] The motor driving method provided by the present application stores the driving parameter in a programmable non-volatile storage unit and implements a backup mechanism, so that the driving parameter can be safely updated without modifying the source code when the parameter is modified. At the same time, the data checking mechanism ensures the integrity of the parameter, allowing non-professionals to safely modify the driving parameter, avoiding the need to modify the source code, reducing maintenance costs and the risk of leakage, and improving the convenience and reliability of motor driving.
[0102] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the motor driving method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0103] The present application also provides an electronic speed regulator, which includes a microcontroller, and the microcontroller includes a drive parameter storage area, a drive parameter backup area, an initialization drive parameter area and an operation drive parameter area; wherein the drive parameter storage area and the drive parameter backup area are defined in a programmable non-volatile storage unit of the microcontroller, and the initialization drive parameter area includes initialization drive parameters; the electronic speed regulator uses the motor driving method.
[0104] In this embodiment, the drive parameter storage area refers to a storage area for storing current drive parameters. Specifically, it can be implemented using an independent sector within a programmable non-volatile memory unit, such as a specific address segment within a FLASH memory. The purpose of this area is to store user-configured or updated drive parameters, avoiding reliance solely on fixed constant parameters. Similarly, the drive parameter backup area refers to a storage area for redundantly storing drive parameters. Specifically, it can be implemented using a sector physically isolated from the drive parameter storage area, such as another independent sector within the same FLASH chip. The purpose of this area is to provide data redundancy, preventing parameter loss due to damage to a single storage area. The initialization drive parameter area refers to a read-only area for storing default drive parameters. Specifically, it can be implemented using an internal ROM area within a microcontroller, such as an unmodifiable data segment embedded within the chip. The purpose of this area is to provide basic parameter configuration and serve as a recovery baseline in the event of parameter verification failure. The operation drive parameter area refers to a parameter cache area used to drive motor operation in real time. Specifically, it can be implemented using an internal RAM area within the microcontroller, such as dynamically loading parameters that have passed verification. The purpose of this area is to provide low-latency parameter access capabilities to support the operation of real-time control algorithms.
[0105] The electronic speed regulator provided in this application, by employing the motor drive method of the above-described embodiment, can improve the convenience and reliability of motor drive. Compared with the prior art, the beneficial effects of the electronic speed regulator provided in this application are the same as those of the motor drive method provided in the above-described embodiment, and the other technical features of the electronic speed regulator are the same as those disclosed in the above-described embodiment method, and are not further described here.
[0106] The present application also provides a motor drive system, which uses the motor drive method, or includes the electronic speed regulator.
[0107] The motor drive system provided in this application, by adopting the motor drive method of the above-mentioned embodiment, or including the electronic speed regulator of the above-mentioned embodiment, can improve the convenience and reliability of motor drive. Compared with the prior art, the beneficial effects of the motor drive system provided in this application are the same as the beneficial effects of the motor drive method and electronic speed regulator provided in the above-mentioned embodiment, and the other technical features of the motor drive system are the same as the features disclosed in the motor drive method or electronic speed regulator of the above-mentioned embodiment, and are not further described here.
[0108] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A motor driving method, characterized in that: The method includes: Acquire driving parameters of an electronic speed regulator, and store the driving parameters in a driving parameter storage area and a driving parameter backup area of a microcontroller of the electronic speed regulator; the driving parameters include a parameter number parameter based on their data format; the driving parameter storage area and the driving parameter backup area are defined in a programmable non-volatile storage unit of the microcontroller; the microcontroller further includes an initialization driving parameter area and an operation driving parameter area, the initialization driving parameter area including the initialization driving parameters; performing data verification on the driving parameters in the driving parameter storage area and the driving parameter backup area based on the parameter number parameter of the driving parameters, and reading the driving parameters in the initialization driving parameter area, the driving parameter storage area or the driving parameter backup area according to the result of the data verification and configuring them in the operation driving parameter area; The motor is driven to operate based on the driving parameters in the operation driving parameter area.
2. The motor driving method according to claim 1, wherein: The electronic speed regulator is communicatively connected to a host computer, and the method further comprises: Obtaining control instructions sent by the host computer; Downloading target drive parameters based on the control instruction and configuring them in the operation drive parameter area; And / or, configuring the driving parameters of the operation driving parameter area in the driving parameter storage area based on the control instruction.
3. The motor driving method according to claim 2, wherein: After the step of obtaining the control instruction sent by the host computer, the method further includes: The initialization driving parameters of the initialization driving parameter area are configured in the driving parameter storage area, the driving parameter backup area and the operating driving parameter area based on the control instruction.
4. The motor driving method according to claim 1, wherein: The driving parameters also include driving verification parameters based on their data format; When the driving parameters in the driving parameter storage area and the driving parameter backup area both pass data verification, the method further includes: Performing CRC check on the driving parameters in the driving parameter storage area and the driving parameter backup area based on the driving check parameter; When at least one of the driving parameters in the driving parameter storage area and the driving parameter backup area passes the CRC check, the driving parameters in the driving parameter storage area or the driving parameter backup area are configured in the operating driving parameter area according to the result of the CRC check.
5. The motor driving method according to claim 4, wherein: When only one of the driving parameters in the driving parameter storage area and the driving parameter backup area passes the CRC check, the method further includes: The driving parameters that pass the CRC check are used to overwrite the driving parameters that fail the CRC check.
6. The motor driving method according to claim 4, wherein: When the driving parameters in the driving parameter storage area and the driving parameter backup area fail to pass the CRC check, the method further includes: Stop executing subsequent steps and issue an alarm.
7. The motor driving method according to claim 4, wherein: The driving parameters further include a program version parameter based on the data format thereof; when configuring the driving parameters in the driving parameter storage area or the driving parameter backup area in the running driving parameter area, the method further includes: Performing pairing processing on the driving parameters in the running driving parameter area and the initialization driving parameters in the initialization driving parameter area based on the program version parameters of the driving parameters; According to the result of the pairing process, the current driving parameters in the operation driving parameter area are maintained or the initialization driving parameters are configured in the operation driving parameter area.
8. The motor driving method according to any one of claims 1 to 7, wherein: The steps of storing the drive parameters in the drive parameter storage area and the drive parameter backup area of the microcontroller of the electronic speed regulator include: Synchronously writing the driving parameters into the driving parameter storage area and the driving parameter backup area; Read the written drive parameters from the drive parameter storage area and the drive parameter backup area respectively, and perform CRC check; If at least one of the drive parameter storage area and the drive parameter backup area fails the CRC check, the corresponding sector is erased and rewritten; If the CRC check still fails after rewriting the preset number of times, the corresponding drive parameter storage area and / or drive parameter backup area will be marked.
9. An electronic speed regulator, characterized in that: The electronic speed regulator includes a microcontroller, which includes a drive parameter storage area, a drive parameter backup area, an initialization drive parameter area and an operation drive parameter area; wherein the drive parameter storage area and the drive parameter backup area are defined in a programmable non-volatile storage unit of the microcontroller, and the initialization drive parameter area includes initialization drive parameters; the electronic speed regulator uses the motor driving method according to any one of claims 1 to 8.
10. A motor drive system, characterized in that: The motor drive system uses the motor drive method according to any one of claims 1 to 8, or the motor drive system includes the electronic speed regulator according to claim 9.
Citation Information
Patent Citations
Control device and setting method for operation parameters
JP2002149206A
Inverter apparatus
JP2009213333A