SMT is a 24-bit counter with advanced clock and gating logic, which can be configured for measuring a variety of digital signal parameters, such as pulse width, frequency and duty cycle, and the time difference between edges on two signals. A key feature that differentiates SMT from UTMR is the presence of two input signals (SMT signal and window) and two capture registers (SMTxCPW and SMTxCPR). UTMR has only one input signal (ERS) and one capture register. Thus, the UTMR might need to be reconfigured multiple times to measure different attributes in the same application. The following table shows UTMR settings in different SMT modes:
SMT MODE[3:0] |
SMT Mode | UTMR Settings | Comments | |||
---|---|---|---|---|---|---|
START | RESET | STOP | Other | |||
0000 |
Timer | None (ON = 1 ) |
At PR Match | None | — | — |
0001 |
Gated Timer | Rising ERS Edge | At PR Match | Either ERS Edge | — | Use SMT signal as ERS input. |
0010 |
Period and Duty Cycle Measurement | Rising ERS Edge | At Start + PR Match |
None (measures pulse-width)
Rising ERS Edge (measures period) |
— | Use SMT signal as ERS input. TUxyCR capture register will capture either pulse-width or period based on the Stop condition, but not both simultaneously. |
0011 |
High and low time Measurement | Either ERS Edge | At Start + PR Match | Either ERS Edge | — | Use SMT signal as ERS input. TUxyCR capture register will capture high time, then low time, then high time, and so on. TUxyCR must be read before it is overwritten with new data. |
Rising ERS Edge | At Start + PR Match | Either ERS Edge |
EPOL = True level for high time
EPOL = Inverted level for low time |
Use SMT signal as ERS input. TUxyCR capture register will capture either high time or low time based on EPOL bit setting. | ||
0100 |
Windowed Measurement | Rising ERS Edge | At Start + PR Match | Rising ERS Edge | — | Use SMT window as ERS input.TUxyCR capture register will capture period of the window signal. |
0101 |
Gated Windowed Measurement | Rising ERS Edge | At PR Match | Either ERS Edge | — | Use SMT signal as ERS input. Use software to poll SMT window signal and reset counter manually using CLR command at every rising edge. Alternatively, interrupt-on-change can be used to monitor SMT window signal in software. |
0110 |
Time of Flight Measurement | Rising ERS Edge | At Start + PR Match | Either ERS Edge | — | Use CLC to send an XOR of SMT window and SMT signal via ERS. TUxyCR capture register captures the time of flight measurement. |
0111 |
Capture | None | At PR Match | Either ERS Edge | — | Use SMT signal as ERS input. TUxyCR capture register will first capture rising edge of ERS, then the falling edge of ERS, then the rising edge, and so on. TUxyCR must be read before it is overwritten with new data. PRAIF and PWAIF are both captured via CIF. |
1000 |
Counter | None (ON = 1 ) |
At PR Match | None |
CSYNC = Async for using external clock source
EPOL = Inverted for capturing at rising edge of ERS |
Use SMT signal as UTMR clock input. Use SMT window as ERS input. TUxyCR capture register will capture counter value at falling edge of ERS (or rising edge when EPOL = Inverted). |
1001 |
Gated Counter | Rising ERS Edge | At PR Match | Either ERS Edge | CSYNC = Async for using external clock source | Use SMT signal as UTMR clock input. Use SMT window as ERS input. TUxyCR capture register will capture counter value at falling edge of ERS. PWAIF is equivalent to CIF. |
1010 |
Windowed Counter | Rising ERS Edge | At Start + PR Match |
None (measures pulse-width)
Rising ERS Edge (measures period) |
CSYNC = Async for using external clock source | Use SMT signal as UTMR clock input. Use SMT window as ERS input. TUxyCR capture register will capture either pulse-width or period based on the Stop condition, but not both simultaneously. |