I realize I am late for the party but I found a more flexible solution.
I used it to generate a 1MHz 50% dutycycle signal synchronized to a kHz 20% dutycyle.
I used the peripherals perspective in mcuxpresso, so it is hard to share source code, but the setup is as follows:
SCT clock is 16 MHz, using a prescaler of 8, the counter frequency is 2 MHz.
event 0:
match event with match value 0
action: toggle sct output 1
event 1
match event with match value 400
action: clear sct output 2
event 2
match event with match value 1999
action: set sct output 2 and limit counter (restart it from zero).
in the source code, add the following line before starting the timer:
SCT0->EV[0].CTRL |= SCT_EV_CTRL_MATCHMEM(1);
This means that the event 0 fires every clock after the initial match. since the match is set to 0 it just toggles the output at 1MHz from the the timer is started.
event 1 and event 2 control the second output and are responsible for limiting the timer.
They can be set almost independently of event0.
summary:
Choose a prescaler to get a counter frequency twice as fast as the fastest signal, by using the MATCHMEM setting of event 0.
Use two indenpendent events to set the second pwm channel and limit the counter.
Cheers,
Lauge