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.

Motordirection wrong

Other Parts Discussed in Thread: TMS320F28062

We are using a TMS320F28062 on our own PCB.

On motor startup we are setting the following flags:

    CTRL_setFlag_enableUserMotorParams( ctrlHandle, true );
    EST_setFlag_enableForceAngle( ctrlObj->estHandle, true );
    EST_setFlag_enableRsRecalc( ctrlObj->estHandle, true );
    CTRL_setFlag_enableCtrl( ctrlHandle, true );

In the ISR we detect if the motor is running and we disable forced angle

    if (gMotorVars.Speed_krpm != _IQ(0.0))
    {
        EST_setFlag_enableForceAngle( ctrlObj->estHandle, false );
    }

Most of the time everything works fine, but sometimes the motor controller drives the motor into the wrong direction.

In this case the wrong behaviour is 100% reproducable.

If we command positive speed the motor turns very smooth with the correct speed in the correct direction. But if we command negative speed, the motor turns forward too but with a ribble on the motorspeed.

This will occur at every commanded (backward) speed. It is not depending if the speed is below or above USER_ZEROSPEEDLIMIT.

Any suggestions what's wrong ?

  • In addition some scope plots:

    Motor current while turning forward after forward command (correct behaviour):

    Motor current while turning forward after backward command (failure):

    Motor startup current while turning forward after forward command (correct behaviour):

    (something went wrong during file storage, but the yellow plot is the interesting one)

    Motor startup current while turning forward after backward command (failure):

  • 1. which version of the compiler are you using? there is a nasty bug in 6.2.0 - 6.2.2 and one of the things that you see is an issue with reverse due to an IQmath bug.
    2. this certainly isn't usual. the motor should never run in the wrong direction (except briefly as it first starts up is possible)
    3. are you running in speed mode or just torque? if torque realize that you have to set a speed reference (even in torque mode) with a speed in the direction (+/-) to insure your torque is applied correctly and rotation is in proper direction.
    4. I wouldn't use the logic you have about turning off forceangle > 0 RPM. You should probably raise this to some other value, be it 3 Hz, 5 Hz, 10 Hz, etc. otherwise it will turn off immediately. But with forceangle enabled/disabled it shouldn't effect the system to where it ever runs in the wrong direction of command.
  • 1. I'm using the C2000_6.2.6 compiler under linux. The function "softwareUpdate1p6 will be called.

    2. In the scope plots you can see that the first sinus halfwave of the current is always positive. That will cause the motor to turn always forward. In the normal case the first sinus halfwave is negative for backward rotation.

    3 We're running in speed mode. In our application we are controling a pump. It's important that the motor has the correct speed (and direction ;-). It is required that the maximum speed 100 times higher than the  minumum speed.

    4. It is important that the motor runs very stable - even in low speed. If forced angle is active while slowing down the motor, the motor is getting unstable.
    Our lowest required speed is 10 rpm.

  • 1. ok. the softwareUpdate1p6 has nothing to do with the compiler issues though. this softwareupdate is to correct a bug in the ROM regarding the Q format of the inductance values when loading from user.h

    2. keeping the same phase wiring - and from a fresh reset / new power-up of the control system - when you command a negative speed it runs in the same direction of the positive speed? Every time? The only time I've seen this occur is due to the compiler bug. None of our proj_lab## show this behavior on any motor. Did you make changes to the core control code?

    3. ok

    4. ForceAngle should only be used - and not always then - for start-up from 0 speed. Once you have started you should disable. You want FAST to be providing the feedback when running at low speed or through zero speed. What is 10 RPM in Hz? How many poles? What is your flux value? What is your ADC_VOLTAGE?
  • 1. Ah - ok.

    2. After a reset or a power cycle everything works correct. I've written a script which commands a speed profile in a loop and after 5 loop cycles the error has occured again. Today this error has been occured only twice. Later tries to provocate this error hasn't been succesful.

    If the error occurs, the motor will always turn forward, never backward. Regardless on the commanded speed.

    Our software is very similar to the proj_lab## software. I think it's proj_lab05b. I'm still exploring on it. (I'm not the first author)
    We had implemented some add-on's to the control code. Such as store and save Ki... to / from the EEPROM, getting the commands via CAN, counting the electrical revolutions etc.

    4. We have 4 pairs of poles. 10 RPM means 0,666 Hz. Flux is 0,14666658 VpHz. The maximum voltage can be 29V. The ADC full scale Voltage is 36.3 V
  • 2. what is the speed profile doing exactly? after your speed setting you command 0 speed? then how long til you command a new +/- speed? Is ForceAngle enabled or not? I believe it is something to do with this...the state of the controllers or FAST.

    4. 0.66 Hz is probably going to be challenging in this system. @ 0.66 Hz you are looking at 0.096V of Bemf on a 36.3V scale, or 0.26% or about 11 ADC counts. You may be able to get "stable" feedback from FAST, but it certainly will have some error that would result in non ideal torque production or ability to match speed precisely.
  • 2.The speed profile commands some forward runs with different speed, with and without stopping between the commands, forward runs with the same speed extending the motor turning- angle of the last command and a speed ramp. After that the motor stops and then it is commanded to turn backwards.

    You're right, forced angle is always activated on motor start command, even if the motor hasn't stopped yet.

    I will change this now and test it.


    4. Motor startup and spinning works well down to 0,33 Hz. Below this value the motor doesn't produce enough torque to drive the pump.

  • The error still occurs. Now I know how to reproduce the error.
    When I simulate high pressure and speed is regulated down to a zero, the error occurs.
    This is independent from enabling forced angle or not.
    Perhaps very low speed commands are confusing the estimator?
  • I solved the problem.
    The off theshold of the speed regulator was too low. The regulator was - once activated - never off.
    For safety, the pump shall not turn backwards when regulating the pressure (speed) down.
    This causes that the pump always turns forward.
    The pressure value that has activated the regulator has been sent per accident.

    Chris, thanks a lot for your working on my problem.
  • really glad you got it solved!

    and thanks for sharing regarding the low speed. in your case you don't need full torque production at 0.33 Hz, which is good. But it's impressive that the estimator is still "close enough" and the control system is stable.  Very cool!