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 Resolution Test and Comparison

To compare the two methods performance in full range and corner cases, 100Hz/ 2KHz/ 5KHz/ 10KHz PWM frequencies are used in this test, PWM duty cycle covers from 0.2% to 99.8%. Figure 4-2 shows the comparison error with GPIO interrupt (Blue line) and TIMx CC block (Orange line), the x-axis represents the PWM duty cycle, to show the corner case properly, the number is not proportional, the y-axis represents the capture error in ‰. Table 4-1 and Table 4-2 shows the capture result with GPIO interrupt (Blue line) and TIMx CC block (orange line).

In all the PWM duty range, the GPIO interrupt method keeps the capture error below 1%, it also has the robust performance in the corner case, when PWM duty <1% and >99%, which avoid the abnormal data. The TIMx CC block method shows high resolution when PWM duty is large especially >99%, but the capture value must be corrected manually when PWM duty <1% to avoid the >100% wrong results.

 PWM Duty Capture Error
                    Comparison Figure 4-2 PWM Duty Capture Error Comparison
Table 4-1 PWM Duty Cycle Capture Error with GPIO Interrupt
Input Signal 100Hz 2KHz 5KHz 10KHz
Calculation result Error Calculation result Error Calculated result Error Calculation result Error
0.2% 0.2% 0 0.0% 0.2% 0.0% 0.2% 0.0% 0.2%
0.5% 0.5% 0 0.9% 0.4% 0.0% 0.5% 0.0% 0.5%
1% 1.0% 0 1.1% 0.1% 2.3% 0.3% 0.0% 1.0%
20% 20.2% 0.2% 20.4% 0.4% 20.6% 0.6% 21.0% 1.0%
30% 30.2% 0.2% 30.3% 0.3% 30.5% 0.5% 31.0% 1.0%
40% 40.1% 0.1% 40.2% 0.2% 40.4% 0.4% 41.0% 1.0%
50% 50.1% 0.1% 50.2% 0.2% 50.4% 0.4% 50.7% 0.7%
60% 60.0% 0 60.2% 0.2% 60.4% 0.4% 60.7% 0.7%
70% 70.0% 0 70.1% 0.1% 70.3% 0.3% 70.6% 0.6%
80% 79.9% 0.1% 80.1% 0.1% 80.2% 0.2% 80.5% 0.5%
99% 99.0% 0 99.1% 0.1% 98.2% 0.8% 100.0% 1.0%
99.5% 99.5% 0 99.2% 0.3% 100.0% 0.5% 100.0% 0.5%
99.8% 99.8% 0 100.0% 0.2% 100.0% 0.2% 100.0% 0.2%
Table 4-2 PWM Duty Cycle Capture Error with TIMx CC Block
Input Signal 100Hz 2KHz 5KHz 10KHz
Calculation result Error Calculation result Error Calculation result Error Calculation result Error
0.2% 0.1% 0.1% 0% 0.2% 0% 0.2% 0% 0.2%
0.5% 0.4% 0.1% 0% 0.5% 0% 0.5% 0% 0.5%
1% 0.9% 0.1% 0.4% 0.6% 0% 1.0% 0% 1.0%
20% 20.2% 0.2% 19.8% 0.2% 19.1% 0.9% 18.1% 1.9%
30% 30.2% 0.2% 29.7% 0.3% 29.2% 0.8% 28.3% 1.7%
40% 40.1% 0.1% 39.8% 0.2% 39.3% 0.7% 38.3% 1.7%
50% 50.1% 0.1% 49.8% 0.2% 49.4% 0.6% 48.6% 1.4%
60% 60.0% 0 59.8% 0.2% 59.5% 0.5% 59.0% 1.0%
70% 70.0% 0 69.8% 0.2% 69.6% 0.4% 69.0% 1.0%
80% 79.9% 0.1% 79.8% 0.2% 79.7% 0.3% 79.3% 0.7%
99% 98.9% 0.1% 98.9% 0.1% 99.0% 0 98.9% 1.0%
99.5% 99.4% 0.1% 99.4% 0.1% 99.4% 0.1% 99.5% 0
99.8% 99.8% 0 99.7% 0.1% 99.7% 0.1% 99.8% 0