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.

TMS320F280039C: How to configure three hall sensor input to GPIO for calculating the motor speed and rotor position

Part Number: TMS320F280039C
Other Parts Discussed in Thread: C2000WARE

We have three hall sensors of Bldc motor. I want to calculate speed and rotor position of the bldc. I have seen one TI example of calculating the duty and time using one input signal that i understood but in this case three signals are here. Shall i use three different CAP_ISR. If i will take three ISR then how will i calculate theta and frequency using these three hall sensors. 

  • Hi Rahul,

    I am not sure which TI example you referred to. But in the universal motor lab example in C2000Ware_MOTORCONTROL_SDK, if you set the speed feedback method as "HALL", it initializes three ECAP unit for each phase, which would probably act as a reference.

    Thanks,

    Jiaxin

  • Hi Jiaxin, I am not able to understand how they configure Hall signals for speed calculation 

  • Hi Rahul,

    It may take some time to understand the peripheral configuration and debug. The example code are developed based on the hall sensors for the specified motor. You may need to make modifications based on your system. 

    Thanks,

    Jiaxin

  • void HALL_setParams(HALL_Handle handle, const USER_Params *pUserParams)
    {
    HALL_Obj *obj = (HALL_Obj *)handle;

    obj->capScaler = 3.0f * 1000000.0f * pUserParams->systemFreq_MHz;
    obj->pwmScaler = pUserParams->ctrlFreq_Hz / 2.0f;
    obj->thetaDelta_rad = MATH_TWO_PI / 36.0f;
    obj->timeCountMax = pUserParams->ctrlFreq_Hz / 1.5f; // 0.25Hz
    obj->speedSwitch_Hz = 50.0f;

    obj->hallPrev[0] = 4;
    obj->hallPrev[1] = 3;
    obj->hallPrev[2] = 6;
    obj->hallPrev[3] = 2;
    obj->hallPrev[4] = 5;
    obj->hallPrev[5] = 1;
    obj->hallPrev[6] = 4;

    #ifdef HALL_CAL
    obj->hallIndexFlag = 0; //
    #endif //HALL_CAL

    return;
    }

    Could you explain above program? what is the use of capScaler, pwmScaler , thetaDelta_rad , timeCountMax , speedSwitch_Hz.?

  • Hi Rahul,

    Please understand the calculation of the variables by referring to the definitions in "userParams.h" and the calls in other locations of the example code.

    Thank you,

    Jiaxin