Data Structures | Variables
CaptureMSP432.h File Reference

Detailed Description

Capture driver interface for MSP432 devices.


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

Operation

This driver leverages the Timer_A peripheral of the MSP432 device. Each instance of a capture driver will occupy exactly one Timer_A peripheral on the device. This is done to reduce contingencies and conflicts that may arise from using more than one capture/compare registers on a Timer_A peripheral.

The specific capture/compare register and pin used by the capture module is determined by the capturePort definition. If a mappable pin is contained in the capturePort parameter of the CaptureMSP432_HWAttrs structure, the driver will automatically configure the Port Mapping Controller (PMAP) module with the correct/corresponding pin assignments.

Accuracy

Each Timer_A peripheral has 16-bits of resolution. An appropriate clockSource and clockDivider must be specified in the CaptureMSP432_HWAttrs for each specific capture application. A higher clock rate may provide a better capture resolution at the cost of a smaller capturable period. The maximum capture period for a given clockSource and clockDivider is calculated as:

MAX_CAPTURE_PERIOD = 2 * ((clockDivider * MATCH_VALUE) / CYCLES_PER_US) - 1

Given that: MATCH_VALUE = 0xFFFF (65535) CYCLES_PER_US = clockSource / 1000000

MPS432 Capture Driver Configuration

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

  1. An array of CaptureMSP432_Object elements, which will be used by by the driver to maintain instance state. Below is an example CaptureMSP432_Object array appropriate for the MSP432 LaunchPad board:
  2. An array of CaptureMSP432_HWAttrs elements that defines which pin will be used by the corresponding capture instance (see CaptureMSP432_HWAttrs 'capturePort'). Below is an example CaptureMSP432_HWAttrs array appropriate for the MSP432 LaunchPad board:
    const CaptureMSP432_HWAttrs captureMSP432HWAttrs[2] = {
    {
    .timerBaseAddress = TIMER_A1_BASE,
    .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
    .clockDivider = TIMER_A_CLOCKSOURCE_DIVIDER_64,
    .capturePort = CaptureMSP432_P2_3_TA1,
    .intPriority = ~0
    },
    {
    .timerBaseAddress = TIMER_A2_BASE,
    .clockSource = TIMER_A_CLOCKSOURCE_ACLK,
    .clockDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1,
    .capturePort = CaptureMSP432_P6_6_TA2,
    .intPriority = ~0
    },
    };
  3. An array of Capture_Config elements, one for each Capture instance. Each element of this array identifies the device-specific API function table, the device specific capture object instance, and the device specific Hardware Attributes to be used for each capture channel. Below is an example Capture_Config array appropriate for the MSP432 LaunchPad board:
    const Capture_Config Capture_config[2] = {
    {
    .object = &captureMSP432Objects[0],
    .hwAttrs = &captureMSP432HWAttrs[0]
    },
    {
    .object = &captureMSP432Objects[1],
    .hwAttrs = &captureMSP432HWAttrs[1]
    }
    };
  4. A global variable, Capture_count, that informs the driver how many capture instances are defined:
    const uint_least8_t Capture_count = 2;

Resource Allocation

The TimerMSP432_allocateTimerResource API will allocate a timer for exclusive use. Any attempt to re-allocate this resource by the TimerMSP432, PWMMSP432, or CaptureMSP432 drivers will result in a false value being returned from the allocation API. To free a timer resource, the TimerMSP432_freeTimerResource is used. The application is not responsible for calling these allocation APIs directly.

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

Capture Modes

This device implementation only works with the following modes for Capture_Mode :

#include <stdbool.h>
#include <stdint.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/timer/TimerMSP432.h>
#include <ti/drivers/Capture.h>
#include <ti/devices/DeviceFamily.h>
#include <ti/devices/msp432p4xx/driverlib/interrupt.h>
Include dependency graph for CaptureMSP432.h:

Go to the source code of this file.

Data Structures

struct  CaptureMSP432_HWAttrs
 CaptureMSP432 Hardware Attributes. More...
 
struct  CaptureMSP432_Object
 CaptureMSP432 Object. More...
 

Macros

PIN 2.0, TimerA0.
#define CaptureMSP432_P2_0_TA0
 
PIN 2.0, TimerA1.
#define CaptureMSP432_P2_0_TA1
 
PIN 2.1, TimerA0.
#define CaptureMSP432_P2_1_TA0
 
PIN 2.1, TimerA1.
#define CaptureMSP432_P2_1_TA1
 
PIN 2.2, TimerA0.
#define CaptureMSP432_P2_2_TA0
 
PIN 2.2, TimerA1.
#define CaptureMSP432_P2_2_TA1
 
PIN 2.3, TimerA0.
#define CaptureMSP432_P2_3_TA0
 
PIN 2.3, TimerA1.
#define CaptureMSP432_P2_3_TA1
 
