Motor based on Hall sensor and trigger and control method thereof

Through the motor control method based on Hall sensor and flip-flop, the PWM Counter and interrupt mechanism of the MCU are simplified, and the real-time and reliability problems of motor control in the prior art are solved, the failure rate is reduced and the MCU resources are saved.

CN120237881APending Publication Date: 2025-07-01XUNCHI VEHICLE IND JIANGSU
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510236972.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-01
Publication Date
2025-07-01

AI Technical Summary

Technical Problem

The existing motor control methods are difficult to meet the requirements of real-time and reliability, resulting in high failure rate and excessive MCU resource utilization.

Method used

Using a motor control method based on Hall sensor and flip-flop, the PWM Counter and interrupt mechanism of the MCU is simplified, and real-time control is achieved through specific pin connections of Hall sensor and stepper motor controller.

Benefits of technology

It improves the real-time and reliability of motor control, reduces the failure rate, saves the I/O port resources of the MCU, has a simple circuit and high working efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120237881A_ABST
    Figure CN120237881A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of motors, in particular to a motor based on a Hall sensor and a trigger and a control method of the motor, the motor is rigorous and scientific in design, saves I / O port resources of an MCU, is reasonable in hardware structure and configuration and simple in circuit, and comprises the MCU, a stepping motor, a stepping motor controller and the Hall sensor. A Hall sensor is arranged in a transmission mechanism of the stepping motor, the MCU is in circuit connection with the stepping motor controller, the stepping motor controller is in circuit connection with the stepping motor, the stepping motor is in electric signal connection with the Hall sensor, and the Hall sensor is connected with the MCU. Failure rate is low, action is safe and reliable, and working efficiency is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of motors, and in particular to a motor based on Hall sensors and triggers and its control method. Background Art

[0002] In the actual use of motors, since there is no position sensing function inside the motor, generally Hall sensors are set in the mechanical structure to sense the movement position of the motor. For example, in the use of automobile headlights, the headlight controller involves the control of Hall sensors of various functional motors, and the motors include but are not limited to ALS motors, light type motors, AFS motors, etc. The existing technology for the control circuit and corresponding methods of motors is relatively complex. Since the control of motors requires high real-time and high reliability, and in addition, the increasingly complex functional logic on the microcontroller (MCU) side for control requires a certain amount of computing power, it is difficult to meet the real-time and reliability requirements by using the CPU polling method to control the number of steps and start / stop of the motor, and it is also easy to generate some faults. Summary of the Invention

[0003] Aiming at the deficiencies of the prior art, the purpose of the present invention is to provide a motor based on Hall sensors and triggers. At the same time, a control method using the PWMCounter and interrupt inside the MCU is correspondingly proposed to ensure the real-time and reliability of motor control and solve the above technical problems.

[0004] The technical solution adopted by the present invention is as follows:

[0005] A motor based on Hall sensors and triggers includes an MCU, a stepping motor, a stepping motor controller, and a Hall sensor. It is characterized in that a Hall sensor is provided in the transmission mechanism of the stepping motor. The MCU is circuit-connected to the stepping motor controller, the stepping motor controller is circuit-connected to the stepping motor, the stepping motor is electrically connected to the Hall sensor, and the Hall sensor is circuit-connected to the MCU.

[0006] The motor based on Hall sensors and triggers is characterized in that the stepping motor controller includes a control IC. In order to achieve the corresponding control effect, the microcontroller includes the following circuit connections with the control IC of the stepping motor controller:

[0007] The MCU is provided with a pin P00, and the control IC of the stepping motor controller is correspondingly provided with a pin 2 for the error status PIN;

[0008] The MCU is provided with a pin P01, and the control IC of the stepping motor controller is circuit-connected to it with a corresponding pin 1 for the rotation direction setting PIN;

[0009] The MCU has a pin P02, and the corresponding control IC of the stepper motor controller has a pin 8 for enabling the PIN.

[0010] The MCU has a pin P03, and the corresponding control IC of the stepper motor controller has a pin 3 connected to its circuit to input the PWM pulse to the PIN for controlling the number of steps of the motor operation.

[0011] The MCU has a pin P21, and the corresponding control IC of the stepper motor controller has a pin 7 connected to its circuit for setting the motor working state 1.

[0012] The MCU has a pin P50, and the corresponding control IC of the stepper motor controller has a pin 6 connected to its circuit for setting the motor working state 2.

[0013] The MCU has a pin P51, and the corresponding control IC of the stepper motor controller has a pin 9 connected to its circuit for the sleep state PIN.

[0014] The stepper motor has coils A1, A2, B1, and B2. The connection between the stepper motor controller and the stepper motor is as follows:

[0015] The stepper motor controller has a pin 12 connected to the stepper motor coil A1 through a circuit.

[0016] The stepper motor controller has a pin 22 connected to the stepper motor coil A2 through a circuit.

[0017] The stepper motor controller has a pin 19 connected to the stepper motor coil B1 through a circuit.

[0018] The stepper motor controller has a pin 11 connected to the stepper motor coil B2 through a circuit.

[0019] The MCU has a pin P70, and the Hall sensor is connected to the MCU pin P70 so that the MCU can receive the status signal output by the Hall sensor and thus know the running position of the stepper motor.

[0020] A control method for a motor based on a Hall sensor and a trigger, characterized in that for the control of a stepper motor, after power-on, the MCU will complete the initialization of the PWM peripheral and the Hall sensor through the following steps A, B, and C in sequence. The motor is in standby. When the user gives a motor operation instruction, the system calls step D and executes it in a loop until the stop condition is met and then calls and executes step F to stop. The specific method steps are as follows:

[0021] Step A: Start the motor

[0022] 1. Enable the power supply of the motor and the Hall sensor;

[0023] 2. Register the rising edge interruption of the Hall sensor;

[0024] 3. Register the falling edge interruption of the Hall sensor;

[0025] 4. Set the motor running direction;

[0026] 5. Start the PWM drive, and the motor starts;

[0027] 6. Wait for the Hall sensor interruption to occur and execute the corresponding logic processing;

[0028] Step B: Initialize the PWM Gen, and perform the following operations:

[0029] 1. Set the clock domain of the PWM Gen peripheral;

[0030] 2. Enable the frequency divider of the PWM Gen peripheral;

[0031] 3. Initialize the PIN foot multiplexed by the peripheral;

[0032] 4. Initialize the PWM Gen to the motor dedicated mode;

[0033] 5. Enable the PWM Gen;

[0034] 6. Trigger the PWM Gen;

[0035] Step C: Initialize the PWM Counter, and perform the following operations:

[0036] 1. Set the clock domain of the PWM Counter;

[0037] 2. Enable the peripheral frequency divider of the PWM Counter;

[0038] 3. Initialize the IRQ;

[0039] 4. Set the interrupt vector table;

[0040] 5. Connect the PWM generator and the trigger;

[0041] 6. Initialize the PWM Counter;

[0042] 7. Enable the PWM Counter;

[0043] Step D: Connect the TriggerOut of the PWM generator to the TriggerIn of the PWM Counter, and perform the following operations:

[0044] 1. Set the pulse count of the PWM Counter;

[0045] 2. Trigger the output of PWM Gen;

[0046] 3. PWM Gen triggers the counting behavior of PWM Counter;

[0047] 4. After PWM Counter meets the counting condition, it calls back the interface of the HAL layer;

[0048] Step E: Hall sensor initialization and triggering, and the following operations are carried out:

[0049] 1. Enable the power supply PIN of the Hall sensor;

[0050] 2. Initialize IRQ;

[0051] 3. Register a callback function to the HAL layer;

[0052] 4. When the event requirements are met, call back the HAL layer and the driver;

[0053] Step F: CallBack Handler, and the following operations are carried out:

[0054] 1. After the conditions are met, call back the interface of the HAL layer;

[0055] 2. The HAL layer calls back the driver;

[0056] 3. The driver calls back the application layer;

[0057] 4. The application layer executes the corresponding strategy;

[0058] The stepping motor is in the standby state.

[0059] A control method for a motor based on a Hall sensor and a trigger, characterized in that for the control of a stepping motor, after power-on, the MCU will complete the initialization of the PWM peripheral and the Hall sensor through the following steps A, B, and C in sequence, the motor is in standby, when the user gives a running instruction, the system enters step D and loops. If the shutdown condition is also achieved before the conditions set in the steps are met and the Hall position sensor is triggered, then step E is executed to stop the machine. The specific method steps are as follows:

[0060] Step A: Start the motor

[0061] 1. Enable the power supply of the motor and the Hall sensor;

[0062] 2. Register the rising edge interrupt of the Hall sensor;

[0063] 3. Register the falling edge interrupt of the Hall sensor;

[0064] 4. Set the running direction of the motor;

[0065] 5. Start the PWM drive, and the motor starts to start;

