CMPSSLITE MCPWM Asynchronous Trip

Brief

Demonstrates MCPWM trip zone triggered by CMPSSLITE comparator

Details

This example demonstrates the MCPWM trip zone feature triggered by CMPSSLITE comparator. It uses two ECAP instances to capture precise timestamps: one for the CMPSS trip output and another for the MCPWM trip event, allowing validation of trip propagation timing.

Block diagram

Signal Routing:

  • CTRIPH signal is routed through PWMXBAR to MCPWM Trip Zone (TZ1)

  • CMPSS trip signal is captured by ECAP1 for timestamp

  • MCPWM trip event is captured by ECAP2 for timestamp

  • Both ECAP instances use MCPWM Time Base as counter source for synchronized timestamps

Trip Zone Configuration:

  • Source: CMPSSLITE (via PWMXBAR) configured as one-shot trip

  • Trip Action: Force PWM1A and PWM1B outputs LOW

  • Mode: One-shot (latched) - trip remains active until cleared

  • Interrupt: Enabled on trip event

Validation:

  • Verifies trip zone interrupt, flags, and both ECAP captures with valid timestamps

  • Validates timestamp difference (positive and within 20 cycles)

Output waveform

Peripherals used

CMPSSLITE
  Instance 1         : APP_CMPSSLITE0
    Purpose          : Trip Zone trigger generator (TZ1)
    Comparator       : HIGH comparator
    + Input (pos)    : External pin HP0 (DAC output from APP_CMPSSLITE1)
    - Input (ref)    : Internal DAC, threshold = 2048 (~1.65V)
    Output type      : Asynchronous
    Output           : CTRIPH to PWMXBAR TZ1
    Hysteresis       : None

  Instance 2         : APP_CMPSSLITE1
    Purpose          : Analog input generator for APP_CMPSSLITE0
    Comparator       : Not used
    LOW DAC          : Initial = 0V, raised to 3072 (~2.48V) to trigger trip
    DAC output       : Routed externally (DACOUT) to APP_CMPSSLITE0 HP0 pin
    Hysteresis       : None
MCPWM
  Instance           : APP_MCPWM
    Channels Enabled : 1A, 1B

    Time Base
      TB Clk         : 250MHz
      Counter Mode   : UpCount
      PRD            : 20000 cycles
      Frequency      : 12.5 kHz

    PWM
      CMPA           : 19500 cycles (97.5% duty)
      CMPB           : 19500 cycles (97.5% duty)
      Actions 1A     : High on Zero, Low on CMPA hit
      Actions 1B     : High on Zero, Low on CMPB hit

    Trip Zone
      Source         : CMPSSLITE (TZ1)
      Trip Type      : One-Shot (latched)
      Trip Action    : Force PWM outputs LOW

    Event Trigger
      Interrupt src  : Trip Zone OST Signal
ECAP
  Instance 1        : APP_ECAP_TRIP_INPUT_CAPTURE
    Mode             : One-shot Capture
    Input Source     : CMPSS trip output (event1)
    Sync Source      : APP_MCPWM SYNCOUT (Ctr == Zero)
    Interrupt        : On event1 capture

  Instance 2         : APP_ECAP_MCPWM_CAPTURE
    Mode             : Continuous Capture
    Input Source     : MCPWM trip event (event2)
    Sync Source      : APP_MCPWM SYNCOUT (Ctr == Zero)
    Interrupt        : On event2 capture
VREF
  Reference          : Internal
    Mode             : 3.3V range
SoC
  SYSCTL
    TBCLK            : Disabled. To be enabled in app

  INTERRUPTS
    Instance         : APP_MCPWM_INT
      Source         : APP_MCPWM
      Handler        : APP_MCPWM_INT_Handler

    Instance         : APP_ECAP_TRIP_INPUT_CAPTURE_INT
      Source         : ECAP0
      Handler        : APP_ECAP_TRIP_INPUT_CAPTURE_INT_Handler

    Instance         : APP_ECAP_MCPWM_CAPTURE_INT
      Source         : ECAP1
      Handler        : APP_ECAP_MCPWM_CAPTURE_INT_Handler

External connections

Required analog loopback connection for CMPSS functionality:

  • Connect: BoosterPack header pin 30 (CMPSS1 DAC OUT) to pin 23 (CMPSS3 comparator input)

Monitor 2 channels of APP_MCPWM on scope/logic analyzer

  • Connect: BoosterPack header J4 pin 40 (APP_MCPWM_1A) to Scope/Logic analyzer

  • Connect: BoosterPack header J4 pin 39 (APP_MCPWM_1B) to Scope/Logic analyzer

LED Details: PASS LED (LED5), FAIL LED (LED4)