1953 views|1 replies

2015

Posts

0

Resources
The OP
 

Control of Brushless DC Motor Using DSP [Copy link]

The brushless DC motor is actually a permanent magnet synchronous motor. Generally, the rotor is made of permanent magnet material and rotates synchronously with the stator magnetic field. This motor has a simple structure, and because the physical brushes are removed, the electromagnetic performance is stable and the maintenance is simple, so it is widely used in office automation, home appliances and other fields. There are two types of control in the operation process of the brushless DC motor. One is speed control, that is, controlling the current provided to the stator coil; the other is phase change control, which changes the stator conduction phase when the rotor reaches the specified position to achieve the change of the stator magnetic field. This control actually realizes the mechanism of physical brushes. Therefore, this motor needs to have a position feedback mechanism, such as Hall elements, photoelectric encoders, or use the trapezoidal back electromotive force characteristics to detect the zero crossing of the back electromotive force. The system using the photoelectric encoder is more convenient in software implementation. The motor speed control is also based on the position feedback signal to calculate the rotor speed, and then use control methods such as PI or PID to adjust the PWM duty cycle in real time to achieve stator current regulation. Therefore, the control chip has to perform more calculation processes. Of course, there are also special DC brushless motor control chips; but generally speaking, in most applications, in addition to motor control, there are always other things such as control and communication that need to be done, so it is also a good choice to choose a chip with PWM and strong digital computing functions. Motorola's digital signal processor DSP568xx series integrates the fast computing function of general digital signal processors and the rich peripheral features of single-chip microcomputers, making this series particularly suitable for applications that require strong data processing capabilities and more control functions. The control of DC brushless motors is one of the typical applications of this series of DSPs.


Brushless DC motor structure and connection


  The three-phase brushless DC motor adopts a two-two conduction, three-phase six-state PWM modulation method. The axial schematic diagram of the motor stator winding is shown in Figure 1.



  When the current is from A to B, the magnetic field generated by the stator winding is in the direction of A-B in Figure 1. If the motor runs clockwise, the permanent magnet rotor magnetic field should be located in zone III at this time, and the torque generated is the largest. When the rotor rotates across the boundary between zones III and IV and reaches zone IV, the stator winding current should change from A to C accordingly, that is, the magnetic field generated is in the direction of A-C in Figure 1.



  In this way, the stator magnetic field always leads the rotor magnetic field by about 90°, so that the rotor keeps moving forward. The key to achieving this process is to obtain the rotor position, and the integral encoder plays this role. For example, its three outputs: PHASEA, PHASEB, and PHASEC. When the rotor is located in the I to VI areas in Figure 1, the output signals are: 011, 001, 101, 100, 110, and 010. In this way, by capturing the jump edge on any output of the integral encoder and reading the output state of the integral encoder after the jump edge, the new position of the rotor can be determined and the stator winding current can be commutated. At the same time, the timer is used to detect the time interval between two commutations, calculate the speed of the motor, and then adjust the stator current by adjusting the duty cycle of the PWM signal to achieve speed regulation.


Main modules used in DSP568xx
  In the software development kit of Motorola's DSP568xx series digital signal processor, an application program for brushless DC motor control using the above idea is given: bldc_sensors. It mainly uses the PWM module, timer module, and phase detector DECODER module of DSP.



  The PWM module has six outputs, which are used to control the top and bottom six power tubes of the three phases.
  The module can be configured in complementary channel mode, that is, PWM0 and PWM1 are a pair of complementary pairs, with a total of three complementary pairs, as shown in Figure 2. The two signals in the complementary pair can be exchanged inside the chip, as shown in Phase C in Figure 2; they can also be shielded at the same time, so that the output is all 0, and the phase is turned off, as shown in Phase A in Figure 2.

  The timer module is the most common peripheral. In this application, five timer modules are used, namely A0, A1, A2, A3 and D0. The first three are connected to one output of the integral encoder respectively. Using their input capture function, an interrupt is generated. The new output state of the integral encoder is detected in the interrupt subroutine to achieve phase change. A3 is also connected to one output of the integral encoder. It is used to measure the time interval between two transition edges of a certain Hall signal and calculate the rotor speed. D0 is used to generate a beat with a 20ms interval to periodically convert and detect the system state.

  The phase detector DECODER module is very useful for motor control. It can be used not only for the six-state quadrature encoder mentioned in this article, but also for quadrature encoders that generate a considerable number of pulses per rotor revolution. The block diagram of the module is shown in Figure 3.



  However, in this application, only the interference signal filter is used, that is, the three outputs of the integral encoder are used after filtering. The three outputs PHASEA, PHASEB, and PHASEC of the six-state integral encoder are connected to the three inputs of the phase detector PHASEA, PHASEB, and INDEX respectively.