[0066] 6. Wait for the Hall sensor interrupt to occur and execute the corresponding logical processing;

[0067] Step B: Initialize the PWM Gen and perform the following tasks:

[0068] 1. Set the clock domain of the PWM Gen peripheral;

[0069] 2. Enable the frequency divider of the PWM Gen peripheral;

[0070] 3. Initialize the PIN pins multiplexed by the peripheral;

[0071] 4. Initialize the PWM Gen to the motor-specific mode;

[0072] 5. Enable the PWM Gen;

[0073] 6. Trigger the PWM Gen;

[0074] Step C: Initialize the PWM Counter and perform the following tasks:

[0075] 1. Set the clock domain of the PWM Counter;

[0076] 2. Enable the peripheral frequency divider of the PWM Counter;

[0077] 3. Initialize the IRQ;

[0078] 4. Set the interrupt vector table;

[0079] 5. Connect the PWM generator and the trigger;

[0080] 6. Initialize the PWM Counter;

[0081] 7. Enable the PWM Counter;

[0082] Step D: Connect the TriggerOut of the PWM generator to the TriggerIn of the PWM Counter and perform the following tasks:

[0083] 1. Set the pulse count of the PWM Counter;

[0084] 2. Trigger the output of the PWM Gen;

[0085] 3. The PWM Gen triggers the counting behavior of the PWM Counter;

[0086] 4. The PWM Counter calls back the interface of the HAL layer after meeting the counting conditions;

[0087] Step E: Initialize and trigger the Hall sensor, and perform the following tasks:

[0088] 1. Enable the power supply PIN of the Hall sensor;

[0089] 2. Initialize the IRQ;

[0090] 3. Register the callback function to the HAL layer;

[0091] 4. Call back the HAL layer and the driver when the event requirements are met;

[0092] Step E: Initialize and trigger the Hall sensor, and mainly perform the following tasks:

[0093] 1. Enable the power supply PIN of the Hall sensor;

[0094] 2. Initialize the IRQ;

[0095] 3. Register the callback function to the HAL layer;

[0096] 4. Call back the HAL layer and the driver when the event requirements are met;

[0097] The stepping motor is in the standby state.

[0098] The motor and its control method based on Hall sensors and triggers of the present invention are designed rigorously and scientifically, saving the I / O port resources of the MCU, with a reasonable hardware structure and configuration, a simple circuit, using corresponding methods to control the motor in real time and effectively, having few failure rates, being safe and reliable in operation, and having high working efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0099] The drawings described herein are used to provide a further understanding of the present application, form a part of the present application, and the illustrative embodiments and descriptions thereof are used to explain the present application, and do not constitute an improper limitation to the present application.

[0100] Figure 1 It is the basic composition block diagram of the motor based on Hall sensors and triggers in the prior art;

[0101] Figure 2 It is the basic composition block diagram of the motor based on Hall sensors and triggers of the present invention;

[0102] Figure 3 It is the electrical schematic diagram of the motor based on Hall sensors and triggers of the present invention;

[0103] Figure 4 It is the timing diagram for initializing the PWM Channel;

[0104] Figure 5 For the initialization timing diagram of the PWM Counter

[0105] Figure 6 For the initialization timing diagram of the PWM Trigger Counter

[0106] Figure 7 For the initialization and trigger timing diagram of the Hall sensor

[0107] Figure 8 For the timing diagram of the CallBack Handler

[0108] Figure 9 For the schematic diagram of the MCU electrical connection

[0109] The preferred embodiments of the present invention will be further described below with reference to the accompanying drawings. Specific embodiments

[0110] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described below are only used to explain the present invention. In these descriptions, the keywords that need to be noted include "electrical signal connection", "circuit connection", "timing", "PWM channel", "PWM counter" and "callback handler", etc. These are only for facilitating the description of the present invention and simplifying the description, and therefore should not be construed as limiting the present invention.

[0111] Embodiment 1

[0112] As shown in Figure 2 and referring to Figure 3 and Figure 8 , in this embodiment, the motor based on the Hall sensor and the trigger is a headlight stepper motor, which is controlled by peripheral devices such as a microcontroller using relevant methods. It includes a microcontroller (MCU), a stepper motor, a stepper motor controller and a Hall sensor. In this embodiment, the microcontroller uses the T2G series chips of Travo, a company of Infineon Technologies AG, Germany. This embodiment preferably uses the Infineon Travo T2G CYT2B7x chip, and its driver library version number is: T2GDriver Library 7.9.0. The stepper motor controller uses the product of Monolithic Power Systems, Inc., USA, with the model number MPSMPQ6600L. A Hall sensor is provided in the transmission mechanism of the stepper motor. The microcontroller is circuit-connected to the stepper motor controller, the stepper motor controller is circuit-connected to the stepper motor, the stepper motor is electrically signal-connected to the Hall sensor, and the Hall sensor is circuit-connected to the microcontroller.

