EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: WyverntekGameRepairs on December 09, 2019, 01:26:50 am

Title: Help needed for DCM SMPS using uC3842AN
Post by: WyverntekGameRepairs on December 09, 2019, 01:26:50 am
Hi there! I'm Sterling Ordes, 18 years old, and I'm trying to start a video game console & peripheral repair / refurbishment / accessory manufacturing business. I'm doing quite well so far, getting ready to purchase a business license and other licenses I will need to get me started, so I'm raising money through small partnerships with other businesses and producing my own console accessories. The current product I am designing is a switch-mode power supply for the Nintendo 64.
I have based my design off of the Playstation 1 SCPH-5501 SMPS, since it is simple and has multiple outputs. It uses the uC3842AN high-performance PWM controller IC as the control IC, and is both easy to understand and high-quality.

However, I am stumped when trying to draw up a schematic, as several parts of the PS1 schematic has wiring choices that are... Questionable, to say the least. I'll list them here:
1) The output ground on the low-voltage side is linked directly to neutral via a 6.8M 1/2W resistor (R120), as well as the high-voltage negative / ground (from the rectifier) via 1500pF 125V capacitor. While the capacitor makes sense, as it is used to shunt the high-frequency interference and such to neutral / ground but still maintain isolation, the resistor really throws me off. It is high resistance, but it is visibly connected from the main ground on the low-voltage side *directly* to the neutral, no capacitor to provide isolation. Wouldn't this break the isolation and render the isolation useless? Or is this actually a great way to help surpress interference? Or is it possibly required for the error amplifier to function on the uC3842AN chip? That design choice throws me off, as I am mainly a hobbyist and haven't really gotten into the true nitty-gritty of engineering until very recently, so I don't understand what effect doing that would do to the overall performance and safety of the circuit.
2) In the PS1 PSU schematic, the COMP is connected to the Vfb on the uC3842AN via the optocoupler, along with the capacitor for filtering (if I'm not mistaken). However, the Vfb is also connected to the negative of the mains post-rectifier smoothing capacitor, serving as the ground for the IC, the capacitor linking Isense to negative, and the RT/CT capacitor to negative (as well as a few other things). The Texas Instruments functional diagram shows COMP connected to Vfb through a capacitor and resistor (which would be replaced by the optocoupler), but they are not connected to the main ground / negative rail. What is the significant reason for linking the Vfb to ground? Wouldn't it be prone to interference from other voltages on the ground rail?
3) On my PS1 PSU schematic diagram, the N-channel MOSFET that switches the primary of the transformer seems to be reversed. The source is connected to negative, but the load is connected to the coil and to the positive rail. The MOSFET looks like it is being negative-biased using a 10K resistor connected between the Source and Gate. The Source and Load of the MOSFET are connected via 100 Ohm 1W resistor in series with a 220pF 1KV capacitor. The Load of the MOSFET is not only connected to the primary coil of the transformer, but is also connected to a RMPG06J (I believe general-purpouse rectification) diode, which is then connected to a 100K 1/2W resistor in parallel with a 0.033uF 400V capacitor... which connects to the positive rail (noting that the primary coil is connected to the positive rail as well). What is going on here?

I may have a few other questions, but I will leave this post at this for now. If you have experience with the IC I am using in this design or have experience in switch mode power supplies, I welcome any suggestions as well. Thanks for reading this long wall of text and (hopefully) helping me out.  :)
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: MagicSmoker on December 09, 2019, 11:03:56 am
A picture says a thousand words - quite literally in this case - so sketch out what you think is the circuit and post it here (taking a picture of a hand-drawn schematic is fine as long as it is legible).

The 6.8M resistor across the capacitor that bridges input and output commons is unusual, but it doesn't necessarily break isolation according to the usual regulatory agencies as they set a limit for how much current from the mains can be injected into (either) ground from any Y-capacitance (ie - capacitors from mains to ground, or ground to ground). The worst case limit of 0.25mA (for medical devices) allows for an effective resistance between grounds as low as 960k (240Vrms / 0.25mA), so 6.8M is technically fine. Why it is there, anyway, I have no idea. I guess it ensures the 1.5nF y-capacitor discharges once power is removed, but this isn't really a shock hazard in the first place.

For everything else a schematic would be very helpful. It is also isn't entirely clear what you are proposing w/r/t the transformer; you almost always have to design the transformer for an offline (ie - mains-supplied) SMPS, and while it can be bewildering the first few times you do it, it's not quite the dark art most people think. Okay, it is very much a dark art, just not Voldemort-level dark...
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: T3sl4co1l on December 09, 2019, 12:07:02 pm
1. See above, Magic's covered everything :)

2. If this is the typical circuit you're referring to, then it helps to understand how the controller is being used.  The controller has an error amp inside, set to adjust VFB to 2.50V.  It controls the CMP pin.  The CMP pin in turn is read by the current comparator, this being the setpoint for where to turn off the switch, implementing peak current mode control.

So, in short, V(CMP) ~ Iout.

In a common-ground application, the error amp is used directly, and there is a voltage divider from output to VFB, and a compensation R+C from VFB to CMP.  The compensation accounts for the phase shift of the converter and output filter cap, stabilizing the output.

A note about control: you'll often see descriptions of control systems in terms of "if-then" events, or "greater-lesser-than" digital comparisons.  This is wrong: control is a continuous, linear process.  (Well, it can be done by comparison -- call hysteretic control.  But this case happens to be the linear kind.)  The aim here is to adjust the output, from moment to moment, gently enough that it doesn't run away and oscillate, while -- over the long term -- adjusting it so that the output is as close to the setpoint as possible.

Anyway, that's common ground; what if our output is isolated?  We can use an optoisolator to communicate the output voltage to the controller.  But these are not accurate devices.  We can put a resistor to the LED, driving it with a current proportional to the output voltage, and measure a current at the phototransistor that's -- who knows, maybe 50%, maybe 300%!  It varies with part number, manufacture (gain is not necessarily consistent from part to part) and age (primarily the LED fading with use, over 1000s of hrs).  So that's pretty useless.

So what we do instead, is use the controller as a transconductance amplifier.  That is, it's making a current (our output), and we adjust that current by the input voltage.  So it has gain in units of A/V (conductance), and the amps and volts are measured in different locations, hence "trans".  Transconductance.  We set that voltage with the opto, and set the opto's current* with a separate error amplifier -- this time referenced to the output supply, so we can get an accurate voltage at the output.

*Okay so the opto has current gain, converted to voltage with a resistor, and back to current again by the converter, so this is overall a current amplifier now.  If it matters. :P

The key is, by placing the opto inside the control loop, yes it might be in error, but we are controlling that error, and as long as we've properly placed the min/max limits of the system (opto at minimum CTR (current gain) is still able to deliver full voltage to the controller; opto at maximum CTR does not cause the control loop to go unstable), we're golden -- the error is absorbed by the error amp.

And for that error amp, we have a convenient device, a TL431 usually (and many relatives).  This is drawn as an adjustable zener diode, whatever the hell that's supposed to mean -- but the characteristic is nothing like a zener, in fact it is a three-terminal op-amp with an open-collector output and an inverting input pin with a massive (but conspicuously stable) offset voltage of 2.50V.  Seen in this light, we don't need to have REF tied to "cathode" by a voltage divider (the standard "adjustable zener" configuration), but we can use a whole system to provide that feedback, and just like the error amp on the UC3842, we put an R+C across it ("cathode" to REF) to compensate its response.

So that's the complete system -- we can configure the UC3842 as a simple current amplifier by either strong-arming its CMP pin directly (which can't source/sink much current, so is easy to overdrive; in this case, VFB can be tied off to GND or something), or by wiring it as a unity gain inverting amplifier (say 10k from CMP to VFB, 10k from VFB to opto).


3. Not sure what you mean about reversal or biasing -- it's a class D circuit, switching, no bias needed.  It's designed to spend as little time as possible in the linear range, to save on power dissipation.

The usual configuration is a low-side switch (source and gate reference to GND, give or take), with the primary in the drain circuit (from drain to +V).  The peak voltage (when the MOSFET turns off) shoots above +V, driven by the transformer's inductance.

It sounds like there's an R+C damper (or snubber), which probably absorbs the free ringdown of the transformer's inductance with the MOSFET drain capacitance.  This helps reduce lower frequency EMI, at the expense of some power dissipation (mostly in the resistor).

It sounds like there's also a peak clamp snubber: when the drain voltage shoots up (flyback), the diode clamps that voltage into the 33nF cap (which is referenced to +V, because the primary is).  Actually once the diode is conducting, it's a resonant circuit of Lp (primary inductance) and 33nF, but this is so much lower (in impedance and resonant frequency) that it looks like a flat topped waveform, i.e., it seems to be clamping the voltage peak and that's it.  The 100k then bleeds away the excess charge the capacitor has picked up; this is wasted, costing efficiency (there are configurations where this can be saved -- namely, the two-switch flyback or forward converter; these are more complicated to construct, though).

