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.

TMS320F28054M: Spintac position working, but spintac velocity + encoder weird behavior

Part Number: TMS320F28054M
Other Parts Discussed in Thread: DRV8305, DRV8312, MOTORWARE

Hi,

I'm debugging some weird behavior, I have my own software project based on all the labs, While the motor is stopped it can switch between Spintac velocity, Spintac position, and just torque control. And when in velocity and torque mode It can select between sensorless and encoder. This same code base also switches between the BOOSTXL DRV8305 + 28069M dev kit and my custom board based on the DRV8305 + 28054M.

I've got Spintac position working in all cases using the encoder, on the 54M and the 69M micros, works mint so far.

With spintac velocity I can only get the 69M working with the encoder angle, using the 54M is run's for about ~2.5 roll overs in position and then cuts out and Iq gets ramped up like crazy and it faults on current limit.

If I set the velocity target to a lower speed it stays operating longer but it's roughly 2.5 rollovers on the encoder position when it happens

Using spintac velocity and the FOC sensorless angle input it works on both the 69M and the 54M.

Torque control is the same, using the encoder doesn't work on the 54M

I've searched thru a lot of the encoder stuff and can't find a difference between the 54M and the 69M code.

The only clear difference I can see is that the CTRL structure on the 69M is v1p6 and the 54M is v1p7. Could this explain what's happening?

I've also got the 54M running with "FLASH" defined, and the 69M running without it defined.

Any tips on where to look for overflow? or a way to clear it to see if it fixes the issue?

Cheers,

Alan

  • Alan,

    What is the value you have set for ST_MREV_ROLLOVER?

    If you use lab 12b with the 054M do you see the same issue?

  • ST_MREV_ROLLOVER is unchanged at 10

    lab12b and the 54m have the same issue. I haven't put just lab12b on the 69M in awhile, I will try this tomorrow just to confirm this is still working

    I've flipped 2 phases on the motor and I've flipped the encoder A & B, but they all instantly stall the motor rather than keep going.

    The 54M runs at 60Mhz while the 69M is at 90Mhz

  • Alan,

    I just ran lab 12b using a 54M on the DRV8312 board.  I don't see any issues similar to what you describe.  

    I imagine there is some subtle code issue that is causing this issue.  Nothing inside of the SpinTAC code would have an issue at 2.5 mech revolutions.  

  • Ok ill continue my hunt, i have my suspision on the clock settings, like the gpio qual setup of the encoder but thats the same in the code you just tested, "GPIO_Qual_Sample_3". Maybe if i try run the 69M at 60Mhz it may shed some light on the issue somewhere else.

    I have been trying to compile without the define "FLASH" on the 54m to try illimnate that factor but I always end up in a pie illegal isr interrupt on debug.

    Is there any compiler / linker changes between the flash and release ? In the 12b project for the DRV8312 there is only one flash option. So i cobbled together the release config based roughly on the 69x projects. by just not defining "FLASH"

    I also note that in HAL_setupFlash() calls some funtions from flash regardless of the setting of "FLASH". But it isnt memcopied, i dont understand why this part is commented out. Dosnt the Flash setup functions need it?
    #if FLASH
    // Copy time critical code and Flash setup code to RAM
    // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
    // symbols are created by the linker. Refer to the linker files.
    memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart);
    #endif

    Cheers, Alan
  • Alan,

    I did not try running from the RAM only. By default the project tries to load into the FLASH due to the reduced RAM on the 054M devices.

    I would need the TIers to weigh in on differences between flash and release. I don't believe that much testing has occurred when running the 054M labs in RAM only. My recommendation would be to run from FLASH.
  • Alright I've had some progress, I've turned the spintac current limits down so it doesn't go overcurrent and I let the thing run. 

    On startup with spintac velocity and encoder it starts and runs at speed ref until the posistion count gets to 13 roll overs, or ~130turns and stops, with a holding current on the motor. If i manually rotate the motor forward or backwards to the next rollover point's (+/10 turns)  and even 40 turns further. When i release the shaft it rotaes its way back to that 13 roll over point, 130 turns ! 

    So it's somehow doing position control still !

    I'm guessing I haven't turned off the position control properly when i switch to velocity? 

    I have both definitions defined and I switch between them like this

    static ST_Obj st_obj;
    static ST_Handle gstPosHandle = NULL;
    static ST_VelObj st_Velobj;
    static ST_VelHandle gstVelHandle = NULL;

    to change from position to vel i do this with the motor stopped

    if(gstPosHandle != NULL) //If position is currently running, disable it
    {
      STPOSCTL_setEnable(gstPosHandle->posCtlHandle, false);
      gstPosHandle = NULL;
    }

    gstVelHandle = ST_Velinit(&st_Velobj, sizeof(st_Velobj)); // velocity
    ST_setupVelCtl(gstVelHandle); // Setup the SpinTAC Components

    // and the other way I do this

    if(gstVelHandle != NULL) //If velocity is currently running, disable it
    {
      STVELCTL_setEnable(gstVelHandle->velCtlHandle, false);
      gstVelHandle = NULL;
    }

    // Initialise the SpinTAC Components
    gstPosHandle = ST_init(&st_obj, sizeof(st_obj)); // position
    ST_setupPosCtl(gstPosHandle);

    the encoder init doesn't change from this declared in main, and ive taken it out of both the pos and vel objects

    // init the ST PosConv object, encoder module
    posConvHandle = STPOSCONV_init(&conv, sizeof(conv));
    ST_setupPosConv(posConvHandle);

  • It does seem like there is a coding bug in there somewhere. My guess would be that the code issue is in the run-time code and not the initialization code. My advice would be to comment out all of the position code temporary and try to run only sensored velocity mode and debug the issue from there.
  • I went all the way back to lab12b on a brand new motorware install, BOOST DRV8305 + 69m devboard and noted the same behavior, doing "position control " instead of velocity . And now my codebase doesn't work with spintac vel + encoder on the 69M either.

    I bricked my dev kit as well by accidentally flashing the 54m code onto the 69M :(

    Sooo even more confused.... I came on to write more questions and explained that it could be the new version of CCS or the motor which I haven't changed.

    And sure enough I check my motor and under the housing the flexi coupling for the encoder is loose on the shaft. Problem solved !

    So it must have slipped on the shaft, the equivalent to loosing steps I imagine? What a weird effect it had tho!