TI-RTOS Drivers  tidrivers_full_2_20_00_08
Data Structures | Macros | Typedefs | Variables
PWMTimerMSP432.h File Reference

Detailed Description

PWM driver implementation using Timer_A peripherals.

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

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

Operation

This driver configures an MSP432 Timer_A peripheral for PWM. If the timer is already in use (by the kernel for instance), PWM instances will not be opened.

When used for PWM generation, each Timer_A can produce up to 6 PWM outputs and this driver manages each output as an independent PWM instance. However since a single period and prescalar are used for all Timer outputs, there are limitations in place to ensure proper operation:

The timer is automatically configured in count-up mode using the clock source specified in the hwAttrs structure. In PWM mode, the timer capture/compare register 0 is used as the period register and cannot be used to generate a PWM output.

The period and duty registers are 16 bits wide, thus a prescalar is used to divide the input clock and allow for larger periods. The maximum period supported is calculated as:

After opening, the PWM_setPeriod() API can be used to change the PWM period. Keep in mind the period is shared by all other PWMs on the timer, so all other PWM outputs on the timer will change. Additionally, a call to PWM_setPeriod() will fail if the new period requires a prescalar different than the one set when initially configured.


#include <stdbool.h>
#include <ti/drivers/PWM.h>
Include dependency graph for PWMTimerMSP432.h:

Go to the source code of this file.

Data Structures

struct  PWMTimerMSP432_HWAttrsV1
 PWMTimerMSP432 Hardware attributes. More...
 
struct  PWMTimerMSP432_Status
 PWMTimerMSP432_Status. More...
 
struct  PWMTimerMSP432_Object
 PWMTimerMSP432 Object. More...
 

Macros

#define PWMTimerMSP432_NUM_TIMERS   (4)
 
#define PWMTimerMSP432_NUM_PWM_OUTPUTS   (6)
 

Typedefs

typedef struct PWMTimerMSP432_HWAttrsV1 PWMTimerMSP432_HWAttrsV1
 PWMTimerMSP432 Hardware attributes. More...
 
typedef struct PWMTimerMSP432_Status PWMTimerMSP432_Status
 PWMTimerMSP432_Status. More...
 
typedef struct PWMTimerMSP432_Object PWMTimerMSP432_Object
 PWMTimerMSP432 Object. More...
 

Variables

const PWM_FxnTable PWMTimerMSP432_fxnTable
 

Macro Definition Documentation

#define PWMTimerMSP432_NUM_TIMERS   (4)
#define PWMTimerMSP432_NUM_PWM_OUTPUTS   (6)

Typedef Documentation

PWMTimerMSP432 Hardware attributes.

These fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For msp432_driverlib these definitions are found in:

  • msp432p401r.h
  • gpio.h
  • timer_a.h

A sample structure is shown below:

1 const PWMTimerMSP432_HWAttrs PWMTimerMSP432HWAttrs[] = {
2  {
3  .timerBaseAddr = TIMER_A1_BASE,
4  .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
5  .compareRegister = TIMER_A_CAPTURECOMPARE_REGISTER_1,
6  .gpioPort = GPIO_PORT_P2,
7  .gpioPinIndex = GPIO_PIN1,
8  .pwmMode = GPIO_PRIMARY_MODULE_FUNCTION
9  },
10 };

PWMTimerMSP432_Status.

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

PWMTimerMSP432 Object.

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

Variable Documentation

const PWM_FxnTable PWMTimerMSP432_fxnTable
Copyright 2016, Texas Instruments Incorporated