The clamping wouldn't be necessary if the transformer were ideal, but real transformers have leakage inductance as well.  This appears as inductance in series between primary and secondary.  In effect, the primary can't instantly tell what the secondary is doing, but rather that action is communicated through this inductance.  As a result, when the secondary side diode turns on, most of the transformer inductance (charged as it was by the MOSFET) is clamped into the output filter cap (delivering useful power), but a fraction of that energy is trapped in the leakage inductance, and causes additional peak voltage on the primary side.  This can destroy the transistor, or at least require a higher rated one, so it's better to clamp it instead.  It's also wasted power -- there's no way to divert that leakage energy into the secondary, you're already doing all that you can on the secondary side.

So the best way to save this loss, is to optimize the transformer design so it isn't storing a lot of energy as leakage inductance.


4. Hah, nah, resistor dividers and pass regulators are 100% (or more) waste.  Use multiple outputs -- say, a transformer with a 12V and 4V secondary, and then use an LDO to drop 4V down to 3.3V with good stability.  Logic supplies can be picky, and cross-regulation (that is, the amount one supply's voltage changes, due to a change in load current on the other) tends to be mediocre, so it can be worthwhile overshooting just a bit and still using a lossy regulator but only for a volt or so (so the overall efficiency is still good).

If you can't get custom transformers made this way, you can stack transformers (at some cost to performance).  For example, use "12V" and "3.3V" transformers, wired in parallel at the primary; the total load inductance is the parallel combination, so choose them appropriately for nominal load.  Or, use a single "12V" transformer, then put a trans/autoformer in parallel with that secondary, to divide it down to "3V" or "4V".  You can use one 1:2, or a pair of 1:1, coupled inductors in this way.  There are also multi-winding configurable transformers out there, at some additional cost.

Or, at worst -- just make two independent converters.  Can share the EMI filter and bulk (DC) cap.  Can even buy off-the-shelf modules instead of building your own -- a great way to start if you're unfamiliar with safety regulations!

Cheers,
Tim
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: WyverntekGameRepairs on December 09, 2019, 04:43:51 pm
1. See above, Magic's covered everything :)...
A picture says a thousand words - quite literally in this case - so sketch out what you think is the circuit and post it here (taking a picture of a hand-drawn schematic is fine as long as it is legible)...

This is all really helpful, and helps me understand and make sense of things a lot better. Thank you so much! As for Magic, I'll post a link to the manual. The page numbers on the PDF that you need to go to are 51 and 52. http://psxdev.ru/files/manuals/SCPH-5500_5501_5502_5503.pdf (http://psxdev.ru/files/manuals/SCPH-5500_5501_5502_5503.pdf)
I hope that helps!

Thanks, I really appreciate your help :)
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: MagicSmoker on December 09, 2019, 06:08:21 pm
This is all really helpful, and helps me understand and make sense of things a lot better. Thank you so much! As for Magic, I'll post a link to the manual. The page numbers on the PDF that you need to go to are 51 and 52. http://psxdev.ru/files/manuals/SCPH-5500_5501_5502_5503.pdf (http://psxdev.ru/files/manuals/SCPH-5500_5501_5502_5503.pdf)
I hope that helps!

Thanks, I really appreciate your help :)

T3sl4co1l already surmised much of the functionality here, so some of this will be redundant.

