I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but whenever I get close it stalls or throws convergence errors.
So I wrote a PowerBasic program that's the 32-bit NCO... GC_Num.exe.
Making a proper .WAV file would be a nightmare, so it outputs as a
text file with just time data per line, where data is the
selected number of MS bits of the phase accumulator.
LT Spice can read the file, and then do whatever it wants: sine, DAC,
filter, comparator, FFTs.
https://www.dropbox.com/scl/fo/o0mdxxqvxupg6ynz7i7rx/AMPMbv9NOY4mJFXggTGUqJ8?rlkey=9ecl38npbgy8kxuzd9bako4kr&dl=0
Spice reads the file as a piecewise-linear thing, so wrecks the nice
MSB data steps. I had to fool it by outputting each clocked phase
accumulator value twice, as
bits time
bits time+0.9*clock_period
same data bits both lines. Looks pretty steppy.
On 12/11/24 03:38, john larkin wrote:
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but
whenever I get close it stalls or throws convergence errors.
So I wrote a PowerBasic program that's the 32-bit NCO... GC_Num.exe.
Making a proper .WAV file would be a nightmare, so it outputs as a
text file with just time data per line, where data is the
selected number of MS bits of the phase accumulator.
LT Spice can read the file, and then do whatever it wants: sine, DAC,
filter, comparator, FFTs.
https://www.dropbox.com/scl/fo/o0mdxxqvxupg6ynz7i7rx/AMPMbv9NOY4mJFXggTGUqJ8?rlkey=9ecl38npbgy8kxuzd9bako4kr&dl=0
Spice reads the file as a piecewise-linear thing, so wrecks the nice
MSB data steps. I had to fool it by outputting each clocked phase
accumulator value twice, as
bits time
bits time+0.9*clock_period
same data bits both lines. Looks pretty steppy.
On Linux, we have 'sox' that can convert between time-value
pairs and .wav in either direction. I suppose there must be
a Windows version. I suspect the piecewise-linear problem
will still be there.
As for the convergence problems: LTspice doesn't like
discontinuities. Jim Thompson approximated everything with
smooth functions. His favourite was tanh.
Jeroen Belleman
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but whenever I get close it stalls or throws convergence errors.
On 11-12-2024 03:38, john larkin wrote:
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but
whenever I get close it stalls or throws convergence errors.
I think you have the funds to buy Cadence Pspice. It has auto
convergence build in. It's seldom I see problems with convergence after
they added that feature.
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but >whenever I get close it stalls or throws convergence errors.
So I wrote a PowerBasic program that's the 32-bit NCO... GC_Num.exe.
Making a proper .WAV file would be a nightmare, so it outputs as a
text file with just time data per line, where data is the
selected number of MS bits of the phase accumulator.
LT Spice can read the file, and then do whatever it wants: sine, DAC,
filter, comparator, FFTs.
https://www.dropbox.com/scl/fo/o0mdxxqvxupg6ynz7i7rx/AMPMbv9NOY4mJFXggTGUqJ8?rlkey=9ecl38npbgy8kxuzd9bako4kr&dl=0
Spice reads the file as a piecewise-linear thing, so wrecks the nice
MSB data steps. I had to fool it by outputting each clocked phase
accumulator value twice, as
bits time
bits time+0.9*clock_period
same data bits both lines. Looks pretty steppy.
On Wed, 11 Dec 2024 14:07:45 +0100, Klaus Vestergaard Kragelund <klauskvik@hotmail.com> wrote:
On 11-12-2024 03:38, john larkin wrote:
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but
whenever I get close it stalls or throws convergence errors.
I think you have the funds to buy Cadence Pspice. It has auto
convergence build in. It's seldom I see problems with convergence after
they added that feature.
LT Spice is usually pretty good. It just didn't like my trying to make
a 32-bit phase accumulator with an analog circuit.
I once fixed a convergence problem by adding one resistor to the
circuit. 1K, one ended grounded, the other end open.
LT is horrible with digital stuff. Imagine making a 32-bit phase
accumulator with its parts. There isn't a screen big enough.
Qspice is I hear better at mixed-signal sims.
I can always have one of my kids Matlab the hard stuff.
On 11-12-2024 17:49, john larkin wrote:
On Wed, 11 Dec 2024 14:07:45 +0100, Klaus Vestergaard KragelundIf you buy Pspice Advanced, you can run c++ code in each time step, or whatever timestep you like. I am doing that to simulate a digital SMPS
<klauskvik@hotmail.com> wrote:
On 11-12-2024 03:38, john larkin wrote:
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but
whenever I get close it stalls or throws convergence errors.
I think you have the funds to buy Cadence Pspice. It has auto
convergence build in. It's seldom I see problems with convergence after
they added that feature.
LT Spice is usually pretty good. It just didn't like my trying to make
a 32-bit phase accumulator with an analog circuit.
I once fixed a convergence problem by adding one resistor to the
circuit. 1K, one ended grounded, the other end open.
LT is horrible with digital stuff. Imagine making a 32-bit phase
accumulator with its parts. There isn't a screen big enough.
Qspice is I hear better at mixed-signal sims.
I can always have one of my kids Matlab the hard stuff.
in spice
On Tue, 10 Dec 2024 18:38:18 -0800, john larkin <JL@gct.com> wrote:
I have been unsuccessful in getting LT Spice to simulate a DDS
frequency generator. It's bad enough trying to make the NCO part, but
whenever I get close it stalls or throws convergence errors.
So I wrote a PowerBasic program that's the 32-bit NCO... GC_Num.exe.
Making a proper .WAV file would be a nightmare, so it outputs as a
text file with just time data per line, where data is the
selected number of MS bits of the phase accumulator.
LT Spice can read the file, and then do whatever it wants: sine, DAC,
filter, comparator, FFTs.
https://www.dropbox.com/scl/fo/o0mdxxqvxupg6ynz7i7rx/AMPMbv9NOY4mJFXggTGUqJ8?rlkey=9ecl38npbgy8kxuzd9bako4kr&dl=0
Spice reads the file as a piecewise-linear thing, so wrecks the nice
MSB data steps. I had to fool it by outputting each clocked phase
accumulator value twice, as
bits time
bits time+0.9*clock_period
same data bits both lines. Looks pretty steppy.
Given a 40 MHz phase accumulator, one could spin up a clock at some
mutiple, 160 MHz maybe, and fake the dac/lowpass/comparator thing to
reduce jitter.
I think it's just a lookup table on some MSBs of the 40 MHz phase accumulator. Of course the new fake DDS clock output would be
quantized to the 160 MHz clock domain. Maybe.
The "RF" mindset, that one has to do the sine and dac and hi-rent
lowpass filter and comparator, is not only a bunch of work and
expense, it gets really nasty at low frequencies.
On 11/12/2024 9:31 pm, john larkin wrote:
The "RF" mindset, that one has to do the sine and dac and hi-rent
lowpass filter and comparator, is not only a bunch of work and
expense, it gets really nasty at low frequencies.
Then don't do it at low frequencies. Do it at 2^N times the low
frequency that you want, and then after the comparator divide by 2^N.
On Fri, 13 Dec 2024 21:17:13 +1100, Chris Jones
<lugnut808@spam.yahoo.com> wrote:
On 11/12/2024 9:31 pm, john larkin wrote:
The "RF" mindset, that one has to do the sine and dac and hi-rent
lowpass filter and comparator, is not only a bunch of work and
expense, it gets really nasty at low frequencies.
Then don't do it at low frequencies. Do it at 2^N times the low
frequency that you want, and then after the comparator divide by 2^N.
I think that can be done, but very carefully. We need long-term phase >coherence to simulate a complex geared machine, and we need frequency
changes to happen at a selected phase angle, like top-dead-center of
some waveform of some part of a mechanism.
Using the MSB of the phase accumulator is sure appealing. Going
off-chip to a DAC and a filter and a comparator adds time lag and
jitter.
Most DDSs are RF oriented so don't care about time. Maybe some exotic
radars would.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 415 |
Nodes: | 16 (2 / 14) |
Uptime: | 41:54:10 |
Calls: | 8,722 |
Calls today: | 5 |
Files: | 13,276 |
Messages: | 5,957,027 |