SPRACY8 September   2021 TMS320F2800132 , TMS320F2800133 , TMS320F2800135 , TMS320F2800137 , TMS320F2800152-Q1 , TMS320F2800153-Q1 , TMS320F2800154-Q1 , TMS320F2800155 , TMS320F2800155-Q1 , TMS320F2800156-Q1 , TMS320F2800157 , TMS320F2800157-Q1 , TMS320F280025C , TMS320F280033 , TMS320F280034 , TMS320F280034-Q1 , TMS320F280036-Q1 , TMS320F280036C-Q1 , TMS320F280037 , TMS320F280037-Q1 , TMS320F280037C , TMS320F280037C-Q1 , TMS320F280038-Q1 , TMS320F280038C-Q1 , TMS320F280039 , TMS320F280039-Q1 , TMS320F280039C , TMS320F280039C-Q1

 

  1.   1
  2.   2
  3.   3
  4.   4
  5.   5
  6.   6
  7.   7
  8.   8

Labs

Permanent magnet synchronous motors (PMSM) offer numerous advantages and are a popular choice in motor drives and speed control requires three control layers to be performed. The innermost loop must determine precise rotor position to accurately commutate the stator flux. Once rotor position is known, the magnitude of the stator flux has to be calculated and controlled. Assuming that the current through the stator coils is proportional to the stator flux, then the control of the stator flux magnitude corresponds to control of the input current. Lastly, the outermost control loop regulates the motor speed.

This lab is built upon three incremental build levels:

  • In the first build level you evaluate the open loop control of the system and introduce shaft position feedback from an incremental quadrature encoder.
  • The second build level introduces tuning the PI controller using a step response.
  • The third build level enables CAN communication to receive a new speed reference.

Build Level 1 uses open loop control (Volts/frequency) initially to run the motor. This method varies the stator voltage and frequency to control the motor speed without any motor feedback. This ensures the integrity of the hardware by running the motor, namely the PWM, ADC and QEP modules for hardware abstraction layer (HAL) setup.

GUID-20210708-CA0I-Q1P9-4QPP-HFP7SKH8ZMNK-low.png Figure 5-1 Graph for the Phase A Current ADC Value

Correct ADC current scaling is achieved through Equation 1. DRV8323RS uses three high performance current-sense amplifiers for low-side current measurement where the gain GCSA is user programmable to maximize the ADC input range. Phase voltage is also measured directly from each motor phase and the voltage feedback is based on resistor dividers (R1, R2), maximum phase voltage feedback measurable by the microcontroller is calculated using Equation 2. Since the FOC algorithm requires phase current and voltage as inputs, it is important to maximize the number of bits in the ADC converter output. Current waveforms (see Figure 5-1) can be observed using the graph function.

Equation 1. I =   V v r e f 2   -   V S O x G C S A   × R S E N S E
Equation 2. V m a x a , b , c = V A D C m a x R 1 + R 2 R 2  

Motor shaft position feedback is introduced from the incremental encoder. The motor initially runs in open loop until while the QEP module waits for the index signal, a brief alignment resets the QEP count to zero and the initial position with respect to electrical zero is identified for run time corrections. This calibration angle can be formulated as shown in Equation 3.

Equation 3. C a l i b r a t e d   A n g l e =   O f f s e t   A n g l e   ± n .   L i n e   E n c o d e r

This lab is useful to:

  • Verify the hardware and software environment
  • Read ADC values from current/voltage sensors
  • Ensure correct handing of QEP signal

Build level 2 demonstrates a technique of tuning the proportional gain (Kp) and integral gain (Ki) for the current and speed controllers, this utilizes the graphing function of CCS to do step response testing. The default PI controller is just a starting point and needs tuning to meet the dynamic performance of the customer requirements.

GUID-20210708-CA0I-J0FM-SCJ3-5XXTNQLN82VT-low.gif Figure 5-2 Cascaded Speed and Current Controller of InstaSPIN-FOC

The purpose is to generate a step response in the Id current controller to be almost independent of load torque changes. This removes the need for a load emulator like a dynamometer when trying to generate the step response in Iq.

Using the graph function, it is easy to tune both the current and speed controllers by applying a step response to the system. It is easy to verify the effects of the controller gains in your system and choose the gains that meet your system response, stability and efficiency targets. This step response generation is performed in real-time with the motor running in closed loop.

In FOC, the template provided the current and speed PI controller are cascaded as shown in Figure 5-2, therefore, to begin with the step response you need to start with the current controller. This is very efficient as it has a fast-inner current loop that is enclosed by a speed loop. In a real application, this should be running with loads as in a real system; however, you can begin using a light or no load. For example, in Figure 5-3, the values of Kp and Ki have been chosen to provide a fast response with no overshoot or ringing.

GUID-20210708-CA0I-8T7V-GPS5-G77XVGC6ZRCH-low.png Figure 5-3 Current Step Response Showing no Overshoot at High Bandwidth

A typical speed step response is given in Figure 5-4, remembering that you first need to tune the current control parameters as previously mentioned. In the same way as tuning the current controller, Kp and Ki are chosen to achieve the desired behavior. Here the parameters were chosen to achieve a quick response with no overshoot.

GUID-20210708-CA0I-RJRN-W5CT-FZ2BMH6FCTWF-low.png Figure 5-4 Speed Step Response Showing no Overshoot at High Bandwidth

Build Level 3 introduces an isolated CAN transceiver, this demonstrates how to setup the can bus to receive a speed reference from a host motion controller. Here, an interrupt it generated every time the speed is updated from the host, the canISR then updates the system with a new speed reference. This can easily be modified to send additional motor control parameters that you may want.