Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

CC3200 Timer Count Capture Application

From Texas Instruments Wiki
Jump to: navigation, search


      Every GPTM(General purpose timer module) block can be used as two 16-bit timers/counters (referred to as Timer A and Timer B) that can be configured to operate independently as timers or event counters, or concatenated to operate as one 32-bit timer. Timers can also be used to trigger µDMA transfers.

Following operating modes are supported:

  1. 16 or 32-bit programmable one-shot timer
  2. 16 or 32-bit programmable periodic timer
  3. 16-bit general-purpose timer with an 8-bit prescaler

Application details

      This application showcases Timer's count capture feature to measure frequency of an external signal.

Source Files briefly explained

  • main.c - Display banner and measured frequency
  • pinmux.c - Generated by Pinmux utility to mux out the CCP signal to chip boundary.
  • uart_if.c - Generic APIs to initialize and configure UART.
  • startup_ewarm.c - Implements interrupt vector table when using IAR ewarm tool chain
  • startup_ccs.c - Implements interrupt vector table when using CC tool chain


  • Setup a serial communication application (HyperTerminal/TeraTerm) with following settings. For detail info visit Terminal setup

   - Port: Enumerated COM port
   - Baud rate: 115200
   - Data: 8 bit
   - Parity: None
   - Stop: 1 bit
   - Flow control: None

  • Run the reference application (Flashing the bin/IAR/CCS).
  • Feed an external signal on LP Header at P1.3 (PIN_4)
  • Observe the frequency getting printed on the terminal

      Terminal snapshot when application runs on device:


Limitations/Known Issues

The example uses the timer in 16 bit mode. With the clock at 80 MHz and a 16 bit timer, the minimum theoretical frequency that can be captured is 1200 Hz, however, as coded in SDK v1.3, the minimum possible frequency that can be captured is 1400 Hz.

The example can be modified to support the full frequency capture range by replacing
g_ulFreq = (TIMER_FREQ/(g_ulSamples[0] - g_ulSamples[1]));

on line 104 in main.c with:
g_ulFreq = ( (g_ulSamples[0] > g_ulSamples[1]) ? (TIMER_FREQ/(g_ulSamples[0] - g_ulSamples[1])) : (TIMER_FREQ/(65535 - (g_ulSamples[1] - g_ulSamples[0]))) ); // Fix

With this fix, the minimum frequency that can be captured is now 1230 Hz. Moreover, 0 Hz is no longer erroneously displayed when the first sampled value is larger than the second sampled value.

To increase the overall frequency capture range, the example may be modified to operate the timer in 32 bit mode instead of 16 bit mode.