3
\$\begingroup\$

I'm trying to model a low frequency LED flasher based on a BEAM Pummer (basically a pair of CMOS inverters wired as an oscillator, plus a charge pump) in LTspice. I have the base flasher circuit attached to a voltage source and LED output, and it seems to be working correctly, producing ~40mA current spikes through the LED every ~2s or so.

But when I try to make a .subckt definition with the flasher part only, and include that in a test circuit, it doesn't work correctly: I get a noisy µA-level output through the led wired to the output pins for a few ns, then the oscillator locks up.

  • The SPICE error log reports Singular matrix: Check node d:u1:6#int1 Iteration No. 19 which doesn't show up with the standalone version. I'm not sure how to find node d:u1:6#int1.
  • My initial guess was that a GND connection wasn't being made properly, but I tried to pass a ground reference through an external pin several different ways and it didn't made any difference.
  • There's a quirk in that I need to use a PULSE voltage supply with 100% duty cycle rather than a steady DC voltage in the standalone version, or the oscillator won't start. Could this be related? Setting the test circuit's voltage to PULSE didn't seem to make any difference.

What else might I be doing wrong? I've triple checked the .subckt netlist pin order against the order defined in the symbol file, and I'm pretty sure it's correct. The docs tell me that GND should already be globally connected. Is it a startup thing? Two inverters are wired in a chain to make the oscillator, do I need to explicitly set the input of one to 5V and the other to 0V at startup?

For reference, there's a zip file here containing the test schematic and the .sub and .asy definitions, as well as the standalone version of the flasher subcircuit to prove that it does actually work.

Any help greatly appreciated!

\$\endgroup\$

1 Answer 1

9
\$\begingroup\$

To answer my own question: it seems LTspice requires text files to be saved with Windows Latin 1 code page, CRLF line endings. I'm using Wine on a Mac, and my text-editor saves as UTF-8 by default. I'm guessing LTspice misinterprets the UTF-8 µ on capacitor values as something invalid, but confusingly doesn't throw an error message.

\$\endgroup\$
12
  • 2
    \$\begingroup\$ Considering that SPICE is a (quite old) computer language, replacing of u with µ causing problems is probably not too surprising. \$\endgroup\$
    – XTL
    Commented May 6, 2013 at 15:17
  • 2
    \$\begingroup\$ LTSpice is picky about units. For instance, if you want to use megohms, you have to spell the units just right, otherwise it silently substitutes another resistance that is orders of magnitude off. It doesn't accept M, just Meg with a capital M. \$\endgroup\$
    – Kaz
    Commented Nov 19, 2013 at 6:11
  • 2
    \$\begingroup\$ @Kaz, it's not a bug, it is simply a consequence of the fact that SPICEs are (historically) CASE INSENSITIVE. That's why a "compromise" had to be chosen to distinguish these common well known shorthands for "milli"(m) and "mega"(M). One must simply reconcile with it... \$\endgroup\$
    – Eric Best
    Commented Apr 3, 2015 at 19:25
  • 2
    \$\begingroup\$ @EricBest: Ever accidentally wrote 10mig or 10mug or 10mfg or similar for a resistor value? It will be interpreted as 10 milli. This is a usability bug, unless you say that error reporting is not needed and whenever you get something wrong in your .asc file nasal demons are a proper consequence. \$\endgroup\$
    – PlasmaHH
    Commented Oct 21, 2015 at 14:33
  • 2
    \$\begingroup\$ OMG the penis waving here as astonishing. \$\endgroup\$
    – damian
    Commented Oct 23, 2015 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.