Problems with theta calculation in PMSM Vector Control function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problems with theta calculation in PMSM Vector Control function

跳至解决方案
2,143 次查看
peterdufault
Contributor III

I'm still working with something based on AN3206.  I'm trying to figure out what's wrong with my commutation, and I started reading back the theta from the eTPU.  It doesn't make any sense to me.

I have a 4000 count encoder and a motor with two pole pairs.  According to the function description theta = (2 * encoder)/4000, so theta should advance twice for each cycle.  However, it isn't even synchronized with the zero position of the encoder.  See the attached plot.

In etpu_pmsmvc.c scale is set to scale = motor_pole_pairs * 0x1000000 / qd_pc_per_rev; .

Since there was not a "get theta" function I added one like this:

fract24_t fs_etpu_pmsmvc_get_theta(uint8_t channel)

{

    uint32_t *pba;

    pba = fs_etpu_data_ram(channel) + (0x4000 >> 2);

    return (fract24_t)(*(pba + ((FS_ETPU_PMSMVC_THETA_OFFSET) >> 2)));

}

Any ideas?

0 项奖励
回复
1 解答
1,895 次查看
peterdufault
Contributor III

Never mind.  I had used the PMWmaster channel instead of the PMSMVC_channel and happened to get back that thing that went from -1 to 1.  Now that I've fixed it I get what I expect.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,895 次查看
peterdufault
Contributor III

Well, whatever I'm getting back with that fs_etpu_pmsmvc_get_theta() function it isn't theta.  Even if I stop the motor rotation I get the same -1 to 1 ramp.  I've asked Freescale for the eTPU code that is being generated by the eTPU function selector so I can figure out what's going on.

0 项奖励
回复
1,896 次查看
peterdufault
Contributor III

Never mind.  I had used the PMWmaster channel instead of the PMSMVC_channel and happened to get back that thing that went from -1 to 1.  Now that I've fixed it I get what I expect.

0 项奖励
回复