This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28379D: FCL speed control

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

I'm using the LAUNCHXL-F28379D + BOOSTXL-DRV8305EVM and the FCL-SFRA example project to do speed control with a 28 volts PM brushless motor

When I compile the incremental build 2 (FCL_LEVEL2) the motor starts spinning at low speed when I set the speedRef to IQ(0.05), but I can't make it spinning much faster. For example, when I set speedRef to IQ(0.15) the motors stops even if I raise the values of VdTesting and VqTesting.

When I compile incremental build 3 (FCL_LEVEL3), the cntlr_id.fbk tracks the IdRef and cntlr_iq.fbk tracks IqRef and the motor shaft is rigidly locked from spinning as I try different values of Id and Iq. I wonder if this is the expected result.

After compiling incremental build 4 (FCL_LEVEL4) and try different values of speedRef to test de speed loopthe PID changes the Iq values and the current comsuption increases, but in all cases the motor shaft does not spin, it's always rigidly locked

I tried to swap the motor phases but still not working. The encoder reading its working in all cases.

  • In Level2 testing : - May be the dc input voltage is not enough
    For motor not spinning in other build levels, the sense of motor rotation is brought into the controller in reverse direction. Swap any two wires connected to the motor.
  • Btw, 1.0pu speed is about 500Hz which is the base speed. Make sure to not go beyond the rated speed of motor. Make sure you are satisfied with open loop performance in build level 2 before going to next levels.
  • I found that in build level 2, my code lines (1) and (2) are not present, so I had to add them to let the code lines (3) and (4) have a value :

    ///////////////////////////////////////////////////////////////////////
    phaseCurrentSense(motor);
    motor->clarke.As = motor->currentAs;             // code line (1)
    motor->clarke.Bs = motor->currentBs;             // code line (2)
    CLARKE_MACRO(motor->clarke)


    motor->park.Alpha = motor->clarke.Alpha;     // code line (3)
    motor->park.Beta = motor->clarke.Beta;         // code line (4)
    motor->park.Angle = motor->rg.Out;
    motor->park.Sine = __sinpuf32(motor->park.Angle);
    motor->park.Cosine = __cospuf32(motor->park.Angle);
    PARK_MACRO(motor->park)
    //////////////////////////////////////////////////////////////////////

    I realized of this issue when I tried to plot this two lines:

    DlogCh3 = motor->clarke.As;
    DlogCh4 = motor->clarke.Bs;

    The graphs were empty, indicating a value of 0. After adding the code lines (1) and (2), the currents A&B were shown correctly.

    Also, what is the best way to tune VqTesting and VdTesting?

    Regards

  • Good feedback. We will fix this in our SDK release later.

    Reg VdTesting and VqTesting, these are used in open loop mode. The angle of rotation is forced on the stator. Depending on the magnitude of the resultant votlage vector, the rotor angle may be off from the forced angle as there is no dynamic correction. However, the speedRef should be proportional to the vdTesting and/or VqTesting. For the sake of open loop testing, you could change either of them along with speedRef. The value of Id / Iq feedback may not carry much useful data as the angle of orientation is not aligned to rotor and is a varying parameter depending on voltage mag. I would not attach much significance to these voltages.
  • In FCL_LEVEL4 and comparing it with the IDDK FCL example code, I found that the RG macro is not present:

    motor->rg.Freq = motor->rc.SetpointValue;
    RG_MACRO(motor->rg)

     

    I'm using an absolute encoder, so I had to adapt the code and comment the QEP code lines. When I do my encoder calibration (alignment) in FCL LEVEL 4, it starts spinning to find the INDEX pulse (I know it's not necessary for absolute encoders), but it's a good way to see if my absolute encoder code works fine since it needs an ElectricalAngle. However this only works if do not comment the following code line:

    QepPosEstModule(&motor1);

     

    I don't know why this happens because my code has no reference to the qep position feedback in the spinmotor() routine.

    motor->ElecTheta = myElecAngleABS;   //(0.0 to 1.0)
    motor->speed.ElecTheta = motor->ElecTheta;
    SPEED_FR_MACRO(motor->speed)

     

    After doing the calibration, I tried to run the PID speed loop, but the motor still remains rigid, without spinning. I swaped two wires but that didn't work.

    I don't know why during qep calibration, the motor spins and even accepts changes in speedRef, following correctly my setpoint, but in the PID speed loop does not move.

     

    Regards

     

  • QepPosEstModule() is where the index pulse is identified and also QEP angle count is read. SpinMotor() helps to spin the motor initially to identify the index pulse. If you are using a different encoder, verify its function in build level 2, where the motor is operated in open loop. Once you are satisfied with the new encoder integration, then you can move on to higher build levels.

  • Let us know if the issue is resolved.
  • Not yet. Build level 2 works well. Also, when using Build level 3, the encoder calibration routine works (I'm not using the qep module). After calibration, when I set the iqref to different values, the motor remains stopped, even if I change 2 motor phases. Could the qep module, when not used, affect the FCL routine?

    I pass my absolute encoder values this way:

    motor->MechTheta = _IQ(((float)AngleMotorQ24)/16777216.0);
    motor->ElecTheta = _IQ(((float)AngleElecQ24)/16777216.0);

    AngleMotorQ24 and AngleElecQ24 are IQ24 variables (0 to 16777216) converted to pu values (0.0 to 1.0). Is that correct?

    Also, could it be possible to have the source code of the FCL library to see its contents?

    Regards

  • Yes, you may have to set the motor->park.Angle = electrical angle instead.

    Hope it works now!!

  • Thanks for the answer, I'll try that and I'll get back to you with the results. Also, where is the best place (BUILD LEVEL 3) to insert that code line and let the FCL library update correctly the Park Angle and, in this way, avoid some internal qep function do it instead

    Regards!
  • Before calling the FCL_routine(), set the angle to correct value.
  • Now it works, definitely the park angle resolved the issue. Thanks!