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: FOC Speed Control Example Using CLA

Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: TMDXIDDK379D, C2000WARE

Hello,

We are working on a project where power consumption is the most critical requirement and have the following 3 questions:

  • Theoretically, would we be able to increase commutation/system efficiency by running some of the FOC processes in the CLA?   
  • Are there any examples of utilizing the CLA for FOC?
  • If we don't use the CLA, can we turn it and other peripherals off to save power?

Thanks,

Jonathan

  • 1. All FOC modules except FAST functions, EST_xx() can be executed in CLA, but using CLA and CPU in parallel is to achieve higher control frequency, not for reducing power consumption.

    2. Not yet for InstaSPIN-FOC on F28004x, but you might refer to the sensored-FOC example for F28004x at the folder below in motorControlSDK, this example uses both CLA and CPU for motor control.

    \ti\c2000\C2000Ware_MotorControl_SDK_<Version>\solutions\tmdxiddk379d\f28004x

    3. Yes, you can turn off the clock of all unused peripherals to save the device power consumption. But it should be minimal and negligible compare to the power consumption of the inverter. Maybe, implementing a lower Rson power module should be a better solution.

  • Hello Yanming,

    1. Would there be a better MCU/DRV combo for running our 250 mW 12V motor other than the 280049C/8320RS ?
    2. To be 100% can you please confirm which of the following peripherals are required for FOC?

     Thanks,
    Jonathan

  • 1. Use the right CPU frequency by changing the parameters in SysCtl_setClock() according to the required PWM and control ISR frequency.

    2. Disable the clock of the peripherals in HAL_setupPeripheralClks() except the used ePWM, ADC, PGA, CMPSS, and SPI modules for motor control. And set the all of used GPIOs to input.

    1. Is it possible to decrease the 28004 clock from 100MHz as to decrease power consumption? 
    2. Does the 28002 core consume less power than the 28004?

  • 1. Yes, you can decrease the CPU clock frequency to 60MHz if controlling ISR frequency is lower than 15kHz.

    2. You might look through the datasheet of both devices, that depends on the CPU clock frequency and enabled peripherals.

    1. After playing around with USER_SYSTEM_FREQ_MHz, we are seeing less power consumption with a higher value.  What is the max safe value for USER_SYSTEM_FREQ_MHz?

  • USER_SYSTEM_FREQ_MHz is the CPU clock frequency. The minimum value is related to the maximum controlling ISR execution time. The 60MHz should be fine for 15kHz ISR as mentioned above.

  • Our ISR freq is 5k.  We are seeing best results with a CPU clock of 140MHz.  I cannot find in the manual how fast we can safely run the CPU clock.  Can you please advise?

  • The maximum CPU clock is 100MHz per the F280049C datasheet, not 140MHz. The required CPU clock depends on the ISR execution time, which must make sure that the ISR is no overflow and there is enough CPU bandwidth for other tasks. You might set the CPU clock to 50Mhz for saving power if the motor control ISR is 5kHz and you didn't add too much code in the ISR of the example lab.

  • We have adjusted the CPU clock and the  strange thing is that power consumption increases as CPU clock decreases.  I assume this would be due to increased FOC efficiency?  Is overclocking an issue?  As I mentioned performance and power consumption is best with a CPU clock of 140MHz

  • The motor control efficiency should be the same if the PWM and ISR frequency is not changed with CPU clock frequency.

    The default CPU clock frequency should be 100MHz in the example lab, and the maximum CPU clock is also 100MHz. I can't understand how did you set the CPU clock to 140MHz which is not supported by F280049C.

    Change the code as below to set the CPU clock to 60MHz

    In user.h

    //! \brief Defines the system clock frequency, MHz
    //!
    #define USER_SYSTEM_FREQ_MHz ((float32_t)(60.0))

    In HAL_setParams() in hal.c.

    SysCtl_setClock(SYSCTL_OSCSRC_XTAL |
    SYSCTL_IMULT(6) |
    SYSCTL_FMULT_NONE |
    SYSCTL_SYSDIV(2) |
    SYSCTL_PLL_ENABLE);

  • Thank you Yanming for the additional information.  We were not adjusting the SYSCTL_IMULT value as we were adjusting USER_SYSTEM_FREQ_MHz.  Do these values need to be changed in unison?

    Even after adjusting to your recommended values, we are seeing best results when USER_SYSTEM_FREQ_MHz is 140 and SYSCTL_IMULT is 10.  I have attached user.h and hal.c below.  FYI, we are testing total power consumption under varying loading conditions using a dyno.

    USER.H
    #define USER_NUM_PWM_TICKS_PER_ISR_TICK        (1)  //2 JFA
    
    //! \brief Defines the number of ISR clock ticks per current controller clock tick
    //!
    #define USER_NUM_ISR_TICKS_PER_CURRENT_TICK     (1) //1 JFA
    
    //! \brief Defines the number of ISR clock ticks per speed controller clock tick
    //!
    #define USER_NUM_ISR_TICKS_PER_SPEED_TICK     (1) //1 JFA
    
    
    //! \brief Defines the number of current sensors
    //!
    #define USER_NUM_CURRENT_SENSORS               (3)
    
    
    //! \brief Defines the number of voltage sensors
    //!
    #define USER_NUM_VOLTAGE_SENSORS               (3)
    
    //! \brief Defines the system maximum input frequency, MHz
    //!
    //#define USER_MAXIMUM_SCALE_FREQ_Hz    ((float32_t)(1000.0))
    #define USER_MAXIMUM_SCALE_FREQ_Hz    ((float32_t)(210.0))  //(Frequency * 60)/3 pole pairs = 4,200 rpm
    
    //! \brief Defines the system clock frequency, MHz
    //!
    #define USER_SYSTEM_FREQ_MHz       ((float32_t)(140.0))
    
    
    //! \brief Defines the Pulse Width Modulation (PWM) frequency, kHz
    //!
    //#define USER_PWM_FREQ_kHz          ((float32_t)(5.0))      //5KHz PWM frequency
    //#define USER_PWM_FREQ_kHz          ((float32_t)(10.0))     //10KHz PWM frequency
    //#define USER_PWM_FREQ_kHz          ((float32_t)(12.0))     //12KHz PWM frequency
    //#define USER_PWM_FREQ_kHz          ((float32_t)(15.0))     //15KHz PWM frequency
    #define USER_PWM_FREQ_kHz          ((float32_t)(5.0))       //20KHz PWM frequency //50 JFA
    
    
    HAL.C
    // Set up PLL control and clock dividers
        // PLLSYSCLK = 20MHz (XTAL_OSC) * 10 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)
        SysCtl_setClock(SYSCTL_OSCSRC_XTAL |
                        SYSCTL_IMULT(10) |
                        SYSCTL_FMULT_NONE |
                        SYSCTL_SYSDIV(2) |
                        SYSCTL_PLL_ENABLE);

     

  • Hello Yanming,

    Why would be be seeing less power consumption, when running motor under load, by leaving clock at 100MHz (SYSCTL_IMULT(10)), while adjusting USER_SYSTEM_FREQ_MHz ((float32_t)(140.0)?

    I see that USER_SYSTEM_FREQ_MHz is used in setting up the timers.  In effort of attaining these same power consumption results could we adjust other variables which USER_SYSTEM_FREQ_MHz is affecting while at the same time matching it with the clock freq?

    Thanks,
    Jonathan

  • The USER_SYSTEM_FREQ_MHz can not be set to 140MHz, it must be the same as the CPU clock by setting in SysCtl_setClock(). Otherwise, the PWM frequency, ISR frequency, and target speed are lower than the value as you want. So the comparison result is not correct.