Part Number: TMS320F28035
Tool/software: Code Composer Studio
Hi TI experts,
I am trying to implement a cycle-by-cycle current control with F28035 (COMP2 and COMP3).
The problem is that the current which triggers the cycle-by-cycle control is bidirectional. So what I do is to implement COMP2 to make sure when the current is higher than the positive threshold (V+), cycle-by-cycle control is triggered with slope compensation. I have tested it on the bench and it works very well.
Comp2Regs.COMPCTL.bit.COMPDACEN = 1; // Power up Comparator 2 locally
Comp2Regs.COMPCTL.bit.COMPSOURCE = 0;
Comp2Regs.COMPCTL.bit.SYNCSEL = 1;
Comp2Regs.COMPCTL.bit.QUALSEL = 5;
Comp2Regs.RAMPMAXREF_SHDW = (512*64 + 100*64); // positive current threshold (+10A), 512 is the middle point, corresponding to 0A
Comp2Regs.RAMPDECVAL_SHDW = 2;
However, when it comes to negative current. I use COMP3 to trigger the cycle-by-cycle control, similar to COMP2. However, I do not know how to implement the slope compensation. As suggested in the TRM, RAMPMAXREF_SHDW is the initial value, and RAMPDECVAL_SHDW is substracted from RAMPMAXREF automatically. It works fine when the current is positive. However, when the current is negative, if the RAMPDECVAL_SHDW is still substracted from RAMPMAXREF, it is not valid slope compensation anymore.
Comp3Regs.COMPCTL.bit.COMPDACEN = 1; // Power up Comparator 2 locally
Comp3Regs.COMPCTL.bit.COMPSOURCE = 0;
Comp3Regs.COMPCTL.bit.SYNCSEL = 1;
Comp3Regs.COMPCTL.bit.QUALSEL = 5;
Comp3Regs.RAMPMAXREF_SHDW = (512*64 - 100*64); // negative current threshold (-10A), 512 is the middle point, corresponding to 0A
Comp3Regs.RAMPDECVAL_SHDW = 2;
Comp3Regs.COMPCTL.bit.CMPINV = 1;
I wish I could put a negative number in the RAMPDECVAL_SHDW. Any possible work-around in this case?
Thanks,