Data Structures | 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).

When stopped, the driver will configure the pin in GPIO mode & set the output to the PWM_IdleLevel specified in the params used during open. Users need be aware that while PIN 19 can be used for PWM it is not GPIO capable, so it cannot be set to the PWM_IdleLevel. Output voltage will be PWM output at the moment it is stopped.

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 ti_drivers_config.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. The following statements are valid:

#include <stdbool.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/PWM.h>
Include dependency graph for PWMTimerCC32XX.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
 

Variables

const PWM_FxnTable PWMTimerCC32XX_fxnTable
 

Variable Documentation

§ PWMTimerCC32XX_fxnTable

const PWM_FxnTable PWMTimerCC32XX_fxnTable
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale