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.

LAUNCHXL-F280049C: ROM Fast estimator speed delayed until closed loop trajectory speed reached.

Guru 55553 points
Part Number: LAUNCHXL-F280049C

Hello,

The Instaspin FAST estimator 25µs ISR calls (below get ROM filtered speed) is delayed until closed loop target 350Hz is reached second time only. Seemingly after adding SCIB ISR handler INT9.4 giving INT 1.3 global priority with Alert errata fix B2B clear ACK's need asm(" NOP"). Adding NOP shown in advisory locks SCIB ISR loop (giving ADCC1 global priority) after it clear ACK's group 1 (INT1.3) and prior to EINT SCIB INT9.4. Let me be very clear, SCIB INT9.4 gives seamless and global priority to (ADCC1 INT1.3) without any visible interruptions to or from SCIB ISR 9.4 (5-20ms) vector. 

3 Silicon Revision B Usage Notes and Advisories:

//Good interrupt nesting code
PieCtrlRegs.PIEACK.all = 0xFFFF;

Below estimator call moved into Instaspin mainISR (25µs) return response to get ROM filtered speed is no better than being called from while loop (main.c) with global update calls to ROM.

Motor first run time speeds 0Hz-350Hz without returns of any speed updates from ROM in open loop. Motor stops 0Hz sound changes rotor goes to target (350Hz) during second time sounds like closed loop again 0Hz-350Hz. The sudden and dramatic stop hold torque at 0Hz and rotor second jumps 0Hz-350Hz is very bad for hardware.

When target speed (350Hz) first time seems (open loop), rotor rapidly stops 0Hz and 2nd time rapidly accelerates to 350Hz (closed loop). Both times after update to (motorVars.speed_Hz) CCS debug or disconnected XDS110. So disconnected LCD start button sends SCIB INT9.3 command to start motor via (motorVars.flagRunIdentAndOnLine = true) and it goes to 0Hz-350Hz, trajectory speed set via GUI page loading where slider widget can increase or decrease rotor speed after reaching preloaded trajectory speed.

The main_ISR() loop (located RAM LS4-5) where ROM calls for speed updates (without SCIB being enabled) are slightly delayed recalling open loop only during slow speed observer <1Hz in CCS debug. 

Q1: What is a work around to stop below ROM call from being delayed in main_ISR() or in main() labs.h call to global update via while loop?

Q2: Do we need to use RAM loaded FAST library calls, no longer calls to ROM embedded estimator (to slow) and what about difficulty level to test isLab07 (SPEED_MODE) this way?

Example ROM calls issue added to mainISR():

motorVars.speed_Hz = EST_getFm_lp_Hz(estHandle);

Or adding below still has slow update.  

motorVars.speed_krpm = (motorVars.speed_Hz * (60 / 1000.0 /
USER_MOTOR_NUM_POLE_PAIRS));

  • Q1: What is a work around to stop below ROM call from being delayed in main_ISR() or in main() labs.h call to global update via while loop?

    The InstaSPIN-FOC with FAST APIs are stored and executed from ROM directly that has the same execution time as from RAM. So it doesn't need to be copied to RAM as the codes in flash. 

  • Hello Yanming.

    So it doesn't need to be copied to RAM as the codes in flash. 

    Yet flash memory is slower than RAM memory fast library and ROM should be slower than RAM access times. The flash library application is loaded into .est.data RAMLS4-7. Flash fast library constants remain in flash memory section .econst.  

     Yet the decimation time mainISR() remains 25µs via 6 ticks. RAM loaded library should return (motorVars.speed_Hz) value without same delay of ROM estimator returns. The (motorVars.speed_Hz) remains blank (delayed return) even without CCS debug runtime.

    There is a missing Boolean switch in the FAST flash library and will not load (user.h) motor parameters without flag motorID=1. Adding motor ID bool flag below and compiler throws an exception. Fails even after adding #includes "userPRAMS.h" to isLab07 or placing (userParams.flagMotorIdentified = true) main.c. The module includes should point to motorID added bool switch.

    The difficulty level is about 6 to import the fast library load it into RAM. However trying to include ESMO (esmo.c) cause many compiler errors. So project compiles without error excluding ESMO but still fails to load motor parameters in CCS debug even with SCIB disabled in project.  

  • The problem of Motor ID flag is not causing user.h motorVars. parameters not to load. Rather it is the fast_full_lib_cof.lib seems to be missing a symbol. The user motorVars.~ typically load immediately when debug Resume button is clicked with Instaspin ROM library. 

    Exclude Instaspin RAM library and use original ROM symbols (f28004x_fast_rom_symbols_fpu32.lib) the motorVars.~ load as expected with SDK 4.01 userParams.h. Stil loads motorVars.~ even missing (userParams.flag_MotorIdentified) or (motorVars.flagMotorIdentified).

    Those two flags seem good to use in production code as the default motorVars.~ that loaded were very wrong and not from user.h.

  • I decide to load SDK4.0 eabi.lib with OVC fault clearing code in several of the isLab07 estimator checks. It runs motor >9KRPM but still has delayed motorVars.SpeedHertz output. Also discover Controller has Error status flag set CCS debug when running up to trajectory point and should have Online status.

    Note the CPU-Timers are counting again and all object code is in RAMGS0A though no PWMDACs are enabled for DMA transfers. 

    Later moved the ROM & Driver library, .TI_RAM_functions control data to RAMLS0_1, RAMLS0_2 noticed the patch addresses were omitted in eabi.lib C280049c_flash_is_cpu.cmd file. 

    Add code snip to check estimator status in while loop:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    if(EST_isMotorIdentified(estHandle) == true)
    {
    if(motorVars.flagSetupController == true)
    {
    //
    // update the controller
    // set custom current and speed controllers gains
    //
    updateControllers();
    }
    else
    {
    motorVars.flagMotorIdentified = true;
    motorVars.flagSetupController = true;
    // set up estimator conrollers
    setupControllers();
    }
    }
    /* Update control state debug Expressions */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Yanming,

    The problem with RAM loaded FAST library not detecting Motor ID flag or getting returns ID state from estimator remains.

    However later noticed Estimator was starting up in EST_STATE_RS open loop up to any set trajectory speed. I had to use isLab07 from SDK2.01 in SDK2.04 import due to tripping OVC fault flag somewhere inline after offset calculation.

    Anyway, the estimator Rs flag had to be cleared even though (labs.h) had both flags = false. Add below snips to top of lab stops Rs recalculation >1Hz speed and no longer delay motorVars.speed_Hz. For the controller error added check to above code snip so it remains Idle state rather than posting controller error in debug but still checks for error after the controller update.

    Note: FAST estimator Error flags (CCS debug) exceptions should be included custom code that would build around SDK framework. It would be nice to have FAST estimator exception flags polling and returns only in a separate portable C module.   

    /* Set or Clear Rs ReCalculation flag state */
    motorVars.flagEnableRsRecalc = false;

    EST_setFlag_enableRsRecalc(estHandle, motorVars.flagEnableRsRecalc);

    /* Set or Clear Online Rs Recalibration flag state */
    motorVars.flagEnableRsOnLine = false;

    /* Set slow speed estimator Rs for Maximum cold starting torque */
    EST_setFlag_enableRsOnLine(estHandle, motorVars.flagEnableRsOnLine);

  • Yes, both Rs recalculation and Rs online are disabled by default in the lab07 as the codes you mentioned above.  The users may change these variables to enable/disable these features according to their requirements.

  • The Rs flag control had been set true long time ago but was commented out project cleaned compiled write to flash many times. Somehow the ROM estimator is latching the last condition flag setting unless the code forces the flag state false. The board was powered many times between the commented statements, weeks months ago even. 

    Is the universal motor SDK not using motor ID flag and the next generation motor control framework? 

  • The motor control framework is changed without using the "CTRL" object in the Universal lab, but all of the EST functions are still the same in these two versions.