Decided to roll my own PWM adjustable SMPS BCCC (Buck Converter Constant Current mode) for an LED project I've been having troubles getting to work trying to hack CV mode SMPS.
A few caveats: Frequency limits of various components MUST be considered (gain bandwidth product of the op-amp, gate delay of the S-R flip-flop, frequency limits of the NPN gate drive and characteristics of the P-Channel MOSFET. This is not a perfect example of an SMPS CC mode supply.
There is no "soft-start" function to limit inrush current. Component values are not optimized. If you plan to physically build this design, be mindful of the safety factor needed to design the physical circuitry. ie; if you plan to build this design for ~ 0.5-5A CC and ~ 40KHz clock then, ALL your power components should have a safety factor of 2. That means when choosing power components (MOSFET, inductor, and schottky rectifier diode) should all be rated for design current (and voltage) multiplied by the safety factor of 2: 5A x 2 = 10A. Operating frequencies should also be considered for all components but do not *necessarily require the 2x safety factor.
I've modified the MOSFET to act more like a real high power MOSFET with 2x more width. The logic gates are required to regulate the width of the pulse to the MOSFET.