* The topology is a plain old isolated flyback converter.
* R119 & C112 are an RC snubber (or as I prefer to call it, a damper) whose purpose is to suppress oscillation/ringing as a result of the MOSFET's output capacitance and the transformer's leakage inductance.
* D105, C105 & R105 form a self-tracking voltage clamp. Every time the switch turns off energy stored in the leakage inductance flows through D105 to charge up C105, which R105 slowly bleeds off. It's called self-tracking because the clamp voltage scales with power throughput and is always a certain amount more than the incoming DC bus voltage for a given power (based on the energy balance between LI2 and CV2).
* IC201 is better known as the (somewhat infamous) TL431 adjustable shunt reference and it is being used as a combination 2.5V voltage reference and operational amplifier to control the current through the LED in optoisolator PC101. Many consider this a hack (including me), but it is undoubtedly the most common way to regulate output voltage in cheap commercial switchers.
* Q202 injects a little bit of current from the 8V rail into the feedback circuit to improve cross-regulation with the main 3.5V output. This trick is usually applied to forward converters because they have much worse cross-regulation of multiple outputs compared to flybacks; I wouldn't bother with it here.
* R106 is for sensing primary current while R109/R110 and C107 form a light filter to round off any leading edge spikes that might cause the current-mode controller, IC101, to terminate the switch on-time too early.
* IC202, marked as RST598INR, might be a typo for PST598INR. Either way, this is clearly a supervisor IC that keeps a processor in reset until the power supply voltage(s) is correct.
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: WyverntekGameRepairs on December 10, 2019, 11:29:33 pm
Hey @MagicSmoker, thanks for helping me out! Your descriptions were concise, and I appreciate it. I have a few notes regarding your post, if you don't mind me going over them.
* Yeah, I kinda had a feeling R119 and C112 were being used as a damper. Now that I think about it, it actually makes sense because I'd think that the interference from the leakage inductance of the transformer and the MOSFET's capacitance could actually throw off the switching significantly if the noise gets bad enough.
* Self-tracking voltage clamp? I'd never thought about that. I've never even used one before. Now that you have told me the purpouse of it though, it actually makes more sense to me too. Basically, if I've got this right, it is being used to drain the leftover energy caused by inductance in the transformer. It prevents the inductance from introducing unwanted voltages during the OFF stage. It needs to be adjustable because the power draw is changing depending on what the console is doing, and as the power draw changes, the voltage and current also changes. Therefore, the clamping voltage must be dependant on power draw to prevent false clamping due to voltage fluctuations caused by constantly changing power consumption. (Please correct me if I am wrong, I'm eager to learn this stuff. Besides, I've got a while - about 8 months - before I start building the prototypes for my own power supply, so I'm using that time to learn what I can.)
* I did some research and found that IC201 (the TL431 component) is actually an adjustable zener diode. It makes sense that it would be used as the voltage regulator for PC101's LED. I think that RV201 (the 2K variable resistor) is responsible for adjusting the reference voltage precision.
* Hm. Using a transistor to inject a little current from an 8V rail to the feedback circuit... I'm having a little trouble grasping this. I would think that there would be 2 optocouplers, one for the 3.5V and one for the 8V, because usually optocouplers are digital or used for digital signal, not analog. By the sound of it, the brightness of the LED is dictated by the sum of the feedback + the percentage of voltage injected by the transistor, and the output of the opto is monitored by the controller IC via measurement of conductivity or resistance. I am probably way off, but the way you described it makes it sound like that. I hope you don't mind me asking, but can you elaborate on that please?
* That makes total sense now! I don't know how I didn't see that earlier. But hey, now I do see it, and my God it makes perfect sense. That filter has to be there, or else the leading edge spikes (caused by the IRC from the transformer when it is switched ON) would, as you said, potentially cause the controller to falsely terminate the ON-time too early. BUT! Wouldn't this also be able to filter the spike / remaining current from the inductor suddenly being turned OFF? Or is that part handled by the self-tracking voltage clamp alone?
* That IC now makes perfect sense too. The processors in the PlayStation are sensitive to bad voltages, and it makes sense that it would need a way to make sure that the voltage is correct before allowing the processors to turn on. It also allows for the RESET button to be used.
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: MagicSmoker on December 11, 2019, 12:44:51 am
* ...I'd think that the interference from the leakage inductance of the transformer and the MOSFET's capacitance could actually throw off the switching significantly if the noise gets bad enough.

Eh, not really. I mean, it's always possible that ringing will disturb the controller IC (particularly with a careless board layout) but the primary concern is passing ElectroMagnetic Compatibility (EMC) testing. The FCC, et al., tend to frown on power supplies that double as AM radio stations.

* ...Basically, if I've got this right, it is being used to drain the leftover energy caused by inductance in the transformer. It prevents the inductance from introducing unwanted voltages during the OFF stage. It needs to be adjustable because the power draw is changing depending on what the console is doing, and as the power draw changes, the voltage and current also changes. Therefore, the clamping voltage must be dependant on power draw to prevent false clamping due to voltage fluctuations caused by constantly changing power consumption. (Please correct me if I am wrong, I'm eager to learn this stuff. Besides, I've got a while - about 8 months - before I start building the prototypes for my own power supply, so I'm using that time to learn what I can.)