PIN 2.4, TimerA0.
#define CaptureMSP432_P2_4_TA0
 
PIN 2.4, TimerA1.
#define CaptureMSP432_P2_4_TA1
 
PIN 2.5, TimerA0.
#define CaptureMSP432_P2_5_TA0
 
PIN 2.5, TimerA1.
#define CaptureMSP432_P2_5_TA1
 
PIN 2.6, TimerA0.
#define CaptureMSP432_P2_6_TA0
 
PIN 2.6, TimerA1.
#define CaptureMSP432_P2_6_TA1
 
PIN 2.7, TimerA0.
#define CaptureMSP432_P2_7_TA0
 
PIN 2.7, TimerA1.
#define CaptureMSP432_P2_7_TA1
 
PIN 3.0, TimerA0.
#define CaptureMSP432_P3_0_TA0
 
PIN 3.0, TimerA1.
#define CaptureMSP432_P3_0_TA1
 
PIN 3.1, TimerA0.
#define CaptureMSP432_P3_1_TA0
 
PIN 3.1, TimerA1.
#define CaptureMSP432_P3_1_TA1
 
PIN 3.2, TimerA0.
#define CaptureMSP432_P3_2_TA0
 
PIN 3.2, TimerA1.
#define CaptureMSP432_P3_2_TA1
 
PIN 3.3, TimerA0.
#define CaptureMSP432_P3_3_TA0
 
PIN 3.3, TimerA1.
#define CaptureMSP432_P3_3_TA1
 
PIN 3.4, TimerA0.
#define CaptureMSP432_P3_4_TA0
 
PIN 3.4, TimerA1.
#define CaptureMSP432_P3_4_TA1
 
PIN 3.5, TimerA0.
#define CaptureMSP432_P3_5_TA0
 
PIN 3.5, TimerA1.
#define CaptureMSP432_P3_5_TA1
 
PIN 3.6, TimerA0.
#define CaptureMSP432_P3_6_TA0
 
PIN 3.6, TimerA1.
#define CaptureMSP432_P3_6_TA1
 
PIN 3.7, TimerA0.
#define CaptureMSP432_P3_7_TA0
 
PIN 3.7, TimerA1.
#define CaptureMSP432_P3_7_TA1
 
PIN 5.6, TimerA2.
#define CaptureMSP432_P5_6_TA2
 
PIN 5.7, TimerA2.
#define CaptureMSP432_P5_7_TA2
 
PIN 6.6, TimerA2.
#define CaptureMSP432_P6_6_TA2
 
PIN 6.7, TimerA2.
#define CaptureMSP432_P6_7_TA2
 
PIN 7.0, TimerA0.
#define CaptureMSP432_P7_0_TA0
 
PIN 7.0, TimerA1.
#define CaptureMSP432_P7_0_TA1
 
PIN 7.1, TimerA0.
#define CaptureMSP432_P7_1_TA0
 
PIN 7.1, TimerA1.
#define CaptureMSP432_P7_1_TA1
 
PIN 7.3,7TimerA0.
#define CaptureMSP432_P7_2_TA0
 
PIN 7.3,7TimerA1.
#define CaptureMSP432_P7_2_TA1
 
PIN 7.3, TimerA0.
#define CaptureMSP432_P7_3_TA0
 
PIN 7.3, TimerA1.
#define CaptureMSP432_P7_3_TA1
 
PIN 7.4, TimerA0.
#define CaptureMSP432_P7_4_TA0
 
PIN 7.4, TimerA1.
#define CaptureMSP432_P7_4_TA1
 
PIN 7.5, TimerA0.
#define CaptureMSP432_P7_5_TA0
 
PIN 7.5, TimerA1.
#define CaptureMSP432_P7_5_TA1
 
PIN 7.6, TimerA0.
#define CaptureMSP432_P7_6_TA0
 
PIN 7.6, TimerA1.
#define CaptureMSP432_P7_6_TA1
 
PIN 7.7, TimerA0.
#define CaptureMSP432_P7_7_TA0
 
PIN 7.7, TimerA1.
#define CaptureMSP432_P7_7_TA1
 
PIN 8.0, TimerA1.
#define CaptureMSP432_P8_0_TA1
 
PIN 8.1, TimerA2.
#define CaptureMSP432_P8_1_TA2
 
PIN 8.3,7TimerA3.
#define CaptureMSP432_P8_2_TA3
 
PIN 9.3,7TimerA3.
#define CaptureMSP432_P9_2_TA3
 
PIN 9.3, TimerA3.
#define CaptureMSP432_P9_3_TA3
 
PIN 10.4, TimerA3.
#define CaptureMSP432_P10_4_TA3
 
PIN 10.5, TimerA3.
#define CaptureMSP432_P10_5_TA3
 

Variables

const Capture_FxnTable CaptureMSP432_captureFxnTable
 

Variable Documentation

§ CaptureMSP432_captureFxnTable

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