I'm pretty sure that your concern is that as you change the duty cycle
you may update one capture compare (I'm gonna call it 'CC') value in a
way that causes both transistors to be on at the same time, then have the
timer fire off, then update the other one -- yes? What, I ask, is a bit
of noxious smoke between friends?
My first urge is to change the hardware. This situation should not have
been allowed to develop in the first place -- either someone should have
used a processor with dead time control, or they should have used gate
drive circuitry with dead time control (there are scads of ways to do
this in hardware-only), or they should have made damned sure that they
knew how to make it work in software.
If you have any influence over the hardware at all, I would start by
checking the schematic -- if you're lucky, someone used a gate driver
with dead-time control, meaning you can just add the appropriate
capacitor and you're done. Or someone may have put in the older-style
diode-and-resistor network that accomplishes the same thing.
If all of that failed, I would check to see if the processor buffers the
CC numbers -- some companies design their PWM peripherals so that the
command registers are buffered and are only written at a specific point
in the PWM cycle. If you interrupt on this point, and always manage to
write the command values well within one PWM interval, then all you need
to do is make sure to write the correct values.
Failing all else, I would monitor the direction that the PWM is going,
and always write the CC commands in such an order that during the
interval that one register has been written and the other hasn't, the
dead time is increased rather than made overlapping. This may cause the
occasional inefficient operation and some strange EMI issues, but at
least it won't let out the magic smoke. As long as your CC registers are
declared volatile and your hardware doesn't do anything funny then you
should be OK.
If you are concerned that the pipeline may disorder your ordered memory
writes, the ARM has an instruction to flush the pipeline before
proceeding (I'm pretty sure that it's absolutely unnecessary in your case
-- but if you're feeling paranoid it's there.) If you were using a
PowerPC processor then I could recommend the EIEIO instruction which has
my FAVORITE MNEMONIC EVER, but you're not, so you'll have to live with
whatever stogy British mnemonic goes with the ARM stuff.
--
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com