You were on the right track in the first sentence above, then veered off into the weeds.  :P  The self-tracking nature isn't necessary, it's just an interesting and highly useful side effect. Basically, as line voltage goes down, peak switch current goes up to maintain a constant power output, which stores more energy in the leakage and stray inductances. The higher energy results in a larger increase in the clamp capacitor voltage each time the switch turns off, but since the line voltage is lower the total voltage seen by the switch isn't affected (much). It's more correct to say that the self-tracking voltage clamp maintains a roughly constant voltage stress on the switch regardless of line voltage at a given load (desirable), and that clamping voltage is proportional to load at a given line voltage (less desirable or even undesirable)

An alternate clamping scheme replaces the parallel RC network with a TVS or zener diode; this results in a fixed clamping voltage regardless of line voltage so it is usually less efficient than the self-tracking RCD clamp in "universal input" applications (that is, 85VAC to 265VAC), but it provides a (nearly) guaranteed voltage stress for the switch.

* I did some research and found that IC201 (the TL431 component) is actually an adjustable zener diode. It makes sense that it would be used as the voltage regulator for PC101's LED. I think that RV201 (the 2K variable resistor) is responsible for adjusting the reference voltage precision.

RV201 is for setting the output voltage. BTW - trimmer potentiometers are one of the most unreliable electronic components around so shouldn't be used unless absolutely necessary.

* Hm. Using a transistor to inject a little current from an 8V rail to the feedback circuit... I'm having a little trouble grasping this....

Basically, this scheme blends feedback from the 8V and 3.5V rails together, rather than just monitoring one or the other. The result is better cross-regulation of the two outputs, at the expense of the absolute regulation of the main output (which would likely be the 3.5V rail here). "Injecting current" is meant in the Norton sense (ie - the voltage at a node is proportional to the summed currents).

...That filter has to be there, or else the leading edge spikes (caused by the IRC from the transformer when it is switched ON) would, as you said, potentially cause the controller to falsely terminate the ON-time too early. BUT! Wouldn't this also be able to filter the spike / remaining current from the inductor suddenly being turned OFF? Or is that part handled by the self-tracking voltage clamp alone?

The leading edge spike on the current sense signal is almost entirely the result of discharging the energy stored in the MOSFET drain-source capacitance. Every time the MOSFET turns off this capacitance charges to the supply voltage, only to be shorted out the next time the MOSFET turns on. The usual rule of thumb - or, at least, the one I use - is to set the RC time constant of the current sense signal filter to about the same as the drain voltage rise time. For example, a 100 Ohm resistor + 470pF capacitor will likely work well for a rise time in the neighborhood of 50ns.

EDIT - added strikeout to erroneous line but leaving it for posterity.
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: WyverntekGameRepairs on December 11, 2019, 01:57:14 am
Eh, not really. I mean, it's always possible that ringing will disturb the controller IC (particularly with a careless board layout) but the primary concern is passing ElectroMagnetic Compatibility (EMC) testing. The FCC, et al., tend to frown on power supplies that double as AM radio stations.

Ah, okay. Though, just a little off topic, I wonder what a SMPS would sound like through an AM radio  :-DD
I'd probably even be able to take a cheapo / crappy / lossy smps and tune an AM radio around near the power supply until I get the interference emitted by it. It's not very productive, but it would still be interesting to hear the EMI and ringing of a SMPS.

You were in the right track in the first sentence above, then veered off into the weeds  :P...
I thought so, haha. After reading your explaination though, I think I understand much better, especially where I veered off. Now, I am considering the TVS or Zener diode alternative for my power supply's clamping. The lower part count should be better because that means less points of failure. Also, because it is such a simple solution, it would be pretty difficult to screw up. Would there be anything I should note about this solution?

RV201 is for setting the output voltage. BTW - trimmer potentiometers are one of the most unreliable electronic components around so shouldn't be used unless absolutely necessary.
So RV201 IS used for the feedback loop, but it controls the voltage of the output on the 3v line so it INDIRECTLY affects the feedback? That would make the most sense to me, because it would be used to adjust the opto's LED because of the voltage change on the 3V line it's connected to. Just making sure.
Also, in my design, should I use a cermet pot instead of a trimmer pot? Cermets look like they are more precise and reliable than trimmers.

Basically, this scheme blends feedback from the 8V and 3.5V rails together rather than just monitoring one or the other.
Ohhhhh, yeah now that actually makes sense now. And I think that monitoring both outputs is pretty smart, in case one output does something erratic - No matter what output it is, the controller IC will see it and take the proper action. And it is much better than using multiple optos, because less parts = less points of failure.
Though, I still need to know... Is it analog or digital? I'm assuming it is digital, but I could be dead wrong. The way it is being used, it sounds like it is analog.

