Hello,
While checking the general-purpose Timers section in the TM4C123GH6PM datasheet, I reached the end of 11.3.2.3 Input Edge-Count Mode which shows an example which initializes the timer with 0x000A (GPTMTnILR) and the match value with 0x0006 (GPTMTnMATCHR) in a count-down configuration where both edges are to be detected.
The example shows Figure 11-3. Input Edge-Count Mode Example, Counting Down
When the first rising edge of the signal occurs, the count is shown as 0x000A, but it should be 0x0009
Walking through the input signal edges::
1. rising edge ==> counter decremened to 0x0009 (do we have a match ? no, then continue)
2. falling edge ==> counter decremented to 0x0008 (do we have a match ? no, then continue)
3. rising edge ==> counter decremented to 0x0007 (do we have a match ? no, then continue)
4. falling edge ==> counter decremented to 0x0006 (timer value matches the value in GPTMTnMATCHR, as we're in the down-count mode, the GPTM reloads the timer value with 0x000A (as programmed in GPTMTnILR), then clears TnEN, i.e. stops. Consequently, the below signal edges will be ignored)
5. rising edge ==> ignored
6. falling edge ==> ignored
If this is all correct, then the first value in figure 11-3 should be 0x0009, unless it shows the value before being decremented (before the event occurs).
Please advise,
Best Regards,
Roger