Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed the week of November 23.

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.

2812, write to TxCNT requires timer to be stopped?

I had an issue with Event Manager A Timer 2 jitter. I was able to correct but I want to get validation that what I found, and the way I fixed it, is correct.

I have an external interrupt (XINT) at 80Hz. In this interrupt, I write a zero to T2CNT. There is a period interrupt configured for EVA timer 2 to occur at less than the period of the 80Hz input. What I found was that the period interrupt had a jitter of 1.2mS. I thought it was being pushed around by other interrupts in the system. It is running BIOS and several user interrupts that that do not use the BIOS dispatcher so, there is stuff going on there. For my EVA timer 2, I tried using the BIOS dispatcher, our systems dispatcher (custom assy. code for speed), and NO dispatcher. Still had too much jitter. Then I tried adding DINT to the timer 2 period ISR; Still the same issue.

 

I found that the jitter was not due to other interrupts in the system. What fixed it was setting the timer mode to 0 (halt) in the period ISR. This way, when the 80Hz ISR came back around, it would still write zero, BUT then it starts the timer again by writing a 2 to the MODE (count up mode).

 

So, what I came away with, is that you CAN NOT write reliably to the TxCNT register unless you stop it first, either with MODE or ENA. I guess this is a race condition with the hardware update to the register? I did not find this anywhere in the documentation, and therefore, wasted a lot of time.

 

Am I correct in my find?

 

Regards,

JIm