Other Parts Discussed in Thread: TMS320F28379D
I have a variable frequency LLC application where each phase of the F28027 can be terminated by a comparator before reaching the TBPRD value. At this point the TBPHS register is loaded, which resets TBCTR to 0. However, it may also not be terminated by the comparator, and count all the way to TBPRD.
The problem: If the comparator does not trip during a given phase, the ramp generator does not reset. This means that the ramp generator continues counting down into the next phase. This can cause premature termination of the next phase, because the reference to the comparator will be too low.
I need a method to force the ramp generator to reset at the end of the phase, regardless of whether the comparator trips or not. The only method I've come up with is to toggle the DACSOURCE bit in the ISR:
Comp1Regs.DACCTL.bit.DACSOURCE = 0; // 0 - DACVAL
Comp1Regs.DACCTL.bit.DACSOURCE = 1; // 1 - Internal ramp for slope compensation
But this takes time (I've implemented it in C) which is slowing down my minimum period. Is there a more elegant way of resetting the ramp generator?