Design of a Permanent Magnet Brushless DC Motor Servo Control System Based on TMS320LF2407A
2026-04-06 06:25:55··#1
Abstract : This paper first introduces the characteristics of permanent magnet brushless DC motors, then presents the overall design scheme of a servo control system based on the TMS320LF2407A DSP. The hardware system design concept, software system design process, and anti-interference scheme are also given, and simulation results show that the scheme achieves excellent control performance. Keywords : Permanent magnet brushless DC motor; Servo control; DSP; Simulation 0 Introduction Permanent magnet brushless DC motors are a new type of motor. The control system based on them has many advantages such as small size, high efficiency, and good economy, and has great development potential. Digital signal processors produced by TI have advantages such as high precision and high reliability. The TMS320LF2407A DSP can realize complete brushless DC motor control functions. It can also greatly simplify the control circuit, reduce costs, and increase system reliability. The hardware design of the motor control system using a DSP as the main control unit is simple. This article introduces a permanent magnet brushless DC motor control system based on the TMS320LF2407A digital signal processor. 1. Overall Scheme Design This system utilizes a DSP to implement fully digital dual-closed-loop control of a permanent magnet brushless DC motor. The given speed deviates from the speed feedback, and after speed regulation, a current reference is generated. The deviation between this reference and the current feedback, after current regulation, forms the control quantity for the PWM duty cycle, thus achieving motor speed control. Current feedback is achieved by detecting the voltage drop across resistor R. Speed feedback is obtained through calculation using the position output from a Hall effect position sensor. The position output from the position sensor is also used for commutation control. The system's block diagram is shown in Figure 1. 2. Hardware System Design In this system, the controller is the core component. It not only processes external signals and provides the motor drive signal, but more importantly, it implements the overall system control strategy. This system uses the TMS320LF2407A device as the control core, fully utilizing the high-speed signal processing capabilities of the TMS320LF2407A and the optimized peripheral circuitry for motor control. It boasts advantages such as high control accuracy, strong anti-interference ability, and low cost, providing reliable and efficient signal processing and hardware control for high-performance drive control. The block diagram of the DSP-based control system is shown in Figure 2. [align=center] Figure 2 Block Diagram of the DSP-based Control System[/align] 2.1 Current Detection The current sensor is a crucial component in the servo system. Its accuracy and dynamic performance directly affect the system's low-speed and high-speed performance. Current detection methods include resistance detection and optocoupler detection. This system employs a Hall element current detection method based on the magnetic balance principle. The device used is a Hall effect magnetic field compensated current sensor. It is internationally recommended as a key current detection device in power electronic circuits. It integrates the concepts of current transformer, magnetic amplifier, Hall element, and electronic circuitry, providing measurement, feedback, and protection functions. It is actually an active current transformer. Its advantage is "magnetic field compensation." The measured primary magnetic field and the measured magnetomotive force in the measuring winding are compensated to zero in real time. That is to say, there is actually no magnetic flux in the iron core, so its size can be made very small without fear of iron core saturation or frequency and harmonic effects. The reason why the magnetomotive forces of the two can be fully compensated is due to the Hall effect. Once the two are unbalanced, a Hall electromotive force will be generated on the Hall element. It serves as the input signal of a differential amplifier powered by ±15V. The output current of the amplifier is the measured current of the sensor, automatically and quickly restoring the magnetomotive force balance, that is, the Hall output always remains zero. In this way, the waveform of the current faithfully reflects the waveform of the measured current on the primary side, only with a turns ratio relationship. 2.2 Position Detection In this system, the position signal is obtained through three Hall sensors. Each Hall sensor generates an output signal with a pulse width of 180°, as shown in Figure 3. The output signals of the three Hall sensors are 120° out of phase. Thus, they have a total of 6 rising or falling edges in each mechanical rotation, which corresponds to 6 commutation moments. By configuring the TMS320LF2407A to dual-edge triggered capture interrupt function, these six timing points can be obtained. It's important to note that simply knowing the commutation timing is insufficient for correct commutation; it's also necessary to know which phase should be commutated. By setting the capture ports CAP1-CAP3 of the TMS320LF2407A as I/O ports and detecting their level states, it's possible to determine which Hall sensor's edge triggered the capture interrupt. 2.3 Speed Calculation The motor speed is calculated by the DSP using the detection signal from the photoelectric encoder. The speed can be easily calculated based on the A-phase and B-phase signals captured by the DSP's CAP/QEP pins, using the time values corresponding to the rising and falling edges of any phase signal. Alternatively, the motor speed can be calculated by dividing the number of pulses detected within a fixed time period by the fixed time interval. The parameters used for speed calculation and speed adjustment are stored in six units starting at data area 300H, with AR2 serving as the data address pointer. The variables stored in each unit are listed in Table 1. [align=center]Table 1 Variables stored in the 6 units starting from 300H[/align] 3 Software System Design The entire control system software adopts a modular design approach, conforming to the current top-down mainstream design philosophy. In this system, the CPU clock frequency is 20MHz, and the PWM frequency is 20kHz. ADC conversion is initiated through a timer 1 cycle matching event, ensuring that the current is sampled once per PWM cycle. The current is adjusted in the A/D conversion interrupt handler to control the PWM output. A capture interrupt is triggered every 60° mechanical angle rotation of the rotor to perform commutation and speed calculation. The main program flowchart of the system is shown in Figure 4. 4 System Anti-interference Design To achieve good system control performance, it is crucial to pay close attention to its anti-interference and reliability during system design. Since this system uses a high-speed DSP as the core processor, its high-frequency signals are not only susceptible to interference but can also become a source of interference for the system. Therefore, it is necessary to implement more anti-interference and protection measures for the entire system, especially the DSP section. In the hardware section, the anti-interference measures for the power supply and power drive of the control system mainly focus on prevention and resistance. The general principles are: suppress or eliminate interference sources; cut off the coupling channel between interference and the system; and reduce the system's sensitivity to interference signals. Specific measures for anti-interference design include common methods such as isolation, grounding, shielding, and filtering. In terms of software, this system mainly adopts the following software anti-interference designs: 1) Software trap method: When the system encounters external interference, it often causes the running program to enter the blank area of program memory (i.e., the no-instruction area), a phenomenon called program "runaway". Therefore, three consecutive no-operation instructions (nop) are written between subroutines, between functional modules, and in all blank areas, followed by an unconditional jump instruction. Once the program runsaway into these areas, it will automatically return to execute the normal program. 2) Program redundancy design: Important data tables and programs are written in the blank areas of program memory as backups so that backup parameters and programs can maintain normal system operation even if the system program is corrupted. Since the TMS320LF2407A's data storage is based on data pages, if operations are performed on data from different data pages without specifying the corresponding data page, it will cause the program to runaway. Therefore, it is necessary to fill in the unused data pages to prevent system malfunctions caused by data page corruption. 3) Software Watchdog Design The software watchdog built into the TMS320LF2407A can monitor software operations and provide programmable interval interrupts to reset the system in case of CPU abnormalities. Under normal circumstances, when the DSP's main program is running, it should execute the watchdog feeding logic before the watchdog timer overflows, that is, write the correct combination of values to WDKEY to clear the WD counter. If WDKEY is not fed before the watchdog overflows, the timer provides a system reset to resolve system software errors and CPU crashes, and then the software clears the WD counter WDCNTR again through the watchdog feeding logic. 5 Experimental Results In completing the hardware and software design of the system, this paper utilizes digital simulation and computer-aided design (CAD) to change the controller parameters through human-computer interaction to avoid the blindness of actual debugging. MATLAB is used as the simulation software to complete the simulation of a brushless DC motor based on an N-PI (neural network PI) control system. The simulation results are shown in Figure 5. Figure 5 (left) shows the simulation curves of the rated operation of a brushless DC motor under ordinary PI (thin solid line) control and N-PI (thick solid line) control. It can be seen that the overshoot of N-PI control is small, and the motor can reach a stable state more quickly. Figure 5 (middle) compares the simulation curves of N-PI control and ordinary PI control when the given speed is changed from 1000 r/min to 1100 r/min after the brushless DC motor has stabilized. The figure shows that N-PI has a shorter settling time than ordinary PI, can quickly reach stability, and has better tracking performance. Figure 5 (right) compares the simulation curves of ordinary PI control and N-PI control when a sudden load is applied to the brushless DC motor at 0.06 s after it has stabilized. The figure shows that N-PI control is much less affected than ordinary PI control, and has stronger robustness. 6. Conclusion The simulation results show that the system has a fast response speed, small static error, and excellent static and dynamic performance. In addition, the TMS320LF2407A has abundant on-chip resources, and the system can be expanded as needed, making it highly practical. References: [1] Wang Xiaoming, Wang Ling. DSP control of electric motor - TI company DSP application [M]. Beijing: Beijing University of Aeronautics and Astronautics Press. 2004 [2] Qin Jirong, Shen Anjun. Modern DC servo control technology and its system design [M]. Beijing: Machinery Industry Press. 1999 [3] Liu Heping, Yan Liping, Zhang Xuefeng et al. TMS320LF240xDSP structure, principle and application [M]. Beijing: Beijing University of Aeronautics and Astronautics Press. 2002 [4] Sun Jianbo, Gong Shiying, Dong Yahui. Simulation study of speed regulation system of permanent magnet brushless DC motor [J]. Micro Motor, 2001.2, 25-28 [5] Zhang Shen. Principle and application of DC brushless motor [M]. Beijing: Machinery Industry Press, 1996 [6] Zhang Yu, Chen Jingwei, Liang Zhenhong. Fully digital vector control of permanent magnet synchronous motor based on DSP [J]. Servo Technology, 2001.3, 48-50 Author Introduction : Yin Yanqing (1978-), male, from Hengyang, Hunan Province, is a teaching assistant. His main research areas are automatic control and microcontroller technology. Email: [email protected] Tel: 0734-6098825 Address: Department of Electrical and Information Engineering, Building 14, Leigongtang, Hengyang City, Hunan Province, 421008, China.