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

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.


My 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 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

thanks in advance