[0113] As Figure 3 and Figure 9 shown, the stepper motor controller includes a control IC (chip) with the model number MPQ6600L. To achieve the corresponding control function, the microcontroller includes the following circuit connections with the control IC of the stepper motor controller, specifically the MPQ6600L:

[0114] The MCU has a pin P00 (DI MOTOR1 FLTN) of the error status PIN, and the control IC of the stepper motor controller correspondingly has a pin 2 (nFAULT) for the error status PIN (only for the MCU sensing signal feedback);

[0115] The MCU has a pin P01 (DO MOTOR1 DIR) of the rotation direction setting PIN, and the control IC of the stepper motor controller correspondingly has a pin 1 (DIR) connected to it for the rotation direction setting PIN;

[0116] The MCU has a pin P02 (DO MOTOR1 ENBL) of the enable PIN, and the connected control IC of the stepper motor controller has a pin 8 (ENBL) for the enable PIN;

[0117] The MCU has a pin P03 (DPO MOTOR1 STEP) for controlling the number of steps of the motor operation, and the control IC of the stepper motor controller correspondingly has a pin 3 (STEP) connected to it, making it a PWM pulse input PIN for controlling the number of steps of the motor operation;

[0118] The MCU has a pin P21 (DO MOTOR1 MS1) of the motor operating state setting 1, and the control IC of the stepper motor controller correspondingly has a pin 7 (MS1) connected to it for the motor operating state setting 1;

[0119] The MCU has a pin P50 (DO MOTOR1 MS2) of the motor operating state setting 2, and the control IC of the stepper motor controller correspondingly has a pin 6 (MS2) connected to it for the motor operating state setting 2;

[0120] The MCU has a pin P51 (DO MOTOR1 SLEEPN) of the sleep state PIN, and the control IC of the stepper motor controller correspondingly has a pin 9 (nSLEEP) connected to it for the sleep state PIN (only for the MCU sensing signal feedback).

[0121] The stepper motor has coils A1, A2, B1, and B2. The stepper motor controller is connected to the stepper motor as follows:

[0122] The stepping motor controller is provided with a pin 12 (AOUT1), which is circuit-connected to the stepping motor coil A1;

[0123] The stepping motor controller is provided with a pin 22 (AOUT2), which is circuit-connected to the stepping motor coil A2;

[0124] The stepping motor controller is provided with a pin 19 (BOUT1), which is circuit-connected to the stepping motor coil B1;

[0125] The stepping motor controller is provided with a pin 11 (BOUT2), which is circuit-connected to the stepping motor coil B2.

[0126] The MCU is provided with a pin P70 (SENSOR GLW), and the Hall sensor is circuit-connected to the MCU pin P70 (SENSOR GLW) so that the MCU can receive the status signal output by the Hall sensor and thus know the running position of the stepping motor.

[0127] See Figure 1 As shown, compared with the existing technical solution, the present invention simplifies the control circuit and the corresponding control method. In the existing technology, one more I / O port needs to be occupied on the MCU to feedback the PWM pulse received by the stepping motor controller (the 3.STEP pin of the control IC MPQ6600L), which will bring the following problems:

[0128] 1. Higher circuit and its connection complexity;

[0129] 2. Higher failure rate;

[0130] 3. Occupying more I / O port resources of the MCU.

[0131] The present invention controls the motor based on the Hall sensor and the trigger through a supporting method step. In this embodiment, when controlling the stepping motor, after power-on, the MCU will complete the initialization of the PWM peripheral and the Hall sensor in sequence through the following steps A, B, and C, and the motor stands by. When the user gives a motor operation instruction, the system calls step D and executes it in a loop until the stop condition is met and then calls step F to stop. The specific method step content is as follows:

[0132] Step A: Start the motor

[0133] 1. Enable the power supply of the motor and the Hall sensor;

[0134] 2. Register the rising edge interrupt (RISING) of the Hall sensor;

[0135] 3. Register the falling edge interrupt (FALLING) of the Hall sensor;

[0136] 4. Set the motor running direction;

