2
\$\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\$
7
\$\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\$
  • 2
    \$\begingroup\$ Considering that SPICE is a (quite old) computer language, replacing of u with µ causing problems is probably not too surprising. \$\endgroup\$ – XTL May 6 '13 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 Nov 19 '13 at 6:11
  • 1
    \$\begingroup\$ @EricBest This is a bug because in electronics shorthand we distinguish M and m. If I see 2M next to a resistor on a schematic, that to me means two million ohms, not two milliohms. It's fine to treat Meg, MEG and meg as equivalent, but not M and m. \$\endgroup\$ – Kaz Apr 3 '15 at 17:01
  • 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 Apr 3 '15 at 19:25
  • 2
    \$\begingroup\$ OMG the penis waving here as astonishing. \$\endgroup\$ – damian Oct 23 '15 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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