The leading edge spike on the current sense signal is almost entirely the result of discharging the energy stored in the MOSFET drain-source capacitance
Wait, woah, hold up. Really? I thought that the leading-edge spike was caused by inrush current due to the transformer inductance! I almost entirely forgot about the capacitance of the MOSFET. But this does lead me to the question: Is the damper useful in dampening the inrush current spike from the transformer?

Thanks, it is really fun to learn all of this and it is really helpful in my design process. Dunno how many times I can thank you before we're even, haha. You're extremely helpful, and I seriously cannot thank you enough.
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: T3sl4co1l on December 11, 2019, 02:52:50 am
Ah, okay. Though, just a little off topic, I wonder what a SMPS would sound like through an AM radio  :-DD

BBBBBBBZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

Seriously, in AM radio (medium wave) you may hear errant buzzing from time to time, as you tune across empty(ish) stations.  These are usually EMI from some source or another.

The buzzing -- detected as amplitude modulation, obviously -- arises from the mains frequency ripple (120Hz), which in turn is present directly (the amplitude of the switching is proportional to the supply voltage) as well as through control (the PWM% is varied approximately inversely to supply voltage).

The exact spectrum isn't obvious until you've done a few Fourier transforms, but suffice it to say, it shows up across many bands, the shortwave band (1.8-30MHz) especially.  Sometimes also the VHF band (30-300MHz, including FM broadcast, a few TV channels which may not be all that used anymore?, and a number of important services including air traffic control).


Quote
I'd probably even be able to take a cheapo / crappy / lossy smps and tune an AM radio around near the power supply until I get the interference emitted by it. It's not very productive, but it would still be interesting to hear the EMI and ringing of a SMPS.

The standard procedure is to connect the device to a LISN (Line Impedance Stabilization Network), a filter network which carries low frequencies to a common source (e.g., AC mains) while diverting high frequencies to an RF port (where a receiver can listen in, or an RF source can inject interference intentionally, as the case may be).  That way, you don't have to depend upon random house wiring to radiate (or not) the emissions from the device, you get all of it, broadband.

You can view the result with an oscilloscope; typical levels should be in the <10mV range.  Exactly how much, varies with the pattern of events (due to the type of receiver used: average, peak or quasi-peak).  It can be acceptable to have very spiky yet infrequent events even higher than that, or it can be unacceptable to have constant droning components much less than that (~ <1mV?).


Quote
Wait, woah, hold up. Really? I thought that the leading-edge spike was caused by inrush current due to the transformer inductance! I almost entirely forgot about the capacitance of the MOSFET. But this does lead me to the question: Is the damper useful in dampening the inrush current spike from the transformer?

Actually neither, it's the gate charge.  After all, transistor capacitance is shorted out through itself; where else can it go? :P  Example:

