Part Number:TMS570LC4357
假设SWAG使用的10-2齿,下降沿有效,在SWAG同步后,齿轮转到奇点齿周期结束时,即下降沿到来,APCNT的period count异常变成0,同时会进一步造成下一齿轮周期的SCNT和ACNT的data字段未递增,保持为0。按照手册中伪代码描述,只有3种情况会对period count赋值,如图所示,只有下溢时才可能将其置0,然而在此时我们检查了EXC2寄存器中的没有标志置位。
我们使用的代码如下,LR=128,HR=64,HET1在pin1上产生波形,同时在软件检测到奇点齿后再启用SWAG,硬件上将pin1与pin2相连。
A1PWCNT { next=A2,hr_lr=LOW,cond_addr=A2,en_pin_action=ON,pin=1,action=PULSEHI,reg=NONE,data=0,hr_data=16}; A2DJZ { next=B1,cond_addr=A3,reg=NONE,data=0}; A3MOV32 {remote=A1,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=NONE,data=5,hr_data=16}; A4CNT { reg=A,max=7,data=0}; A5ECMP { en_pin_action=OFF,cond_addr=A7,pin=0,reg=A,data=6}; A6MOV32 {next=B1,remote=A2,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=NONE,data=15}; A7MOV32 {next=B1,remote=A2,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=NONE,data=47}; B1PCNT { hr_lr=LOW,type=FALL2FALL,pin=2,control=ON,prv=OFF,data=0}; B2CNT { reg=B,max=30,data=5}; B3BR { brk=OFF,next=B4,cond_addr=L1,event=Z}; B4ECMP { next=A1,en_pin_action=OFF,cond_addr=B5,pin=0,reg=B,data=20}; B5MOV32 { next=A1,remote=B2,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=A,data=5}; L1APCNT { reqnum=4,request=NOREQ,irq=OFF,type=FALL2FALL,prv=OFF,period=0}; L2SCNT { step=8,gapstart=57,data=0}; L3ACNT { next=L4,edge=FALLING,irq=ON,gapend=79,data=8}; L4ECMP { next=A1,en_pin_action=OFF,cond_addr=L5,pin=1,reg=B,data=0x4e}; L5CNT { next=A1,brk=ON,reg=NONE,max=7,data=0};
调试时,在奇点齿周期结束的下降沿到来时,APCNT的period count异常变成0的截图如下,断点设置在APCNT指令处。
我们已查看论坛中的下列两个问题,发现SWAG的这个问题长期存在且并未解决
TMS570LC4357: N2HET SWAG – SCNT not counting correctly, missing teeth – Arm-based microcontrollers forum – Arm-based microcontrollers – TI E2E support forums
TMS570LC4357: How to properly set up the SWAG? – Arm-based microcontrollers forum – Arm-based microcontrollers – TI E2E support forums
Cherry Zhou:
Hi,
感谢您提出的问题,目前该问题我们还是需要请求英文论坛工程师的帮助,链接给您贴在下面:
https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1291504/tms570lc4357-the-period-count-value-of-apcnt-is-set-to-0-abnormally-when-the-smag-odd-dot-teeth-end
,
Cherry Zhou:
Hi,
您可以先参考下下帖:
https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/441057/n2het-software-angle-generator-gap-revolution-detection-erratic-results/1587658?tisearch=e2e-sitesearch&keymatch=SWAG%2525252520AND%2525252520SCNT#1587658
以及您给出的第一个帖子中,用户也提供了一些信息,您可以一并review下。
详细的答复您可以参考英文论坛。
Thanks