News for hackers. Stuff that matters.
Re:Prototype to production: How to build and design a PCB pr... by madez on Tuesday March 06, 2018 @09:30PM (#16533882)
Is there free software to create and simulate virtual populated PCBs? Fritzing allows creation, but it doesn't simulate the board.

For simulation one needs the exact behaviour of all parts. That excludes board with parts that have a closed design, or insufficient documentation. But for many parts, and hopefully soon with CPU-ICs thanks to RISC-V, we can do simulation.

I don't expect real-time simulation, but at least a solution for letting the machine compute over night to see if the board successfully does X.

Any suggestions? Is this a problem waiting for a solution?

Re:Prototype to production: How to build and design a PCB pr... by monocasa on Tuesday March 06, 2018 @09:32PM (#16533888)
You can do SPICE simulation with pretty much any CAD. I'm pretty sure that Eagle can do that.

Edit: not sure why I got drive by downvotes.

https://www.autodesk.com/products/eagle/blog/spice-simulatio...

Edit2: for KiCAD http://mithatkonar.com/wiki/doku.php/kicad/kicad_spice_quick...

Re:Prototype to production: How to build and design a PCB pr... by madez on Tuesday March 06, 2018 @10:11PM (#16533996)
I'd like to for example create a PCB with some sensors, LEDs, and a microcontroller, specify the sensor input over time and the software on the microcontroller, and let the computer figure out the behaviour of that system, so it can tell me state of the system (i.e. what LEDs are on, or what values are in the registers of the microcontroller?) at a given time. For performance reasons, that would require both low-level simulation (electrics) and high-level simulation (software on the microcontroller) simultaneously in a compatible way. Can SPICE do that?
Re:Prototype to production: How to build and design a PCB pr... by jimmyswimmy on Tuesday March 06, 2018 @11:01PM (#16534160)
SPICE can do a lot, but you're asking a LOT. Modelling internal states of a micro is generally a different package than the mainly analog simulation that SPICE does. It is rare for them to be tied together.

Practically speaking, your interface ought to be separate enough that you can define the range of states the micro's inputs should see, and the range of outputs it should drive, and separate the two. There are times when I've wished for a combined simulation but it wasn't worth the hassle to set it up. Honestly for the accuracy I expect I usually prefer to just build the thing rather than simulate it.

LEDs are really boring to model anyway.

Re:Prototype to production: How to build and design a PCB pr... by madez on Wednesday March 07, 2018 @04:43AM (#16535298)
I also think that I ask for a lot. And I know that simulation is hard, error-prone, and often more expensive than just buillding the real system. However, building the system does not always give the insight that a simulation can give, and it's sometimes prohibitively expensive. More specifically, I already had built the system, but I couldn't get the information out of it without disturbing it too much. That's why I wanted to simulate it.
Re:Prototype to production: How to build and design a PCB pr... by stephen_g on Wednesday March 07, 2018 @12:18AM (#16534419)
A full logic simulation of a processor can be done from VHDL or Verilog code in software, but cycle accurate simulations are many, many orders of magnitude slower than a real IC.

You can set up testbench code that feeds in data and stuff, and link different stuff together digitally. I don't know if there's much in the way of analogue simulators like SPICE hooked up to logic simulators though.

The next level down is to run it up on an FPGA, which is only a few orders of magnitude slower than you can clock an IC.

Re:Prototype to production: How to build and design a PCB pr... by jononor on Wednesday March 07, 2018 @04:27AM (#16535254)
Combined software/MCU and circuit simulation is, as far as I know, not really existing in the FOSS world. I would loove to be proven wrong on this. Several times I've considered building my own...
Re:Prototype to production: How to build and design a PCB pr... by madez on Wednesday March 07, 2018 @04:55AM (#16535347)
I'm thinking about what would be necessary for it. It seems doable to me. First, one would need to separate the simulation into different domains, define interfaces between them, and then figure out appropiate time stepping for the simulation so the domains are properly coordinated. Depending on how low-level the simulation needs to be, getting the needed data for the parts might be problematic. However, when that data isn't available, then maybe the simulation can just randomly create plausible values, and do the simulation for these values. In reality, every part has slight variations so every board is unique too, when inspected closely enough.

There is also a lot of merit in a simulation even if it can't go very deep, say, considering quantum mechanical effects inside the IC's. That may be practically impossible due to unknown data, or just give impractical performance. But there are a lot of use-cases that don't need that level of detail.

What level of detail is realistically possible? If we know that a certain level of detail is too slow to simulate, then writing a simulator for a higher level is easier and we need less data for the models.

Re:Prototype to production: How to build and design a PCB pr... by jononor on Thursday March 08, 2018 @01:37PM (#16546505)
I would be fine with even needing to modify the MCU code to use the simulator APIs in the Hardware Abstraction Layer - then no MCU emulation needed at all. So then essentially this needs to push/pull data in from the SPICE domain for the circuit simulation part. It should be possible to reuse an exiting simulator there, hopefully.
Re:Prototype to production: How to build and design a PCB pr... by aidenn0 on Tuesday March 06, 2018 @11:06PM (#16534179)
It seems I need pspice to use any of the vendor models though (or LTSpice if I stick to LT only parts).
Re:Prototype to production: How to build and design a PCB pr... by esmi on Tuesday March 06, 2018 @11:52PM (#16534325)
Instructions for adding a 3rd party model to LTSpice

http://www.linear.com/solutions/4678

Re:Prototype to production: How to build and design a PCB pr... by rrmm on Wednesday March 07, 2018 @12:24AM (#16534453)
I don't know if it's generally that useful (in my experience). There are usually too many things one doesn't know: Many parts don't have models, or the right kind of models, and it can take more time and effort than it's worth to set up the simulation.

Simulation is usually more useful when you have very specific questions about small parts of your circuit. Questions like will the oscillator start up under the full temperature range, or what's the phase margin of my analog front end.

Big exception to this is FPGAs and other programmable logic where a major portion of one's time is spent specifying, simulating, and verifying a design in software. This can also include software/hardware co-simulation. But the toolchain for doing this is usually furnished by the silicon vendor.

Another place simulation pops up more often is in power supply design and RF parts. TI, LT and other vendors have specialty software and wizards to simulate common designs. This is basically an extension of reference designs and demo boards.

Re:Prototype to production: How to build and design a PCB pr... by Aser on Wednesday March 07, 2018 @08:06AM (#16536068)
Proteus (https://www.labcenter.com/simulation/) can do this, but it's not free. It's really great though, you just draw out your circuit, load in your compiled firmware and it will simulate it all.