Data Structures | Macros | Variables
PWMMSP432E4.h File Reference

Detailed Description

PWM driver implementation for MSP432E4 PWM peripherals.

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

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

Refer to PWM.h for a complete description of APIs & example of use.

Operation

This driver implementation uses the Pulse Width Modulator (PWM) peripherals present on MSP432E4 devices to generate PWM signals. Each PWM peripheral instance contains 4 PWM signal generators, each controlling 2 PWM outputs (8 PWM outputs total). This driver manages each PWM output individually (each output has it's own PWM handle/instance). However since a single clock prescalar is available for a peripheral and a generator is responsible for producing 2 outputs, there are some limitations in place to ensure proper operation:

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

After opening, the PWM_setPeriodl() API can be used to change a PWM generator period. However, the clock prescalar is shared by all generators so the new period must be a value that can be generated with the same prescaler. Also keep in mind that changing a period affects both generator outputs, so the period must be larger than both duties. The equation below can be used to determine the prescalar for a given period (the prescalar will be the following power of 2 (2^x)):

#include <stdbool.h>
#include <stdint.h>
#include <ti/devices/msp432e4/inc/msp432.h>
#include <ti/devices/msp432e4/driverlib/gpio.h>
#include <ti/devices/msp432e4/driverlib/pin_map.h>
#include <ti/drivers/gpio/GPIOMSP432E4.h>
#include <ti/drivers/PWM.h>
Include dependency graph for PWMMSP432E4.h:

Go to the source code of this file.

Data Structures

struct  PWMMSP432E4_HWAttrs
 PWMMSP432E4 Hardware attributes. More...
 
struct  PWMMSP432E4_Status
 PWMMSP432E4_Status. More...
 
struct  PWMMSP432E4_Object
 PWMMSP432E4 Object. More...
 

Macros

#define PWMMSP432E4_NUM_PWM_PERIPHERALS   (1)
 
#define PWMMSP432E4_NUM_PWM_GENERATORS   (4)
 
#define PWMMSP432E4_NUM_PWM_OUTPUTS   (8)
 
#define PWMMSP432E4_PF0_M0PWM0   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 0, GPIO_PF0_M0PWM0)
 PF0 is used for M0PWM0. More...
 
#define PWMMSP432E4_PR0_M0PWM0   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 0, GPIO_PR0_M0PWM0)
 PR0 is used for M0PWM0. More...
 
#define PWMMSP432E4_PF1_M0PWM1   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 1, GPIO_PF1_M0PWM1)
 PF1 is used for M0PWM1. More...
 
#define PWMMSP432E4_PR1_M0PWM1   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 1, GPIO_PR1_M0PWM1)
 PR1 is used for M0PWM1. More...
 
#define PWMMSP432E4_PF2_M0PWM2   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 2, GPIO_PF2_M0PWM2)
 PF2 is used for M0PWM2. More...
 
#define PWMMSP432E4_PR2_M0PWM2   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 2, GPIO_PR2_M0PWM2)
 PR2 is used for M0PWM2. More...
 
#define PWMMSP432E4_PF3_M0PWM3   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 3, GPIO_PF3_M0PWM3)
 PF3 is used for M0PWM3. More...
 
#define PWMMSP432E4_PR3_M0PWM3   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 3, GPIO_PR3_M0PWM3)
 PR3 is used for M0PWM3. More...
 
#define PWMMSP432E4_PG0_M0PWM4   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 0, GPIO_PG0_M0PWM4)
 PG0 is used for M0PWM4. More...
 
#define PWMMSP432E4_PR4_M0PWM4   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 4, GPIO_PR4_M0PWM4)
 PR4 is used for M0PWM4. More...
 
#define PWMMSP432E4_PG1_M0PWM5   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 1, GPIO_PG1_M0PWM5)
 PG1 is used for M0PWM5. More...
 
#define PWMMSP432E4_PR5_M0PWM5   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 5, GPIO_PR5_M0PWM5)
 PR5 is used for M0PWM5. More...
 
#define PWMMSP432E4_PK4_M0PWM6   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTK, 4, GPIO_PK4_M0PWM6)
 PK4 is used for M0PWM6. More...
 
#define PWMMSP432E4_PR6_M0PWM6   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 6, GPIO_PR6_M0PWM6)
 PR6 is used for M0PWM6. More...
 
#define PWMMSP432E4_PK5_M0PWM7   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTK, 5, GPIO_PK5_M0PWM7)
 PK5 is used for M0PWM7. More...
 
#define PWMMSP432E4_PR7_M0PWM7   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 7, GPIO_PR7_M0PWM7)
 PR7 is used for M0PWM7. More...
 

Variables

const PWM_FxnTable PWMMSP432E4_fxnTable
 

Macro Definition Documentation

§ PWMMSP432E4_NUM_PWM_PERIPHERALS

#define PWMMSP432E4_NUM_PWM_PERIPHERALS   (1)

§ PWMMSP432E4_NUM_PWM_GENERATORS

#define PWMMSP432E4_NUM_PWM_GENERATORS   (4)

§ PWMMSP432E4_NUM_PWM_OUTPUTS

#define PWMMSP432E4_NUM_PWM_OUTPUTS   (8)

§ PWMMSP432E4_PF0_M0PWM0

#define PWMMSP432E4_PF0_M0PWM0   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 0, GPIO_PF0_M0PWM0)

PF0 is used for M0PWM0.

§ PWMMSP432E4_PR0_M0PWM0

#define PWMMSP432E4_PR0_M0PWM0   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 0, GPIO_PR0_M0PWM0)

PR0 is used for M0PWM0.

§ PWMMSP432E4_PF1_M0PWM1

#define PWMMSP432E4_PF1_M0PWM1   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 1, GPIO_PF1_M0PWM1)

PF1 is used for M0PWM1.

§ PWMMSP432E4_PR1_M0PWM1

#define PWMMSP432E4_PR1_M0PWM1   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 1, GPIO_PR1_M0PWM1)

PR1 is used for M0PWM1.

§ PWMMSP432E4_PF2_M0PWM2

#define PWMMSP432E4_PF2_M0PWM2   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 2, GPIO_PF2_M0PWM2)

PF2 is used for M0PWM2.

§ PWMMSP432E4_PR2_M0PWM2

#define PWMMSP432E4_PR2_M0PWM2   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 2, GPIO_PR2_M0PWM2)

PR2 is used for M0PWM2.

§ PWMMSP432E4_PF3_M0PWM3

#define PWMMSP432E4_PF3_M0PWM3   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 3, GPIO_PF3_M0PWM3)

PF3 is used for M0PWM3.

§ PWMMSP432E4_PR3_M0PWM3

#define PWMMSP432E4_PR3_M0PWM3   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 3, GPIO_PR3_M0PWM3)

PR3 is used for M0PWM3.

§ PWMMSP432E4_PG0_M0PWM4

#define PWMMSP432E4_PG0_M0PWM4   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 0, GPIO_PG0_M0PWM4)

PG0 is used for M0PWM4.

§ PWMMSP432E4_PR4_M0PWM4

#define PWMMSP432E4_PR4_M0PWM4   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 4, GPIO_PR4_M0PWM4)

PR4 is used for M0PWM4.

§ PWMMSP432E4_PG1_M0PWM5

#define PWMMSP432E4_PG1_M0PWM5   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 1, GPIO_PG1_M0PWM5)

PG1 is used for M0PWM5.

§ PWMMSP432E4_PR5_M0PWM5

#define PWMMSP432E4_PR5_M0PWM5   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 5, GPIO_PR5_M0PWM5)

PR5 is used for M0PWM5.

§ PWMMSP432E4_PK4_M0PWM6

#define PWMMSP432E4_PK4_M0PWM6   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTK, 4, GPIO_PK4_M0PWM6)

PK4 is used for M0PWM6.

§ PWMMSP432E4_PR6_M0PWM6

#define PWMMSP432E4_PR6_M0PWM6   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 6, GPIO_PR6_M0PWM6)

PR6 is used for M0PWM6.

§ PWMMSP432E4_PK5_M0PWM7

#define PWMMSP432E4_PK5_M0PWM7   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTK, 5, GPIO_PK5_M0PWM7)

PK5 is used for M0PWM7.

§ PWMMSP432E4_PR7_M0PWM7

#define PWMMSP432E4_PR7_M0PWM7   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTR, 7, GPIO_PR7_M0PWM7)

PR7 is used for M0PWM7.

Variable Documentation

§ PWMMSP432E4_fxnTable

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