HI teams:
Regarding the configuration of the timer, I would like to ask a question.
I configured the 1ms timer of TM4C according to the reference routine. The main frequency of my system is 80MHz, and the loading value of the timer is set to 80k. Every 1ms timer expires, a timer interrupt service function is entered.
My first question is: I don’t know how the load value in the library function is calculated.
The second question is that I understand that after the timer sets a load value, if the system is counting down now, then the load value will decrease from The timer interrupt will not be triggered until 0, but the current situation I am testing is that my timer enters the interrupt before the load value reaches 0. I don’t know whether this is related to the configuration of the timer or not. what happened?
By the way, I set a breakpoint in the timer interrupt. I found that every time the timer interrupt is entered, the current count value of the corresponding timer is different. Isn't the interrupt entered when the loading value is reduced to 0?
Note: According to my previous understanding of timers, when I want to configure a timer with a period of 1ms, first I will calculate a load value based on the timer clock and frequency division coefficient. This load value represents the expiration of 1s. , what the count value in the timer should be. Then according to the timer period I want to set and configure (for example, 1ms), I will then perform a conversion to get the configured 1ms timer, and what my loading value should be.
What I said may be a bit verbose. I hope an expert can patiently help me answer it. Thank you very much.
The following is the relevant configuration of my timer: