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.

TMS570LC4357: The period count value of APCNT is set to 0 abnormally when the SMAG odd-dot teeth end

Part Number: TMS570LC4357


Hi Team,

Assuming SWAG uses 10-2 teeth, falling edge is valid, at the end of the gear cycle to odd teeth after SWAG is synchronized, that is, the falling edge occurs and the period count of APCNT becomes 0 then the data fields of SCNT and ACNT for the next gear cycle are not incremented and remain at 0.

As described in the pseudo code in the manual, there are only 3 cases where the period count is assigned, as shown in the figure below, but the customer checks the EXC2 register and no flag is set at this time.

The following code is used, LR=128, HR=64, and HET1 generates a waveform on pin1. SWAG is also enabled after the software detects the odd dot teeth, and pin1 is connected to pin2 by hardware. 

A1   PWCNT { next=A2,hr_lr=LOW,cond_addr=A2,en_pin_action=ON,pin=1,action=PULSEHI,reg=NONE,data=0,hr_data=16};
A2   DJZ { next=B1,cond_addr=A3,reg=NONE,data=0};
A3   MOV32 {remote=A1,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=NONE,data=5,hr_data=16};
A4   CNT { reg=A,max=7,data=0};
A5   ECMP { en_pin_action=OFF,cond_addr=A7,pin=0,reg=A,data=6};
A6   MOV32 {next=B1,remote=A2,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=NONE,data=15};
A7   MOV32 {next=B1,remote=A2,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=NONE,data=47};
B1   PCNT { hr_lr=LOW,type=FALL2FALL,pin=2,control=ON,prv=OFF,data=0};
B2   CNT { reg=B,max=30,data=5};
B3   BR { brk=OFF,next=B4,cond_addr=L1,event=Z};
B4   ECMP { next=A1,en_pin_action=OFF,cond_addr=B5,pin=0,reg=B,data=20};
B5   MOV32 { next=A1,remote=B2,z_cond=OFF,init=OFF,type=IMTOREG&REM,reg=A,data=5};
L1   APCNT { reqnum=4,request=NOREQ,irq=OFF,type=FALL2FALL,prv=OFF,period=0};
L2   SCNT { step=8,gapstart=57,data=0};
L3   ACNT { next=L4,edge=FALLING,irq=ON,gapend=79,data=8};
L4   ECMP { next=A1,en_pin_action=OFF,cond_addr=L5,pin=1,reg=B,data=0x4e};
L5   CNT { next=A1,brk=ON,reg=NONE,max=7,data=0};

Here is a screenshot of the period count exception of APCNT that changes to 0 at the falling edge of the end of the odd-point-period, with the breakpoint set at the APCNT instruction:

And this issue has been raised before but remains unresolved:

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

Could you help check this case? Thanks.

Best Regards,

Cherry