(https://www.seventransistorlabs.com/Images/DCDC_1.jpg)

(https://www.seventransistorlabs.com/Images/DCDC_2.jpg)

UC3842 (3?) as it happens, think it was 12-12V DC-DC.  MOSFET is NDT3055L, current sense resistor 1 ohm I think.  Top waveform is drain voltage, bottom is source (essentially source current).  The current peak is the gate charging.  With a relatively large shunt resistor, and the relatively high gate charge of this antiquated MOSFET, it is easily perceptible.

Other than that, transformer capacitance has the same effect, which isn't very significant in most cases but does depend on the transformer windup, and poorly designed transformers can exacerbate it.

Inductance, such as leakage in the transformer, manifests at the end of the cycle -- overshoot and ringing at turn-off (note the ringing on the rising edge!).

Cheers!
Tim
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: MagicSmoker on December 11, 2019, 10:54:01 am
...
Quote
Wait, woah, hold up. Really? I thought that the leading-edge spike was caused by inrush current due to the transformer inductance! I almost entirely forgot about the capacitance of the MOSFET. But this does lead me to the question: Is the damper useful in dampening the inrush current spike from the transformer?

Actually neither, it's the gate charge.  After all, transistor capacitance is shorted out through itself; where else can it go? :P

Geez, I *know* that but gave the wrong answer anyway. Well, that is another reason for telling the OP to post his questions here rather than PM them to me - a better chance of errors getting corrected.
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: xavier60 on December 11, 2019, 11:51:56 am
Onsemi have a lot for SMPS design information. This one concerns the functioning of the TL431 in the feedback loop. In particular, it points out a not so obvious  feedback path from the secondary rail directly to the opto-coupler. https://www.onsemi.com/pub/Collateral/TND381-D.PDF (https://www.onsemi.com/pub/Collateral/TND381-D.PDF)
There is possible trap to be aware of with the UC3842. If not enough voltage is applied to bring it out of UVLO, the output pin can go Hi-Z allowing the MOSFET's Gate to slowing charge up. As a precaution, put a 10K bleed resistor from Gate to ground.

And this is good way to connect the opto-coupler to the UC3842,
http://uzzors2k.4hv.org/projectfiles/auxsmps/UC3842%20Flyback%20Converter.GIF (http://uzzors2k.4hv.org/projectfiles/auxsmps/UC3842%20Flyback%20Converter.GIF)
The compensation would be better with a series RC.
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: MagicSmoker on December 11, 2019, 01:39:10 pm
I thought so, haha. After reading your explaination though, I think I understand much better, especially where I veered off. Now, I am considering the TVS or Zener diode alternative for my power supply's clamping. The lower part count should be better because that means less points of failure. Also, because it is such a simple solution, it would be pretty difficult to screw up. Would there be anything I should note about this solution?

The RCD clamp is actually much more reliable, and it is much more forgiving of careless component value selection. The TVS voltage needs to be higher than the sum of the maximum reflected voltage from the transformer plus the supply voltage by a good margin in order for the flyback to actually work (otherwise energy isn't transferred to the secondary during the switch off time, it gets burned up in the TVS diode instead). Predicting your next question, the reflected secondary voltage is the secondary voltage multiplied by the turns ratio from secondary to primary. For example, if the secondary is 8V and has 4 turns while the primary has 80 turns then the reflected secondary voltage is 160V. If the primary supply is 170V then the minimum clamping voltage needs to be >330V; the higher the better, within reason, to reset the leakage inductance as quickly as possible.

Upon reading this I realize I probably just gave you more questions to ask than answers, but, well, you're young and have lots of learning to do anyway.

Also, in my design, should I use a cermet pot instead of a trimmer pot? Cermets look like they are more precise and reliable than trimmers.

Cermet is a type of material commonly used for small, board-mount potentiometers which are themselves usually called "trimmers" or "trimpots." Cermet is fairly stable but has a very limited rotational life because it is abrasive. Carbon film is another material commonly used and while it has a good rotational life, it has a terrible temperature coefficient, voltage coefficient (that is, resistance changes with applied voltage!) and initial tolerance. If you need the ultimate in rotational life and stability then conductive plastic is another material option, but its usually found on panel pots because trimpots aren't usually meant to be adjusted that often (indeed, usually a once-and-done thing, as is likely the case here).

Though, I still need to know... Is it analog or digital? I'm assuming it is digital, but I could be dead wrong. The way it is being used, it sounds like it is analog.

The opto is definitely being used linearly, though you are correct in assuming that optos are more reliably devices when used digitally (mainly due to aging - the brightness of an LED at a given forward current declines over time, though with relatively low currents this time is measured in decades).

The leading edge spike on the current sense signal is almost entirely the result of discharging the energy stored in the MOSFET drain-source capacitance
Wait, woah, hold up. Really? I thought that the leading-edge spike was caused by inrush current due to the transformer inductance! I almost entirely forgot about the capacitance of the MOSFET. But this does lead me to the question: Is the damper useful in dampening the inrush current spike from the transformer?

Sorry, I screwed this up by giving the wrong capacitance and mechanism to blame. It is charging up the INPUT capacitance of the MOSFET that causes the leading edge spike in the current sense waveform (plus the reverse transfer - aka "Miller" - capacitance). I honestly don't know how I screwed that up, but T3sl4co1l already caught and corrected it so hopefully no harm done.

Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: WyverntekGameRepairs on December 11, 2019, 11:23:27 pm

The RCD clamp is actually much more reliable, and it is much more forgiving of careless component value selection. The TVS voltage needs to be higher than the sum of the maximum reflected voltage from the transformer plus the supply voltage by a good margin in order for the flyback to actually work (otherwise energy isn't transferred to the secondary during the switch off time, it gets burned up in the TVS diode instead). Predicting your next question, the reflected secondary voltage is the secondary voltage multiplied by the turns ratio from secondary to primary. For example, if the secondary is 8V and has 4 turns while the primary has 80 turns then the reflected secondary voltage is 160V. If the primary supply is 170V then the minimum clamping voltage needs to be >330V; the higher the better, within reason, to reset the leakage inductance as quickly as possible.

Upon reading this I realize I probably just gave you more questions to ask than answers, but, well, you're young and have lots of learning to do anyway.
Hmm, you do have a point. I think it would be best to take the less risky route then and go with the RCD clamp. While it does have more parts to it, it would indeed be more reliable than a TVS or Zener. And because it is more forgiving. I'd rather not have a tiny miscalculation cause a big *boom* on my power supply just because a diode can't handle it.

And yeah I agree, I still got quite a bit to learn. Though I do want to say that honestly, I don't find this as intimidating as most do. The only real difficulty I have is finding out the proper parts and minisicule features/details implemented to make it as efficient, safe, and cost-effective as possible. "But isn't that the whole function of a SMPS?" Yes, but I mean the really down-to-it details, like coupling capacitors and clamps and buffers. The precise art of these devices are the true difficulty. You get one thing wrong, and the entire thing either blows up or one small part blows up and causes an avalanche effect throughout the rest of the unit.

But hey, if it doesn't kill you, then I guess it is considered a learning experience! If it does kill you... Well, then not so much a learning experience, and more of a being-dead experience.

Also, thanks for defining the reflected voltage. That'll really come in handy later on while designing my power supply.
Cermet is a type of material commonly used for small, board-mount potentiometers which are themselves usually called "trimmers" or "trimpots." Cermet is fairly stable but has a very limited rotational life because it is abrasive. Carbon film is another material commonly used and while it has a good rotational life, it has a terrible temperature coefficient, voltage coefficient (that is, resistance changes with applied voltage!) and initial tolerance. If you need the ultimate in rotational life and stability then conductive plastic is another material option, but its usually found on panel pots because trimpots aren't usually meant to be adjusted that often (indeed, usually a once-and-done thing, as is likely the case here).
The reason I need a stable pot is actually for the prototype. Once I find the right value that I'll need, I will replace it with a regular cermet pot or trimmer pot on the manufactured boards' design. Now that you mention it, I think for the prototype boards I'll use that conductive plastic alternative you mentioned (because I'll probably be making quite a few adjustments). Do you have any suggestions on where I can find such potentiometers?

The opto is definitely being used linearly, though you are correct in assuming that optos are more reliably devices when used digitally (mainly due to aging - the brightness of an LED at a given forward current declines over time, though with relatively low currents this time is measured in decades).
Ah, that does clear it up a bit more. You know, this reminds me, I'm having a bit of interference in my PS1's audio. I think it could be caused by the power supply being noisy due to an aging opto. I've tried adjusting the trimpot, but it doesn't really help too much. Should I replace the opto with a new one? I'm guessing it is the opto because what I think is happening is the feedback from the opto is becoming a little too inaccurate due to the fading from age. The inaccuracy causes errors in the calculations of the PWM controller, and causes noise in the transformer which is transferred to the secondary side, and (despite smoothing capacitors) causes noisy voltage on the output.

Sorry, I screwed this up by giving the wrong capacitance and mechanism to blame. It is charging up the INPUT capacitance of the MOSFET that causes the leading edge spike in the current sense waveform (plus the reverse transfer - aka "Miller" - capacitance). I honestly don't know how I screwed that up, but T3sl4co1l already caught and corrected it so hopefully no harm done.

Ohhhhhhhh. Okay. Yeah, that does make much more sense. Though, I would think that capacitances between any given pins on the MOSFET could be causing something like this... But looking at Tim's diagram, I'm seeing both of yours' points now. The visual representation really helps, thanks Tim :D
And yeah, no harm done :)
Title: Re: Help needed for DCM SMPS using uC3842AN
Post by: station240 on December 11, 2019, 11:26:22 pm
To me it looks like R120 6.8M ohm between neutral and GND is to make up for the lack of earth on the mains side, and to allow a smaller value for the class Y cap.
Given it takes 20mA to get a dangerous shock, you'd need 136,000V across that 6.8M ohm.

Usually the class Y capacitor is 2.2nF, instead of 1500pF (for C103), for this style of PSU. So that 6.8M is used to reduce that.

Also need to specify safety rated parts for:
C103 - class Y 2kv or 3kv cap
C101 - class X2
R120 - 1KV or higher rated.