SDAA040 July 2025 MSPM0C1104
This demo takes the GPIO falling edge as the start of one PWM pulse. The correct time order must be: the first falling edge is detected, the rising edge is detected and the second falling edge is detected. In some corner cases, the PWM duty cycle is less than 0.2% or the PWM duty cycle is larger than 99.7%. The time order can be inaccurate due to the noise. The gflag and gflag_2 in the demo are set to identify the correct time order. The corresponding actions in different situations are listed in Table 3-2
| GPIO Edge | gflag | gflag_2 | Actions |
|---|---|---|---|
| Rising edge | 0 | 0 | Do nothing |
| 0 | 1 | Does not occur | |
| 1 | 0 | Record COUNTERREGS.CTR to DUTY, Set gflag_2 | |
| 1 | 1 | Reset counter and flags | |
| Falling edge | 0 | 0 | Start Timer, set gflag |
| 0 | 1 | Does not occur | |
| 1 | 0 | Reset counter and flags | |
| 1 | 1 | Record COUNTERREGS.CTR to PRD, Reset flags |