@jeremyzhou Thank you again for your feedback. I have created my application using the Rowley CrossStudio IDE. I believe the behavior should be easy to reproduce. While looking over my application again this morning, I realized that I am making an assumption when using the SCTIMER_SetupCounterHaltAction() and SCTIMER_SetCallback() APIs together.
Is it guaranteed that the SCTimer will halt the counter before calling the callback function? I am clearing the HALT bit in the callback function and that is only safe to do if the callback is guaranteed to be called after the counter has been halted.
To reproduce this, I have created a callback function that is called when an input transitions on a rising edge. I connect a function generator to this input and use the SCTimer to measure the period between consecutive rising edges. When I use the SCTIMER_SetupCounterHaltAction() API and force my function generator to make a drastic change in the periods (order of magnitude), I will often see the timer halted indefinitely.
Simultaneously, I am using the SCTimer to make sure that we see two rising edges in a certain window. If the match register event ever occurs, we do not report a period. For this reason, I need to modify the contents of the match register inside of my SCTimer callback function. Since that can only be done when the timer is halted, I first tried to use the SCTIMER_SetupCounterHaltAction() API to halt the counter and then restart it before returning from the callback functions.
However, if I remove the SCTIMER_SetupCounterHaltAction() from my application and instead halt and restart the counter in the callback in order to modify the match register, I see no problems.
The UART driver is different, but the contents of the attached file show all of the relevant SCTimer API calls. You will see the calls to halt the counter on the events on lines 215-217 have been commented out since I tried to halt the counter inside of each of the callback functions.