Content originally posted in LPCWare by simonbr on Wed Apr 21 01:01:32 MST 2010
Quote: micrio
Another suggestion is to take an interrupt on match and update the match register at that time.
I thought about that, and the best way would be to get the interrupt right after the PWM match occurs.
However this would not work reliably in all cases. Suppose a period of 1000, a PWM match value of 999, and a new PWM match value of 1. If the timer runs at maximum speed the interrupt handler is not able to set the new match value before the timer is already past it.
Anyway, so far the most important question has not been answered. Did the writers of the LPC13xx manual think it unnecessary to mention it, or did the designers of the chip think it unnecessary to implement it?
If the PWM match registers are actually buffered, none of the suggested workarounds would be necessary.
I think I need to do an experiment to find out.