EasyManua.ls Logo

Texas Instruments CC3235 SimpleLink Series - Page 315

Texas Instruments CC3235 SimpleLink Series
799 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
www.ti.com
Initialization and Configuration
315
SWRU543–January 2019
Submit Documentation Feedback
Copyright © 2019, Texas Instruments Incorporated
General-Purpose Timers
In the 32-bit modes, the GPTM translates a 32-bit write access to GPTMTAILR into a write access to both
GPTMTAILR and GPTMTBILR. The resulting word ordering for such a write operation follows:
GPTMTBILR[15:0]:GPTMTAILR[15:0]
Likewise, a 32-bit read access to GPTMTAR returns the value:
GPTMTBR[15:0]:GPTMTAR[15:0]
A 32-bit read access to GPTMTAV returns the value:
GPTMTBV[15:0]:GPTMTAV[15:0]
9.4 Initialization and Configuration
To use a GPTM, the appropriate CLKEN bit must be set in the GPTnCLKCFG or GPTnCLKEN register.
Configure the CONFMODE fields in the GPIO_PAD_CONFIG register to assign the CCP signals to the
appropriate pins. The user should set GPTTRIGSEL bits appropriately before using CCP mode.
The user can also reset GPTM blocks using register GPTnSWRST.
This section shows module initialization and configuration examples for each supported timer mode.
9.4.1 One-Shot and Periodic Timer Mode
Configure the GPTM for one-shot and periodic modes with the following sequence:
1. Ensure the timer is disabled (the TnEN bit in the GPTMCTL register is cleared) before making any
changes.
2. Write the GPTM Configuration (GPTMCFG) register with a value of 0x0000.0000.
3. Configure the TnMR field in the GPTM Timer n Mode (GPTMTnMR) register:
a. Write a value of 0x1 for one-shot mode.
b. Write a value of 0x2 for periodic mode.
4. Optionally configure the TnSNAPS, TnWOT, TnMTE, and TnCDIR bits in the GPTMTnMR register to
select whether to capture the value of the free-running timer at time-out, use an external trigger to start
counting, configure an additional trigger or interrupt, and count up or down.
5. Load the start value into the GPTM Timer n Interval Load (GPTMTnILR) register.
6. If interrupts are required, set the appropriate bits in the GPTM Interrupt Mask (GPTMIMR) register.
7. Set the TnEN bit in the GPTMCTL register to enable the timer and start counting.
8. Poll the GPTMRIS register or wait for the interrupt to be generated (if enabled). In both cases, the
status flags are cleared by writing 1 to the appropriate bit of the GPTM Interrupt Clear (GPTMICR)
register.
If the TnMIE bit in the GPTMTnMR register is set, the RTCRIS bit in the GPTMRIS register is set, and the
timer continues counting. In one-shot mode, the timer stops counting after the time-out event. To re-
enable the timer, repeat the sequence. A timer configured in periodic mode reloads the timer and
continues counting after the time-out event.
9.4.2 Input Edge-Count Mode
Configure the timer to input edge-count mode with the following sequence:
1. Ensure the timer is disabled (the TnEN bit is cleared) before making any changes.
2. Write the GPTM Configuration (GPTMCFG) register with a value of 0x0000.0004.
3. In the GPTM Timer Mode (GPTMTnMR) register, write the TnCMR field to 0x0 and the TnMR field to
0x3.
4. Configure the type of events that the timer captures by writing the TnEVENT field of the GPTM Control
(GPTMCTL) register.
5. Program registers according to count direction:
• In down-count mode, the GPTMTnMATCHR and GPTMTnPMR registers are configured so the
difference between the value in the GPTMTnILR and GPTMTnPR registers and the
GPTMTnMATCHR and GPTMTnPMR registers equals the number of edge events to be counted.

Table of Contents