Other Parts Discussed in Thread: MSP-EXP432E401Y, SYSBIOS
I am using the MSP-EXP432E401Y LaunchPad kit which runs at 120MHz, and I am using the TI Drivers to operate either a periodic timer to signal an event, or an ADC to periodically sample at a specified frequency, which automatically uses a periodic timer.
When I directly use a periodic timer to signal an event (no ADC involved) and I look at the GPTM Interval Load Register (GPTMTAILR, a.k.a. TIMER_TAILR in the CCS debugger), I notice that the count is 1 less than I initially expected, until I read this section in the MSP432E4 Technical Reference Manual:
"When the timer is counting down and it reaches the time-out event (0x0), the timer reloads its start value
from the GPTMTnILR and the GPTMTnPR registers on the next cycle"
The timer does indeed count down, and if 0 is part of the count, then the Interval Load Register must be 1 less. For example if I want to signal an event at 8Hz, then the number seen in the Interval Load Register must be:
120MHz / 8Hz - 1 = 14999999 = 0xE4E1BF and this is what I see in the CCS debugger
The confusion arises when I use an ADC to periodically sample at a specified frequency, say 10KHz. If I use the same "1 less" calculation as above, I get:
120MHz / 10KHz - 1 = 11999 = 0x2EDF
However what I see in the Interval Load Register in the CCS debugger is 1 more than this value: 0x2EE0! When I look at the Timer Mode Register this timer is indeed counting down, so why is the number not 0x2EDF? Could this be a bug in the TI Drivers software, or am I missing something here?