[0137] 5. Start the PWM drive, and the motor starts to start;

[0138] 6. Wait for the Hall sensor interrupt to occur and execute the corresponding logic processing;

[0139] Step B: Initialize the PWM Gen (PWM generator), see Figure 4 The described timing is that the HAL (Hardware Abstract Layer) of the MCU software calls the Infineon driver library to initialize the TCPWM peripheral. Figure 4 The described timing mainly performs the following several tasks:

[0140] 1. Set the clock domain of the PWM Gen (PWM generator) peripheral;

[0141] 2. Enable the prescaler of the PWM Gen peripheral;

[0142] 3. Initialize the PIN pins multiplexed by the peripheral;

[0143] 4. Initialize the PWM Gen to the motor dedicated mode;

[0144] 5. Enable the PWM Gen;

[0145] 6. Trigger the PWM Gen;

[0146] Step C: Initialize the PWM Counter (PWM counter), see Figure 5 The described timing mainly performs the following several tasks:

[0147] 1. Set the clock domain of the PWM Counter;

[0148] 2. Enable the prescaler of the PWM Counter peripheral;

[0149] 3. Initialize the IRQ (interrupt request);

[0150] 4. Set the interrupt vector table;

[0151] 5. Connect the PWM generator and the trigger;

[0152] 6. Initialize the PWM Counter;

[0153] 7. Enable the PWM Counter;

[0154] Step D: Connect the TriggerOut (trigger output) of the PWM generator to the TriggerIn (trigger input) of the PWM Counter. Refer to the Figure 6 described timing sequence. The following main operations are performed:

[0155] 1. Set the pulse count of the PWM Counter;

[0156] 2. Trigger the output of the PWM Gen;

[0157] 3. The PWM Gen triggers the counting behavior of the PWM Counter;

[0158] 4. After the PWM Counter meets the counting condition, call back the interface of the HAL layer;

[0159] Step F: CallBack Handler. Refer to the Figure 8 described timing sequence. The following main operations are performed:

[0160] 1. Call back the interface of the HAL layer after meeting the condition;

[0161] 2. The HAL layer calls back the driver;

[0162] 3. The driver calls back the application layer;

[0163] 4. The application layer executes the corresponding policy.

[0164] The described stepper motor is in the standby state.

[0165] Embodiment 2

[0166] This embodiment is basically similar to Embodiment 1. The difference is that another supporting method step is adopted to realize the control of the motor based on the Hall sensor and the trigger. In this embodiment, for controlling the stepper motor, after power-on, the MCU will complete the initialization of the PWM peripheral and the Hall sensor through the following steps A, B, and C in sequence. The motor is in standby. When the user gives a running instruction, the system enters Step D and loops. If the stop condition (the object driven by the motor reaches the specified position) is also met before the condition set by the step is satisfied and the Hall position sensor is triggered, then Step E is executed to stop. The specific method step content is as follows:

[0167] Step A: Start the motor

[0168] 1. Enable the power supply of the motor and the Hall sensor;

[0169] 2. Register the rising edge interrupt (RISING) of the Hall sensor;

[0170] 3. Register the falling edge interruption of the Hall sensor (FALLING);

[0171] 4. Set the running direction of the motor;

[0172] 5. Start the PWM drive and the motor starts;

[0173] 6. Wait for the Hall sensor interruption to occur and execute the corresponding logic processing;

[0174] Step B: Initialize the PWM Gen (PWM generator). See Figure 4 The described timing is that the HAL layer (Hardware Abstract Layer) of the MCU software calls the Infineon driver library to initialize the TCPWM peripheral. Figure 4 The described timing mainly performs the following tasks:

[0175] 1. Set the clock domain of the PWM Gen (PWM generator) peripheral;

[0176] 2. Enable the frequency divider of the PWM Gen peripheral;

[0177] 3. Initialize the PIN pins multiplexed by the peripheral;

[0178] 4. Initialize the PWM Gen in the motor - specific mode;

[0179] 5. Enable the PWM Gen;

[0180] 6. Trigger the PWM Gen;

[0181] Step C: Initialize the PWM Counter (PWM counter). See Figure 5 The described timing mainly performs the following tasks:

[0182] 1. Set the clock domain of the PWM Counter;

[0183] 2. Enable the peripheral frequency divider of the PWM Counter;

[0184] 3. Initialize the IRQ (interrupt request);

[0185] 4. Set the interrupt vector table;

[0186] 5. Connect the PWM generator and the trigger;

[0187] 6. Initialize the PWM Counter;

