SDAA040 July   2025 MSPM0C1104

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
    1. 1.1 PWM Signal Capture Introduction
    2. 1.2 MSPM0C110x Introduction
  5. 2PWM Signal Capture
    1. 2.1 PWM Signal Capture Methods
    2. 2.2 PWM Signal Capture with TIMx CC Block
    3. 2.3 PWM Signal Capture with GPIO Interrupt
    4. 2.4 Comparison of Different PWM Signal Capture Design
  6. 3Software Realization
    1. 3.1 Identifying Rising and Falling Edge
    2. 3.2 Time Order Classification
    3. 3.3 Signal Filter and Result Calculation
  7. 4System Test
    1. 4.1 Test Setup
    2. 4.2 Variable Monitor
    3. 4.3 PWM Signal Capture Resolution Test and Comparison
  8. 5Summary
  9. 6References

PWM Signal Capture with GPIO Interrupt

The PWM duty and period capture also can be realized with GPIO interrupt in software. The CPU interrupt can be generated on both GPIO falling and rising edge with GPIO First Event Publisher. The user can control the CPU timer action in the GPIO interrupt to capture PWM duty and period. The capture time order is described in the following sections. The software details are described in following chapters. To improve the capture accuracy, the timer must start or stop as soon as the GPIO interrupt enters to verify the short and equal SW delay between T1, T2, and T3. The time order of this PWM duty and period capture method is shown in Figure 2-3.

 Timer Order of Capture PWM
                    Duty and Period with GPIO Interrupt Figure 2-3 Timer Order of Capture PWM Duty and Period with GPIO Interrupt
  • T1: Trigger GPIO interrupt in rising edge and start timer.
  • T2: Trigger GPIO interrupt in falling edge and record the TIMx.CTR value.
  • T3: Trigger GPIO interrupt in rising edge and stop timer.