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.

TMS320F28335: TMS320F28335

Part Number: TMS320F28335


Tool/software:

Hi,

I am using F28335 MCU,  code with EPWM is running fine and now want to implement HRPWM.

I am using the SFO_TI_Build_V5B_fpu and SFO_V5 header file. ePWM[5] module is using for calibrating  MEP_ScaleFactor with the function, SFO_MepDis_V5(5).

When run the code,

During initialization  i am getting 51 in the MEP_ScaleFactor[5] (Sysclkout = 144MHz, PWM freq = 10 kHZ).

after that MEP_ScaleFactor[5] goes to 32767.

Any idea during calibration the MEP_ScaleFactor value with the function SFO_MepDisV5(5) is goes to very high value of 32767.

Regards,

S. Balaramkumar

  • Hello,

    Please refer to the device TRM, Chapter 4.2.4 Scale Factor Optimizing Software (SFO) for more information on SFO_TI_Build_V5.lib.: www.ti.com/.../sprui07.pdf

  • Hi, 

    Thank you for the TRM. I gone through the document could you explain the snippet code in page-339 of TRM.

    main()
    {
    // User code
    // Case1: ePWM1,2,3,4 are running in HRPWM mode
    SFO_MepEn(1); // Each of these of function enables
    SFO_MepEn(2); // the respective MEP diagnostic logic
    SFO_MepEn(3); // and returns MEP Scale factor value
    SFO_MepEn(4);
    MEP_ScaleFactor1 = MEP_ScaleFactor[1]; // used for ePWM1
    MEP_ScaleFactor2 = MEP_ScaleFactor[2]; // used for ePWM2
    MEP_ScaleFactor3 = MEP_ScaleFactor[3]; // used for ePWM3
    MEP_ScaleFactor4 = MEP_ScaleFactor[4]; // used for ePWM4
    // Case2:ePWM1,2,3 only are running in HRPWM mode.
    One of the ePWM channel(as an example ePWM4) is used as for
    Scale factor calibration
    // Here minimum duty cycle limitation is 3 clock cycles.
    //
    // HRPWM 4 MEP diagnostics circuit is used to estimate the MEP steps
    // with the assumption that all HRPWM channels behave similarly
    // though may not be identical.
    SFO_MepDis(4); // MEP steps using ePWM4
    MEP_ScaleFactor1 = MEP_ScaleFactor[4]; // used for ePWM1
    MEP_ScaleFactor2 = MEP_ScaleFactor1 // used for ePWM2
    MEP_ScaleFactor3 = MEP_ScaleFactor1 // used for ePWM3
    MEP_ScaleFactor4 = MEP_ScaleFactor1 // used for ePWM4

    From the code above i am assuming in the infinite loop if we run the line below (it will execute in every loop i.e.. every 100 us)

    SFO_MepEn(1);

    it will optimize the MEP_scaleFactor value over few cycles. Once attains the optimization it will transfer the new value into the MEP_ScaleFactor variable. 

    Am i right in understanding please correct me?

    suppose if we read the MEP_ScaleFactor before optimization what value it will give?

    Regards,

    S. Balaramkumar

  • Hello,

    In the code snippet, the MEP_ScaleFactor variable is updated with the optimized value only after the MEP diagnostic logic is enabled for ePWM channel 4, and the value is calculated using the HRPWM 4 MEP diagnostics circuit. This suggests that the MEP_ScaleFactor variable is updated after the optimization process is complete.

    So, The MEP_ScaleFactor variable stores the current value of the MEP scale factor. The SFO_MepEn(1) function reads the current value of the MEP_ScaleFactor register and returns it as the MEP scale factor value.
    The MEP_ScaleFactor variable is updated dynamically as the MEP diagnostic logic is enabled and disabled, and the MEP scale factor value is optimized.
    If you read the MEP_ScaleFactor variable before the optimization process, it will give you the initial value of the MEP scale factor, which may not be the optimal value.

  • Hi, 

    The problem is MEP_ScaleFactor[5] goes to 32767 when we use SFO_MepDisV5.

    From earlier TI forum discussions it is found the problem is due to library file SFO_TI_Build_V5B_fpu version.

    If i use the library SFO_TI_Build_V5_fpu, SFO_MepDisV5 is working fine and gives the optimization values same almost during running.

    so final conclusion is with library file SFO_TI_Build_V5_fpu, both SFO_MepDisV5, and SFO_MepEnV5 are working fine.

    with SFO_TI_Build_V5B_fpu only SFO_MepEnV5 is working fine.

    With regards,

     S. Balaramkumar

  • Hello,

    TMS320F28335 is older device, please use Gen3 device to avoid any issues with libraries and optimization.

    Regards,