[0188] 7. Enable the PWM Counter;

[0189] Step D: Connect the TriggerOut (trigger output) of the PWM generator to the TriggerIn (trigger input) of the PWM Counter. Refer to the Figure 6 described timing sequence. The following main operations are performed:

[0190] 1. Set the pulse count of the PWM Counter;

[0191] 2. Trigger the output of the PWM Gen;

[0192] 3. The PWM Gen triggers the counting behavior of the PWM Counter;

[0193] 4. After the PWM Counter meets the counting condition, call back the interface of the HAL layer;

[0194] Step E: Initialize and trigger the Hall sensor. Refer to the Figure 7 described timing sequence. The following main operations are performed:

[0195] 1. Enable the power supply PIN of the Hall sensor;

[0196] 2. Initialize the IRQ;

[0197] 3. Register a callback function with the HAL layer;

[0198] 4. Call back the HAL layer and the driver when the event requirements are met;

[0199] The described stepper motor is in the standby state.

[0200] The above is only one implementation manner of the present invention. For those skilled in the art, the present invention can have various other implementation manners with changes and variations, which will not be elaborated here one by one. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope required by the present invention.

Claims

1. A motor based on a Hall sensor and a trigger, comprising an MCU, a stepper motor, a stepper motor controller and a Hall sensor, characterized in that: The stepper motor is provided with a Hall sensor in its transmission mechanism, the MCU is connected to the stepper motor controller circuit, the stepper motor controller is connected to the stepper motor circuit, the stepper motor is connected to the Hall sensor electrical signal, and the Hall sensor is connected to the MCU circuit.

2. The motor based on the Hall sensor and trigger according to claim 1, characterized in that: The stepper motor controller includes a control IC. In order to achieve the corresponding control function, the microcontroller includes the following circuit connections with the stepper motor controller control IC: The MCU is provided with a pin P00 (DI MOTOR1 FLTN), and the stepper motor controller control IC is correspondingly provided with a pin 2 (nFAULT) for an error status PIN; The MCU is provided with a pin P01 (DO MOTOR1 DIR), and the stepper motor controller control IC is correspondingly provided with a pin 1 (DIR) connected to its circuit for setting the running direction PIN; The MCU is provided with a pin P02 (DO MOTOR1 ENBL), and the stepper motor controller control IC is correspondingly provided with a pin 8 (ENBL) for enabling the PIN; The MCU is provided with a pin P03 (DPO MOTOR1 STEP), and the stepper motor controller control IC is correspondingly provided with a pin 3 (STEP) connected to its circuit, so that the PWM pulse is input to the PIN to control the number of steps of the motor operation; The MCU is provided with a pin P21 (DO MOTOR1 MS1), and the stepper motor controller control IC is correspondingly provided with a pin 7 (MS1) connected to its circuit for setting the motor working state 1; The MCU is provided with a pin P50 (DO MOTOR1 MS2), and the stepper motor controller control IC is correspondingly provided with a pin 6 (MS2) connected to its circuit for setting the motor working state 2; The MCU is provided with a pin P51 (DO MOTOR1 SLEEPN) and the stepper motor controller control IC is correspondingly provided with a pin 9 (nSLEEP) connected to its circuit for a sleep state PIN; The stepper motor is provided with coil A1, coil A2, coil B1 and coil B2, and the stepper motor controller is connected to the stepper motor as follows: The stepper motor controller is provided with a pin 12 (AOUT1), the circuit of which is connected to the stepper motor coil A1; The stepper motor controller is provided with a pin 22 (AOUT2), the circuit of which is connected to the stepper motor coil A2; The stepper motor controller is provided with a pin 19 (BOUT1), the circuit of which is connected to the stepper motor coil B1; The stepper motor controller is provided with a pin 11 (BOUT2), the circuit of which is connected to the stepper motor coil B2; The MCU is provided with a pin P70 (SENSOR GLW), and the Hall sensor circuit is connected to the MCU pin P70 (SENSORGLW) so that the MCU can receive the status signal output by the Hall sensor and thus know the running position of the stepper motor.

3. The motor based on the Hall sensor and trigger according to claim 1, characterized in that: For stepper motor control, after power-on, the MCU will complete the initialization of the PWM peripherals and the Hall sensor through the following steps A, B, and C in sequence, and the motor will be in standby mode. When the user gives the motor running command, the system calls step D and executes it in a loop until the shutdown condition is met and step F is called to stop. The specific method steps are as follows: Step A: Turn on the motor 1. Enable the power supply of motor and Hall sensor; 2. Register the rising edge interrupt of the Hall sensor; 3. Register the falling edge interrupt of the Hall sensor; 4. Set the motor running direction; 5. Start the PWM drive and the motor starts to start; 6. Wait for the Hall sensor to interrupt and execute corresponding logic processing; Step B: Initialize PWM Gen, and perform the following tasks:

