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.

TMS320F280039C: Dual-Axis Motor Drive Using Fast Current Loop (FCL) and SFRA on a Single MCU Reference Design example:

Part Number: TMS320F280039C
Other Parts Discussed in Thread: SFRA, C2000WARE

Tool/software:

Hi TI experts,

We were trying to implement position control of BLDC motor. For that we are using LAUNCH-XL-F280039C and Dual-Axis Motor Drive Using Fast Current Loop (FCL) and SFRA on a Single MCU Reference Design example which contains position loop in BUILD_LEVEL5. this example is essentially built for LAUNCh-XL-F280049C and with encoder.

we tried to trim down the code to work with one motor and we've changed the linker cmd file to fit the x39C. we are running the code from FLASH(XIP).

Now we are in BUILD_LEVEL_5. we've edited the refPosGen() and buildLevel5_M1() api 

  • A variable motorVars[0].positionRef takes user input.
  • A global variable error which contains (input - actual value)
  • pMotor->rc.TargetValue is the return variable whose decimal values are given as input to PID loop.

now, when we tried to run the motor motorVars[0].ptrFCL->lsw == ENC_CALIBRATION_DONE, and giving input values, the motor is responding in different ways.

  • when the two IF loops are run separately. it is working fine but when the same code flashed again and again (to check the repeatability) the motor is running at different speeds every time. also, for  (err > 0.05) loop the variable  pMotor->speedLoopPrescaler = 200 is doing fine but for (err > 0.05) loop the variable  pMotor->speedLoopPrescaler = 130.  there is no much of the difference in the code so why is this variable needs different value?
  • when two loops are run, every time when re flashed the same code, either of the loops is only working.
  • when the (err > 0.05) loop is working the motor is rotating in anti-clockwise direction for err values more than 0.05. when the other values are given which results in err < -0.05 the motor still continues to rotate in the same direction but it rotates for very less number of rotations than comanded. And the same with other loop(when re flashed) but direction of motor is clockwise.

we suspected the difference of speed is because of compiler optimizations so we have kept compiler optimization level to 0 but it continued in the same way. 

Any insights about this variable speed and what else does the speed depends on. and is there any other things/places which effects the direction?

thanks & regards

Raghu

  • Hi Raghu,

    Any specific reason you are using the Dual-Axis Motor Drive Using Fast Current Loop (FCL) project? The MCSDK project below would be better to use in my opinion.

    C:\ti\c2000\C2000Ware_MotorControl_SDK_5_02_00_00\solutions\universal_motorcontrol_lab\f28003x

    Best,

    Kevin

  • Hi Kevin,

    Thanks for replying.

    we have chosen this project because it is having position loop in BUILD_LEVEL5.

    we have also seen this universal_motorcontrol_lab, but we thought Dual-Axis Motor Drive Using Fast Current Loop (FCL) project framework would be much suitable for our needs. 

    Thanks & regards

    Raghu