SDAA040 July 2025 MSPM0C1104
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.
Figure 4-2 PWM Duty Capture Error
Comparison| 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% |
| 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 |