1. Set the clock domain of the PWM Gen peripheral; 2. Enable the divider of the PWM Gen peripheral; 3. Initialize the PIN pins for peripheral multiplexing; 4. Initialize PWM Gen to motor-specific mode; 5. Enable PWM Gen; 6. Trigger PWM Gen; Step C: Initialize PWM Counter, and perform the following tasks:

1. Set the clock domain of PWM Counter; 2. Enable the PWM Counter peripheral divider; 3. Initialize IRQ; 4. Set the interrupt vector table; 5. Connect the PWM generator and trigger; 6. Initialize PWM Counter; 7. Enable PWM Counter; Step D: Connect the TriggerOut of the PWM generator to the TriggerIn of the PWMCounter. This does the following:

1. Set the pulse count of PWM Counter; 2. Trigger the output of PWM Gen; 3. PWM Gen triggers the counting behavior of PWM Counter; 4. The PWM Counter calls back the HAL layer interface after meeting the counting conditions; Step E: Initialize and trigger the Hall sensor, and perform the following tasks:

1. Enable the power supply PIN of the Hall sensor; 2. Initialize IRQ; 3. Register the callback function to the HAL layer; 4. Call back the HAL layer and driver when the event requirements are met; Step F: CallBack Handler performs the following tasks:

1. Call back the HAL layer interface after the conditions are met; 2.HAL layer callback driver; 3. The driver calls back the application layer; 4. The application layer executes the corresponding strategy; The stepper motor is in a standby state.

4. The motor based on the Hall sensor and trigger according to claim 1, characterized in that: For stepper motor control, after power-on, the MCU will complete the initialization of the PWM peripherals and the Hall sensor through the following steps A, B, and C in sequence, and the motor will be on standby. When the user gives a run command, the system enters step D and executes it in a loop. If the stop condition is also met before the conditions set in the step are met, the Hall position sensor is triggered, and step E is executed to stop. The specific method steps are as follows: Step A: Turn on the motor 1. Enable the power supply of motor and Hall sensor; 2. Register the rising edge interrupt of the Hall sensor; 3. Register the falling edge interrupt of the Hall sensor; 4. Set the motor running direction; 5. Start the PWM drive and the motor starts to start; 6. Wait for the Hall sensor to interrupt and execute corresponding logic processing; Step B: Initialize PWM Gen, and perform the following tasks:

1. Set the clock domain of the PWM Gen peripheral; 2. Enable the divider of the PWM Gen peripheral; 3. Initialize the PIN pins for peripheral multiplexing; 4. Initialize PWM Gen to motor-specific mode; 5. Enable PWM Gen; 6. Trigger PWM Gen; Step C: Initialize PWM Counter, and perform the following tasks:

1. Set the clock domain of PWM Counter; 2. Enable the PWM Counter peripheral divider; 3. Initialize IRQ; 4. Set the interrupt vector table; 5. Connect the PWM generator and trigger; 6. Initialize PWM Counter; 7. Enable PWM Counter; Step D: Connect the TriggerOut of the PWM generator to the TriggerIn of the PWMCounter. This does the following:

1. Set the pulse count of PWM Counter; 2. Trigger the output of PWM Gen; 3. PWM Gen triggers the counting behavior of PWM Counter; 4. The PWM Counter calls back the HAL layer interface after meeting the counting conditions; Step E: Initialize and trigger the Hall sensor, and perform the following tasks:

1. Enable the power supply PIN of the Hall sensor; 2. Initialize IRQ; 3. Register the callback function to the HAL layer; 4. Call back the HAL layer and driver when the event requirements are met; Step E: Initialize and trigger the Hall sensor, which mainly performs the following tasks:

1. Enable the power supply PIN of the Hall sensor; 2. Initialize IRQ; 3. Register the callback function to the HAL layer; 4. Call back the HAL layer and driver when the event requirements are met; The stepper motor is in a standby state.

