C28x eCAP

Receive and log transitions on capture input pin or configure auxiliary pulse width modulator

  • Library:
  • Embedded Coder Support Package for Texas Instruments C2000 Processors / C2802x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / C2803x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / C2805x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / C2806x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / C280x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / C2833x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / C2834x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F2807x

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F2837xD

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F2837xS

    Embedded Coder Support Package for Texas Instruments C2000 Processors / F28004x

    Embedded Coder Support Package for Texas Instruments C2000 F28M3x Concerto Processors / F28M35x / C28x

    Embedded Coder Support Package for Texas Instruments C2000 F28M3x Concerto Processors / F28M36x / C28x

Description

The eCAP block captures the timing of important external events, such as Hall sensor signals in speed measurements of rotating machinery. When not used in capture mode, the block can be used in APWM mode, which is a single-channel, asymmetric pulse width modulator (APWM). You can add one eCAP block to your model for each capture pin. You cannot assign the same eCAP pin to two eCAP blocks in a model. eCAP and APWM modes use the same pins. In eCAP mode, the pins are used as input to capture the transitions. In APWM mode, the pins are used to output a PWM waveform.

Ports

Input

expand all

The input from the software used to synchronize the eCAP counter. The synchronization occurs when the synchronization input value is 1.

Dependencies

The port appears only when:

  • On the General tab, you select Operating mode > eCAP or APWM.

  • On the General tab, you select Enable counter Sync-In mode and Enable software-forced counter synchronizing input.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Starts a One-Shot capture sequence.

A 2-bit stop register is used to compare the Mod4 counter output, and when the register and counter values are equal the Mod4 counter is stopped.

Dependencies

The port appears only when:

  • On the General tab, you select Operating mode > eCAP.

  • On the eCAP tab, you set Select mode control > One-Shot and select Enable One-Shot re-arming control input.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Period of the APWM.

Dependencies

The port appears only when:

  • On the General tab, you select Operating mode > APWM.

  • On the APWM tab, you select Waveform period source > Input port.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Width of the APWM.

Dependencies

The port appears only when:

  • On the General tab, you select Operating mode > APWM.

  • On the APWM tab, you select Duty cycle source > Input port.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Output

expand all

The output ports appear only in eCAP mode.

The signal width can take a value of 1, 2, 3, or 4 depending on the capture event selected in Stop value after on the eCAP tab. Use the Enable reset counter after capture event # time-stamp option to reset the counter after an event. This option is useful for finding the time difference between the events.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

The status of the capture event. 0 indicates that no event has occurred. 1 indicates that the event specified by the Stop value after parameter has occurred at the eCAP pin.

Dependencies

The port appears only when you select Enable capture event status flag output on the General tab.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

The status of overflow. 0 indicates that no event has occurred. 1 indicates that the counter has overflowed from the highest value to 0.

Dependencies

The port appears only when you select Enable overflow status flag output on the General tab.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Parameters

expand all

General

When you select eCAP, the block captures and logs pin transitions for each capture unit to a FIFO buffer. When you select APWM, the block generates asymmetric pulse width modulation (APWM) waveforms for driving downstream systems.

Select the required eCAP module to have a dedicated eCAP pin for capturing the external events.

The pin selection for the eCAP module can be done by browsing to Hardware Implementation > Target hardware resources. The selection option is provided only if the module has more than one pin that can be configured for an eCAP module.

This value provides the time base for event captures, clocked by the system clock. A phase register is used to synchronize with other counters via software- or hardware-forced synchronization. For information about software- or hardware-forced synchronization, see the Enable counter Sync-In mode parameter. This value is useful in APWM mode when you need a phase offset between capture modules. Set the phase offset to an integer from 0 to 42949667295 (232) counts.

Synchronization can be done using the SYNCI event or the software. When synchronization occurs, the shadow register CTRPHS is loaded into the active counter TSCTR in the current eCAP module and the eCAP modules downstream.

A software method for synchronizing one or more eCAP time bases. The synchronization occurs when the synchronization input value is 1.

Dependencies

This parameter appears only when Enable counter Sync-In mode is selected.

Synchronizes an eCAP counter with other eCAP counters. The options are:

  • CTR=PRD — Triggers the sync-out signal when the counter value equals the period.

  • Pass through — The sync-in event is passed through as the sync-out signal.

  • Disabled — Disables the sync-out signal.

Sample time for the block in seconds.

eCAP

To enable configuration parameters on the eCAP tab, set Operating mode to eCAP on the General tab.

The input signal is prescaled by twice the value of this parameter. For example, if you enter 1, the input is prescaled by 2, and for 31, the input is prescaled by 62. Entering 0 bypasses the input prescaler, leaving the input capture signal unchanged.

The Continuous option performs continuous timestamp captures (events 1 through 4) using a circular buffer.

The One-Shot option enables the Enable One-Shot rearming control via input port option.

When this parameter is selected, a One-Shot capture sequence is re-armed as follows:

  1. Mod4 counter is reset to zero.

  2. Mod4 counter is unfrozen.

  3. Capture register loading is enabled.

Dependencies

This parameter appears only when you select One-Shot for Select mode control.

The number of capture events after which you want to stop the capture sequence.

The eCAP process resets the counter after receiving a capture event timestamp. In this case, # represents the number of the capture event set in the Stop value after parameter.

The option that starts a capture event. In this case, # represents the number of the capture event set in the Stop value after parameter.

The data type of the timestamp counter.

Outputs the capture event status flag at the output port CF. The block outputs 0 until the event is captured. After the event, the flag value is 1.

The data type of the output port CF.

Dependencies

This parameter appears only when you select Enable capture event status flag output.

Outputs the status of the elements of the FIFO buffer at the output port OF.

The data type of the output port OF.

Dependencies

This parameter appears only when you select Enable overflow status flag output.

APWM

To enable configuration parameters on the APWM tab, set Operating mode to APWM in the General tab.

Clock cycles uses the high-speed peripheral clock cycles of the processor.

Select Specify via dialog to enter the value in Waveform period, or select Input port to use a value from the T input port.

Period of the PWM waveform measured in clock cycles or seconds, as specified in Waveform period units.

Note

The term clock cycles refers to the high-speed peripheral clock on the F2812 chip. This high-speed peripheral clock is 75 MHz by default because the high-speed peripheral clock prescaler is set to 2 (150 MHz/2).

Dependencies

This parameter appears only when Waveform period source is set to Specify via dialog.

The units used for measuring the duty cycle.

Select Specify via dialog to enter the value in Duty cycle, or select Input port to use a value from the W input port.

The ratio of PWM waveform pulse duration to PWM waveform period. This ratio is expressed in Duty cycle units.

When you select Active High, the compare value (duty cycle) defines the high time. Selecting Active Low directs the compare value to define the low time.

Interrupt

You can use the C28x Hardware Interrupt block to respond to this interrupt. In this case, # represents the number of the capture event set in the Stop value after parameter.

Dependencies

This parameter appears only when you set Operating mode to eCAP in the General tab.

Triggers an interrupt when the counter overflows.

Dependencies

This parameter appears only when you set Operating mode to eCAP in the General tab.

Posts interrupt when the value of counter is same as the value of the period register (CTR = PRD).

Dependencies

This parameter appears only when you set Operating mode to APWM in the General tab.

Posts interrupt when the value of the counter is same as the value of the compare register (CTR = CMP).

Dependencies

This parameter appears only when you set Operating mode to APWM in the General tab.