Data Structures | Typedefs | Variables
PWMTimerCC32XX.h File Reference

Detailed Description

PWM driver implementation using CC32XX General Purpose Timers.

============================================================================

The PWM header file should be included in an application as follows:

Refer to PWM.h for a complete description of the PWM driver APIs provided and examples of their use.

Overview

This driver configures a CC32XX General Purpose Timer (GPT) in PWM mode. When in PWM mode, each GPT is divided into 2 PWM outputs. This driver manages each output as an independent PWM instance. The timer is automatically configured in count-down mode using the system clock as the source.

The timers operate at the system clock frequency (80 MHz). So each timer tick is 12.5 ns. The period and duty registers are 16 bits wide; thus 8-bit prescalars are used to extend period and duty registers. The maximum value supported is 16777215 timer counts ((2^24) - 1) or 209715 microseconds. Updates to a PWM's period or duty will occur instantaneously (GPT peripherals do not have shadow registers).

Finally, when this driver is opened, it automatically changes the PWM pin's parking configuration (used when entering low power modes) to correspond with the PWM_IDLE_LEVEL set in the PWM_params. However, this setting is not reverted once the driver is closed, it is the users responsibility to change the parking configuration if necessary.

CC32xx PWM Driver Configuration

In order to use the PWM APIs, the application is required to define 4 configuration items in the application Board.c file:

  1. An array of PWMTimerCC32XX_Object elements, which will be used by by the driver to maintain instance state. Below is an example PWMTimerCC32XX_Object array appropriate for the CC3220SF Launchpad board:
    #include <ti/drivers/PWM.h>
    PWMTimerCC32XX_Object pwmTimerCC3220SObjects[CC3220SF_LAUNCHXL_PWMCOUNT];
  2. An array of PWMTimerCC32XX_HWAttrsV2 elements that defines which pin will be used by the corresponding PWM instance (see PWMTimerCC32XX_HWAttrs 'pwmPin' field options). Below is an example PWMTimerCC32XX_HWAttrsV2 array appropriate for the CC3220SF Launchpad board:
    const PWMTimerCC32XX_HWAttrsV2 pwmTimerCC3220SHWAttrs[CC3220SF_LAUNCHXL_PWMCOUNT] = {
    {
    },
    {
    }
    };
  3. An array of PWM_Config elements, one for each PWM instance. Each element of this array identifies the device-specific API function table, the device specific PWM object instance, and the device specific Hardware Attributes to be used for each PWM channel. Below is an example PWM_Config array appropriate for the CC3220SF Launchpad board:
    const PWM_Config PWM_config[CC3220SF_LAUNCHXL_PWMCOUNT] = {
    {
    .object = &pwmTimerCC3220SObjects[CC3220SF_LAUNCHXL_PWM6],
    .hwAttrs = &pwmTimerCC3220SHWAttrs[CC3220SF_LAUNCHXL_PWM6]
    },
    {
    .fxnTablePtr = &PWMTimerCC32XX_fxnTable,
    .object = &pwmTimerCC3220SObjects[CC3220SF_LAUNCHXL_PWM7],
    .hwAttrs = &pwmTimerCC3220SHWAttrs[CC3220SF_LAUNCHXL_PWM7]
    }
    };
  4. A global variable, PWM_count, that informs the driver how many PWM instances are defined:
    const uint_least8_t PWM_count = CC3220SF_LAUNCHXL_PWMCOUNT;

Power Management

The TI-RTOS power management framework will try to put the device into the most power efficient mode whenever possible. Please see the technical reference manual for further details on each power mode.

The PWMTimerCC32XX driver explicitly sets a power constraint when the PWM is running to prevent LPDS and SHUTDOWN Power modes. The following statements are valid:

#include <stdbool.h>
#include <ti/drivers/PWM.h>

Go to the source code of this file.

Data Structures

struct  PWMTimerCC32XX_HWAttrsV2
 PWMTimerCC32XX Hardware attributes. More...
 
struct  PWMTimerCC32XX_Object
 PWMTimerCC32XX Object. More...
 

Macros

PIN 01, GPIO10, uses Timer3A for PWM.
#define PWMTimerCC32XX_PIN_01
 
PIN 02, GPIO11, uses Timer3B for PWM.
#define PWMTimerCC32XX_PIN_02
 
PIN 17, GPIO24, uses Timer0A for PWM.
#define PWMTimerCC32XX_PIN_17
 
PIN 19, uses Timer1B for PWM.
#define PWMTimerCC32XX_PIN_19
 
PIN 21, GPIO25, uses Timer1A for PWM.
#define PWMTimerCC32XX_PIN_21
 
PIN 64, GPIO9, uses Timer2B for PWM.
#define PWMTimerCC32XX_PIN_64
 

Typedefs

typedef struct PWMTimerCC32XX_HWAttrsV2 PWMTimerCC32XX_HWAttrsV2
 PWMTimerCC32XX Hardware attributes. More...
 
typedef struct PWMTimerCC32XX_Object PWMTimerCC32XX_Object
 PWMTimerCC32XX Object. More...
 

Variables

const PWM_FxnTable PWMTimerCC32XX_fxnTable
 

Typedef Documentation

§ PWMTimerCC32XX_HWAttrsV2

PWMTimerCC32XX Hardware attributes.

The 'pwmPin' field identifies which physical pin to use for a particular PWM channel as well as the corresponding Timer resource used to source the PWM signal. The encoded pin identifier macros for initializing the 'pwmPin' field must be selected from the PWMTimerCC32XX_HWAttrs 'pwmPin' field options macros.

A sample structure is shown below:

const PWMTimerCC32XX_HWAttrsV2 pwmTimerCC32XXHWAttrs[] = {
{
},
{
}
};

§ PWMTimerCC32XX_Object

PWMTimerCC32XX Object.

The application must not access any member variables of this structure!

Variable Documentation

§ PWMTimerCC32XX_fxnTable

const PWM_FxnTable PWMTimerCC32XX_fxnTable
Copyright 2017, Texas Instruments Incorporated