5. A motor control method based on a Hall sensor and a trigger, characterized in that: For stepper motor control, after power-on, the MCU will complete the initialization of the PWM peripherals and the Hall sensor through the following steps A, B, and C in sequence, and the motor will be in standby mode. When the user gives the motor running command, the system calls step D and executes it in a loop until the shutdown condition is met and step F is called to stop. The specific method steps are as follows: Step A: Turn on the motor 1. Enable the power supply of motor and Hall sensor; 2. Register the rising edge interrupt of the Hall sensor; 3. Register the falling edge interrupt of the Hall sensor; 4. Set the motor running direction; 5. Start the PWM drive and the motor starts to start; 6. Wait for the Hall sensor to interrupt and execute corresponding logic processing; Step B: Initialize PWM Gen, and perform the following tasks:

1. Set the clock domain of the PWM Gen peripheral; 2. Enable the divider of the PWM Gen peripheral; 3. Initialize the PIN pins for peripheral multiplexing; 4. Initialize PWM Gen to motor-specific mode; 5. Enable PWM Gen; 6. Trigger PWM Gen; Step C: Initialize PWM Counter, and perform the following tasks:

1. Set the clock domain of PWM Counter; 2. Enable the PWM Counter peripheral divider; 3. Initialize IRQ; 4. Set the interrupt vector table; 5. Connect the PWM generator and trigger; 6. Initialize PWM Counter; 7. Enable PWM Counter; Step D: Connect the TriggerOut of the PWM generator to the TriggerIn of the PWMCounter. This does the following:

1. Set the pulse count of PWM Counter; 2. Trigger the output of PWM Gen; 3. PWM Gen triggers the counting behavior of PWM Counter; 4. The PWM Counter calls back the HAL layer interface after meeting the counting conditions; Step E: Initialize and trigger the Hall sensor, and perform the following tasks:

1. Enable the power supply PIN of the Hall sensor; 2. Initialize IRQ; 3. Register the callback function to the HAL layer; 4. Call back the HAL layer and driver when the event requirements are met; Step F: CallBack Handler performs the following tasks:

1. Call back the HAL layer interface after the conditions are met; 2.HAL layer callback driver; 3. The driver calls back the application layer; 4. The application layer executes the corresponding strategy; The stepper motor is in a standby state.

6. A motor control method based on a Hall sensor and a trigger, characterized in that: For stepper motor control, after power-on, the MCU will complete the initialization of the PWM peripherals and the Hall sensor through the following steps A, B, and C in sequence, and the motor will be on standby. When the user gives a run command, the system enters step D and executes it in a loop. If the stop condition is also met before the conditions set in the step are met, the Hall position sensor is triggered, and step E is executed to stop. The specific method steps are as follows: Step A: Turn on the motor 1. Enable the power supply of motor and Hall sensor; 2. Register the rising edge interrupt of the Hall sensor; 3. Register the falling edge interrupt of the Hall sensor; 4. Set the motor running direction; 5. Start the PWM drive and the motor starts to start; 6. Wait for the Hall sensor to interrupt and execute corresponding logic processing; Step B: Initialize PWM Gen, and perform the following tasks:

1. Set the clock domain of the PWM Gen peripheral; 2. Enable the divider of the PWM Gen peripheral; 3. Initialize the PIN pins for peripheral multiplexing; 4. Initialize PWM Gen to motor-specific mode; 5. Enable PWM Gen; 6. Trigger PWM Gen; Step C: Initialize PWM Counter, and perform the following tasks:

1. Set the clock domain of PWM Counter; 2. Enable the PWM Counter peripheral divider; 3. Initialize IRQ; 4. Set the interrupt vector table; 5. Connect the PWM generator and trigger; 6. Initialize PWM Counter; 7. Enable PWM Counter; Step D: Connect the TriggerOut of the PWM generator to the TriggerIn of the PWMCounter. This does the following:

1. Set the pulse count of PWM Counter; 2. Trigger the output of PWM Gen; 3. PWM Gen triggers the counting behavior of PWM Counter; 4. The PWM Counter calls back the HAL layer interface after meeting the counting conditions; Step E: Initialize and trigger the Hall sensor, and perform the following tasks:

1. Enable the power supply PIN of the Hall sensor; 2. Initialize IRQ; 3. Register the callback function to the HAL layer; 4. Call back the HAL layer and driver when the event requirements are met; Step E: Initialize and trigger the Hall sensor, mainly performing the following tasks:

1. Enable the power supply PIN of the Hall sensor; 2. Initialize IRQ; 3. Register the callback function to the HAL layer; 4. Call back the HAL layer and driver when the event requirements are met; The stepper motor is in a standby state.