Control algorithm
  For the control of brushless DC motors, the software content is the main body.
  The program is a front-end and back-end structure. The front-end is an infinite loop. There are two tasks in the infinite loop. One is the program state conversion ApplicationStateMachine(), and the other is the service work ServiceLedISR() such as LED control, DC voltage digital value reading and speed control triggered by 20ms clock beat. There is a global variable ApplicationMode in the program, which can be Init, Stopped, Running and Fault to indicate the status of the system. The main() function first sets the system state to Init in the initialization function Initialize(), and then implements the conversion shown in Figure 4 in the program state machine ApplicationStateMachine().



  The various conditions for transition between states are marked on the arrows in Figure 4. Other events on the hardware: input capture of timers A0, A1, A2, input capture and overflow of A3, output comparison of D0, and acceleration and deceleration buttons are all entered through interrupts. Therefore, the structure of the entire software is shown in Figure 5.

  As soon as the system is powered on, the program enters the initialization function Initialize(), in which the following tasks are performed:
  ◆Start the DC voltage ADC;
  ◆Initialize Led and start the 20ms periodic clock interrupt D0;
  ◆Initialize the switch state;
  ◆Initialize the PWM parameters;
  ◆Initialize the timers A0, A1, and A2 for capturing the transition edge of the integral encoder;
  ◆Initialize the phase detector;
  ◆ApplicationMode = Init;
  ◆Get the rotor position and set the initial conduction phase;
  ◆Initialize the PI controller;
  ◆Initialize the timer A3 for measuring the speed.

  After returning from Initialize(), it immediately enters the foreground infinite loop.
During the rotor operation, the occurrence of input capture of timers A0, A1, and A2 indicates that the rotor has reached a position where phase change is required. The input capture event triggers the interrupt ISRQTimer(). In this interrupt service routine, the following tasks are completed:
  ◆ Obtain the three-way output status of the current integral encoder from the phase detector;
  ◆ Determine the direction of rotor operation based on the current integral encoder output status;
  ◆ And adjust the exchange and shielding of the PWM module, that is, the stator current phase change.

  Therefore, the commutation of the stator current is completed in the interrupt service subroutine immediately following the output jump edge of the integral encoder. When determining the direction of the rotor, a constant array is used: DIRECTION_TABLE[8] = {0, 5, 3, 1, 6, 4, 2, 0}. The subscripts and values of the elements in this array correspond to the current encoder state and the next encoder state when the rotor is running clockwise (see Figure 1). For example, if the current encoder output is 011 and the rotor magnetic field is in zone I, then the next encoder state should be 001 when running clockwise, which corresponds to the value of the element with subscript 011 in the above array being 001. In this way, by comparing the array element value with the previous encoder state as the subscript and the current state, the direction of the rotor can be determined. When implementing the commutation of the stator current, the current state is also used as the subscript to obtain the parameters required for the channel switching and shielding of the PWM module from the special array. In this application, the parameters of the three pairs of PWM complementary channel pairs are set to be consistent. By shielding one phase and exchanging another phase, the control of the stator winding current state is achieved. As shown in Figure 2, phase A is shielded, the switch duty cycle of the top power tube of phase B is 70%, and the two PWM channels of phase C are exchanged, the switch duty cycle of the bottom power tube of phase C is increased from the original 30% to 70%, so that the current flows from phase B into the stator winding and flows out from phase C, determining the current state of the stator winding B->C.

  The transition of a certain output of the integral encoder, such as PHASEC, also triggers the input capture interrupt of timer A3. In the input capture interrupt, the time interval between each transition edge is obtained to calculate the rotor speed. The overflow interrupt of timer A3 also serves to obtain the time interval between each transition edge.

  The timer D0 has been initialized inside the LedInit() function called in the Initialize() function, so from then on, timer D0 starts running, generating an interrupt every 20ms, triggering the interrupt service subroutine LedISR() to run. In LedISR(), only a flag bit bLedISROccurred is set to true. However, this will cause the specific content of the ServiceLedISR() function in the infinite loop to be executed instead of returning directly. The specific code of the ServiceLedISR() function completes the following tasks:
  ◆Calculation and control of the LED flashing cycle;
  ◆UpButton and DownButton key delay control;
  ◆Read the DC voltage value from the ADC and restart the ADC;
  ◆Obtain the jump edge interval of an integral encoder and calculate the speed for speed control.

  Therefore, the speed control of the rotor operation is completed in ServiceLedISR() almost every 20ms cycle.

  The acceleration and deceleration buttons also trigger interrupts. In the interrupt service subroutine, the corresponding function is called to change the system set speed.


Conclusion
  Motorola's DSP568xx series of digital signal processors are very suitable for real-time applications such as DC brushless motor control, with strong data processing capabilities and powerful and rich peripherals, especially phase detectors, pulse width modulation and other modules. The control algorithm of the foreground and background mode has fast response speed and small amount of code. It has better characteristics in the occasions where the control process of DC brushless motor is not very complicated but has high real-time requirements.

This post is from DSP and ARM Processors

Latest reply

Learn from it, thank you   Details Published on 2019-10-7 11:28
 

203

Posts

0

Resources
2
 

Learn from it, thank you

This post is from DSP and ARM Processors
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list