# LTspice model of the UC3845 oscillator

I have a circuit whose the purpose is to reduce the EMI by "moving" the switching frequency around a value. I would like to understand how this circuit affects the switching frequency, i.e. how it affects the oscillator frequency of the UC3845. For this, I need to understand how the UC3845 is working. Finally I would like to do an FFT for seing how it change the frequency spectrum.

Here is the datasheet: https://www.mouser.fr/datasheet/2/308/UC3844B-D-1814882.pdf

According to the datasheet the frequency is set according to a capacitor Ct and a resistor Rt. It is mentionned that the "capacitor Ct is charged from the 5.0 V reference through resistor Rt to approximately 2.8 V and discharged to 1.2 V by an internal current sink." I can predict the charging time of the capacitor but with the informations given I can't predict what would be the discharging time... as I do not know the sink current. Apparently the sink current or the capacitor depends on the deadtime that we want to have." During the discharge of Ct, the oscillator generates an internal blanking pulse that holds the center input of the NOR gate high. This causes the output to be in a low state, thus producing a controlled amount of output deadtime" The output is the pin linked to N MOSFET. So it is opened. Well, I though "deadtime" was the time when the energy in the inductor is null, it is only possible in DCM. Nevertheless in the datasheet it seems to mean that the MOSFET is just OFF. Did I do a mistake?

What is interesting, or (what I learnt) is that the resistor Rt and the capacitor Ct do not only set the switching frequency but also the deadtime.

Nevertheless, I do not know how to model the oscillator without knowing the current drawn from the capacitor by the current sink. That's why i am looking for an LTspice model of this IC.

Thank you very much and have a nice day!

Since you're aiming to make a model for an IC, I'd recommend you go the behavioural way. You could implement a real current source, discharge, proper elements, but the simulation will just go much slower for virtually the same results.

This is a behavioural version for an oscillator I made once for the venerable TL494. It can be configured based on external R and C, with a frequency f=1.2/(R*C) (which can be changed), with variable blanking time set by the a parameter, and with adjustable peak voltage set by Vpk.

The nodes R and C are the external pins, and rst is the blanking pulse. Rt and Ct don't need to be defined with a .param, but like this they are there for automatic frequency calculation (shown on V1, not needed) and measuring purposes, which show that the method is pretty accurate. This can be simplified to work without I1 and R1, different configurations (charge from Vref, discharge to ground), etc. This is one option out of many, it gives you an idea (or more).

As a final note, unless your aim is to "get dirty" with modeling, I'd recommend to search the net for already existent models, which may be made by people who are likely to know more than you about these things. If it were me, I'd recommend to search the LTspice group, in the Files section (you'll have to register, no money needed though). I seem to recall models for these PWM ICs in there.

Looking over the datasheet you linked, it looks like there's no mention of the internals of the oscillator, but if you search for the datasheet from TI (for example), it says that there is an internal threshold of ~2.7V, and the pk-pk oscillator waveform is ~1.7V. It also says that the discharge current is ~6mA.

However, in your datasheet (which is taken from OnSemi), it depicts the waveforms of the oscillator, where it clearly shows that the charge/discharge is not made with constant current. That the charging is not constant, it's obvious since Rt goes from Vref to RT/CT pin, but the comment on the 6mA discharge in the TI datasheet seems to be misleading.

With these in mind, here's an adapted version which is not accurate, but works:

V1 shows (in green) the frequency that should have been, according to TI's datasheet (f=1.72/(RC)), and the error log shows the measured frequency. It's ~10% difference, and you could set some lower/upper thresholds, maybe a larger discharge resistance for the switch, and you could get closer. If you really want this path, by all means, have fun.

• Forgot to say that if you want to go with what TI is saying then Ron for the switch sould be set to 2.6 V / 6 mA ~ 433 Ohm. Commented Apr 26, 2020 at 21:34
• Thank you for this really nice analysis and your time ! :) I will try to have fun with it :) Have a nice day !
– Jess
Commented Apr 27, 2020 at 9:34
• Just a question about the sink current, you consider that the current drawn cannot be constant as the slope of the discharging voltage of the capacitor is not constant ?
– Jess
Commented Apr 27, 2020 at 9:39
• @Jess Yes, if it would have been a constant current, then the voltage would have been a ramp (positive or negative), but neither the charging or the discharging waveforms show any constancy. If the datasheet shows the wrong waveforms, then my assumption is wrong, and you can replace the VCSW with a VCCS, but only for discharging. The charging is clearly done from the Vref pin which supplies a constant voltage, not current, so the charging is the familiar 1-exp(-x). Commented Apr 27, 2020 at 10:27
• The ic=0 flag means that the voltage across the cap is zero at the simulation start, when the solver tries to solve for the DC operating point. Due to the way LTspice works, it will either complain about an open-endedness for the current source (in the 1st case), or it will add a default Rpar (usually Gmin), and that results in a proportional voltage, or it will make such that the voltage is 5 V, since caps are supposed to be open circuit in DC. That can result in the Schmitt not triggered, and the circuit not oscillating. ic=0 forces a start without changing the other elements. Commented Apr 27, 2020 at 10:33