Hi all,
I'm trying to use the N2HET SWAG on the TMS570LS1224 (N2HET at 80 MHz) to interface a toothed wheel (1 missing and 7 actual teeth), simulated as a 50% duty cycle 4 KHz signal generated through the RTI.
If I set gapstart and gapend both at 0, the individual teeth-cycles are detected correctly (the missing tooth is seen as an extension of the 7th tooth). However, with a stepsize of 8, the correct gapstart and gapend should be 8 * (7 - 1) + 1 = 49 and 8 * 8 - 1 = 63, according to SPNU515b.
In my understanding, the following code should produce a switch on N2HET pin 20 every revolution (8 teeth):
; Angle Counter L00 APCNT { next=L01,irq=OFF,type=RISE2RISE,prv=ON,period=0,data=0}; L01 SCNT { next=L02,step=8,gapstart=49,data=0}; L02 ACNT { next=OUT20,edge=RISING,gapend=63,data=0}; ; Change OUT20 OUT20 ACMP { next=L00,en_pin_action=ON,cond_addr=OUT20_PULSE_LOW,pin=20,action=SET,reg=B,data=0}; ; Switch OUT20 OUT20_PULSE_LOW MOV64 { next=L00,remote=OUT20,en_pin_action=ON,cond_addr=OUT20_PULSE_HIGH,pin=20,comp_mode=ECMP,action=CLEAR,reg=B,data=0}; OUT20_PULSE_HIGH MOV64 { next=L00,remote=OUT20,en_pin_action=ON,cond_addr=OUT20_PULSE_LOW,pin=20,comp_mode=ECMP,action=SET,reg=B,data=0};
However, the switches on pin 20 take 11 or 12 teeth instead of 8. The last 3 days I've tried several gapstart and -end settings, several numer of teeth per revolution, with or without missing teeth, but the revolution/gap detection seems to produce inconsistent results. I found https://e2e.ti.com/support/microcontrollers/hercules/f/312/p/411737/1497955, but it quickly goes into the HWAG, while I would like to stay with the SWAG. I ordered a new USB stick and when that arrives, I will add scope traces.
Does anyone know how to get the gap/revolution detection working correctly?
Edit: added scope traces for gapstart == 49 and gapend == 63