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.
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.
In order to use the PWM APIs, the application is required to define 4 configuration items in the application Board.c file:
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:
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 struct PWMTimerCC32XX_HWAttrsV2 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:
typedef struct PWMTimerCC32XX_Object PWMTimerCC32XX_Object |
PWMTimerCC32XX Object.
The application must not access any member variables of this structure!
const PWM_FxnTable PWMTimerCC32XX_fxnTable |