MCPWM Trip Zone

Brief

Demonstrates MCPWM trip zone functionality with GPIO fault input

Details

This example demonstrates the MCPWM trip zone feature with GPIO-based fault detection. It uses two ECAP instances to capture precise timestamps: one for the GPIO trip input and another for the MCPWM trip event, allowing validation of trip propagation timing.

Block diagram

Signal Routing:

  • GPIO trip input is routed to MCPWM Trip Zone (TZ1)

  • GPIO trip signal is also 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: GPIO (TZ1) 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

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         : GPIO (TZ1)
      Trip Type      : One-Shot (latched)
      Trip Action    : Force PWM outputs LOW

    Event Trigger
      Interrupt src  : Trip Zone OST Signal
GPIO
  Instance 1         : APP_TZ_GPIO_TRIP_GEN_PIN
    Purpose          : Trip generator - toggles to trigger trip

  Instance 2         : APP_TZ_GPIO_TRIP_IN_PIN
    Purpose          : Trip input - connected to TZ1
ECAP
  Instance 1         : APP_ECAP_TRIP_INPUT_CAPTURE
    Mode             : One-shot Capture
    Input Source     : GPIO trip input (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 connection for trip zone functionality

  • Connect: BoosterPack header pin 36 (TRIP_GEN) to pin 17 (TRIP_IN)

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)