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.

am437x sensored FOC ,rotor angle

Other Parts Discussed in Thread: CONTROLSUITE

Hi all

recently I have been assigned to develop sensored FOC driver using am437x . since I m very new to FOC ,I would like to verify some of my understandings.I know my question is very basic however ,unfortunately non of our local FAEs are able to answer me on this question.

Anyway I am using eQEP module on AM437x SOC device.

based on my underestimating I have to be able calculate rotor angle by performing following operations.

1.configure the eQEP to absolute mode

2.set QPOSMAX to encoder count per Revelation .  

3. read QPOSCNT.

4.divide position by 360 degree.

The division output suppose to be the rotor angle.

another question:

can I assume the startup position is the angle zero?or I need to extra step to find zero angle.like finding QEPI signal and then reset the encoder to zero position.

if you have any sample source code for sensored FOC on other devices  (like am335x , C2000 and etc) please share with me too .

thanks in advance

  • //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //My sample source code to calculate rotor angle:
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    double GetEQEP_angle(uint32_t step)
    {
    int32_t pos=HW_RD_REG32(SOC_PWMSS0_EQEP_REG+ QPOSCNT );
    double angle;
    if(pos<0)
    {
    pos=-pos;
    angle=((double)((pos%step)*360));
    angle=((double)((angle)/((double)step)));
    angle=360-angle;
    }
    else
    {
    angle=((double)((pos%step)*360));
    angle=((double)((angle)/((double)step)));
    }
    return (double)angle;
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //my source code to initialize EQEP Module
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    uint32_t QEPAppInit()
    {
    int32_t status = S_PASS;
    uint16_t ePwmSubmodType = 0;
    status = PRCMModuleEnable(CHIPDB_MOD_ID_PWMSS, 0, 0);
    if(S_PASS != status)
    {
    CONSOLEUtilsPrintf("\n FAILURE!!! Clock Configuration failed !\n");
    }
    else
    {
    QEP_PinMux();
    QEPClockEnable(SOC_PWMSS0_REG);
    HW_WR_REG32(SOC_PWMSS0_EQEP_REG+ QPOSMAX , (~0));
    HW_WR_REG16(SOC_PWMSS0_EQEP_REG+ QEPCTL , ((1<<PHEN)|(1<<PCRM)));
    }
    return status;
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // The END
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  • Hi Nima,

    For your question about AM437x, please post in the Sitara forum here: e2e.ti.com/.../

    As far as C2000 examples for motor control, you can check out the application kits provided by C2000 at the following link, under motor Control:

    www.ti.com/.../tools_software.page

    You can find the schematics and SW for the kits by downloading ControlSUITE and then looking in this directory:

    .\controlSUITE\development_kits\
  • Hi Devin

    thanks for info.

    Best regards
    Nima Shokouhfar