I attempted running a phase margin (for an asynchronous buck converter) test but I get the following error:
Here is the schematic:
Asynchronous_Buck_Converter_Compensator_Type_III_2z3p_v1.qsch (23.8 KB)
I added 1 nf capacitors across all switching devices in an attemp to rectify the issue. To no avail.
from your screen capture, you must be running .bode, but not the schematic you attached (your attachment is .tran, and not properly set multiple text boxes to comment yet.
Do you have a B-source with delay() function somewhere in the schematic you currently working on?
Hi,
no, I do not have any B-sources in my schematic.
The schematic does not have “.tran x”. It only has the following spice directives:
.bode V5 500e-6 1 1e5 1 .options BODEAMPFREQ=0
.meas Fbw find freq when Mag(OpenLoopGain)=1
.meas PhaseMargin find Phase(OpenLoopGain) at Fbw
Update:
Btw, this is the asynchronous buck converter version. In an earlier post, I provided the synchronous buck converter version. For that one, I kept getting a this error:
Fatal error: Timestep too small (1.2342 e-12)
After looking around the net, I came upon a post where they suggested putting a small capacitance in parallel with switching devices. This appears to have alleviated that particular error. However, then I ended up getting the same error as I am getting up above.
I attempted editing the prior submission but the forum locked it out. I guess this forum is very delicate.
I noticed that this is a well known issue since the posts that I came upon were from ~2024 timeline. Any plans to modernize it?
I came upon a post where someone mentioned that the algorithm from Simplis is very good and much faster (a few seconds vs a few minutes for QSpice). Do you think that QSpice will adopt it or similar?
I mean you upload a wrong schematic…
Doh! Sorry. I must have forgottent to press “Save” when I made the changes. I will edit the original post.
It depends on your trust level in this forum. There were spammers before, so Qorvo IT enhanced their policy.
highlight all thing that help to properly setup a .bode and this is final result.
normally we need monitor transient test result from .bode with debug option, don’t go too crazy for Fstart and Fstop, you possibly run out system memory start from 1Hz for a SMPS at 250kHz switching.
Asynchronous_Buck_Converter_Compensator_Type_III_2z3p(.bode).qsch (24.7 KB)
1 Like
Another thing you can do is to run FRA measurement using either my library in ANR Q-lib or Kelvin’s library.
These two library perform the bode computation during simulation run time instead of post processing, and it doesn’t require any waveform(qraw) to be stored. As long your sim is stable, you can measure any freq range from 0.1 Hz to 1MHz if you are patient enough to wait for the sim complete.
Thank you for very much for workig this out.
-
Ok, I will not start from 1 Hz. With regard to using 1V, I was referencing Marco’s video where he used 1V in his simulation with no issue but will otherwise use 20 mV from now on.
-
Ok, got it. I will specifically define the Vpert in/out terminals in the QSpice directives. I will also ensure to have the positive terminal on the compensator top side and the negative termimal on Vout.
-
If you recall, I added a ramp for soft-start to minimize the overshoot at turn on for the step-response test. But for frequency response tests, I will disable or remove this feature.
-
I do not see in the directives where you specifically defined Fb/Vout yet it measured the phase margin. Can you please elaborate on this last point.
Btw, the simulation results are a bit different from what I had simulated using Python as per the following figure. As you can see, the PM =~ 60deg. and the crossover freq.=~ 577203 rad/s or ~97 kHz.
Thank you a bunch again. You have been awesome with your help in getting me up and running. Very much appreciated! 


I am new to QSpice (a couple of days) so I am not familiar with these topics. Can you please elaborate on these points and point me (provide links) as to where I can look up this information. I am familiar with Kelvin’s github only btw.
Please define ‘patient’ because as is, the simulations already take a couple of minutes to run.
Much appreciated.
I created guideline for .bode. Note that the perturbation signal amplitude often needs to vary depending on the scenario. As a rule of thumb, the signal should be large enough to generate measurable input/output responses, but small enough to maintain small-signal loop operation. In fact, you often need different amplitudes across different frequencies. My guide explains how to set this up.
Frequency Response Analysis (.bode) Study Guide - QSPICE - Qorvo Tech Forum
1 Like
Your equation already calculates the phase margin. Typically, phase margin is measured from the phase reading to -180 degrees for the open-loop transfer function (-Vout/FB) [I made a mistake mentioned as -FB/Vout, just upload a corrected version). Since .bode gives us Vout/FB, that -180-degree shift is already included, so your formula reads the phase margin correctly.
Is this Bode plot based on a continuous conduction mode (CCM) or discontinuous conduction mode (DCM) buck converter? You are currently operating your buck converter in discontinuous mode to measure the loop gain.
This is more general. I calculated the transfer function of the filter circuit and treated it as the plant. I then used the compensator values for this plant and performed the simulation.
But the plant of switching mode power supply include the switch, typically use state-space averaging method for small-signal transfer function. Transfer function is different when operates at CCM and DCM.
1 Like
Thank you for the insight. I am not familiar with this detail. I will have to do some research on this.
Please define ‘patient’ because as is, the simulations already take a couple of minutes to run.
Much appreciated.
A few minutes is considerably fast. I once need 2hrs to run bode for my circuit (multiphase interleaved), and many people used to need half a day…
1 Like
Awesome!
Thank you for looking out. I will add these links to my go to list. 
Much appreciated.

What simulator were you using? That seems to laborious.