Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Software Defined Printed Circuit Boards
Jonathan Bachrach
EECS UC Berkeley
August 25, 2016
Today 1
introductionJITPCBcourse info
Software Defined Printed Circuit Boards“Circuit Board Design for Programmers”
Prof Jonathan Bachrach with Richard Lin @ EECS
Do you want to
make this on this in code?
Have you ever wanted to design a circuit board but were intimidated?
Have you been frustrated by the tedium of circuit design apps?
Are you a programmer and want circuit board design to be like software design?
Do you want to design boards at the speed of rapid fabrication?
Well this class is for you...
CS194/294-126upper div / grad / studio / project class
Fall 2016, TuTh 10-11:30a, Jacobs 2204 Units: 3 hr lecture and 3+ hrs lab time / week.
http://www-inst.eecs.berkeley.edu/˜cs194-126
“making the easy things easy and the hardware things software”
Context 2
Industrial Revolution of Personalized Fabricationcheap fabbing – 3D Printers + laser cutters + milling machinescheap and available parts – sparkfun, adafruit, seeed studio, ...standard interfaces – arduino, mbed, etccollective development – makerspaces
The Economist
Motivation 3
IoT Roboticsgood work labs Utah Valley University
Problem 4
Current Design Flows aretime consuminginaccessibly complicatednot reusable
Situation:idle printersdomain experts without access to fabrication
Solution 5
High level design with software generatorsUse software to define hardware and software
Becausehighly parametricmassive reuseabstract away low-level detailseasy design space explorationextreme integration across EE and CS (and ME)
JITPCB Abstract 6
Declaratively design embedded systems
Inputslist of peripheralsapplication in C++
Outputs(multiple) board filescompiled firmwarenetworking layer
JITPCB Movie 7
Current Breadboard Prototyping 8
ungainly formatfragilemanual and error prone efforts – pin conflictsdoesn’t scale
Current Modular Circuit Prototyping 9
modular spaghetti and expensearduino frankenboards – why have interfaces? supports modulesno perfect premade modulesstill manual and error prone efforts – pin conflictsdoesn’t scale
lilbits gadgeteer arduino
Current PCB Design + Fabrication 10
CAD is tedious and only WYSIWYGfabrication is slow and expensive
Enter OtherMill or MCB 11JIT manufacturing – mills blank copper boards while you waitproduces structurally sound electronics in desired form factorsrelatively inexpensive (approx $3000 for mill and $5 for boards)20 in2 / hour1 or 2 layers and no solder mask for nowstill requires labor intensive Eagle design
OtherMill vs Alternatives (or MCB vs PCB) 12
othermill is an order of magnitude lower cost and time
Chisel is ... 13
Best of hardware and softwaredesign ideasEmbedded within Scala languageto leverage mindshare andlanguage designNot Scala -> VerilogAlgebraic construction and wiringHierarchical, object oriented, andfunctional constructionAbstract data types and interfacesBulk connectionsMultiple targets
Simulation and synthesisMemory IP is target-specific
single source
CPUC++
FPGAVerilog
ASICVerilog
Chisel
multiple targets
Methods 14
SOB architecturestanzahardware descriptionsoftware model
SOB Architecture 15
TemplatePeripheralsIO processors
one master and rest slavesperipherals attach to pins
NetworkBenefits
Modular and ScalableEasier SW and Routing
M IOP
P P P
P P P
S IOP
P P P
P P P
S IOP
P P P
P P P
S IOP
P P P
P P P
S IOP
P P P
P P P
S IOP
P P P
P P P
S IOP
P P P
P P P
S IOP
P P P
P P P
S IOP
P P P
P P P
Stanza* Essence 16
best of scripting and production languageseasy to understand and powerful to usegradual types -> easy parameteric types
simple orthogonal conceptsfunctions, objects, pipes, and namespace separateduse concepts in unlimited ways – serendipityentire language including optimizing native compiler in 20K LOC
powerful macros for conventional syntaxalmost entire stanza syntax written as macrosbetter DSL hosting language
* developed by Patrick Li @ EECS Berkeley
Stanza by Contrast 17
like Python buttypes and on and on and on ...
like Scala butthinner – native compiler + runtime in 20K LOCsimpler – fewer base conceptsmore separated – orthogonal functions / objects
like Clojure butconventional syntax – love the parens but ...thinner – nativemore powerful macro system – not just name macros
like Dylan butimproved gradual types – parameteric typesbetter multimethod namespaces – fewer name clashesmore powerful macros – syntax written in ithas pipes – generalized control flow mechanism
Hardware Description 18
componentsmoduleslayoutautorouter
Component Description 19
Component Descriptions:
defcomponent LED ("LED", "LED5MM") :pad Apad K
defcomponent Resistor ("RCL", "0204/7") :pad 1pad 2
Module Description:
defmodule PullUpLED () <: Module:;; interfaceinherit gndinherit v3sig io;; subcomponentsmod l : LED("red")mod r : Resistor("1k");; netlistssig up = [r.1, l.A]sig v3 = [r.2]sig gnd = []sig io = [l.K];; layoutlay HBox([Rot(r,90), Rot(led,90)], 1.0)
Software Model 20
mBEDdriversvirtualized peripherals – RPC callsbootloader
MBED 21
C++ Object Oriented Library for EmbeddedARM consortium and works across chips / boardsStandard and nicely designed
I2C master(SDA_PIN, SCL_PIN);
master.frequency(I2C_FREQ);
master.read(SLAVE_ADDR,(char*)&SW1_dat,1);
master.write(SLAVE_ADDR,(const char*)&LED1_dat,4);
DigitalIn SW0_dev(PTB1);
PwmOut LED0_dev(PTB10);
SOB Programming 22
Peripheral Interface (Stanza):
defn bool_out (name:Symbol, hw:Symbol -> PeripheralModule) :Peripheral(name, "BoolOut", hw,[Pin(‘DigitalOut, pad#io)],[Port("value", IntType(0))])
Peripheral Interface (C++):
// Automatically generated Peripheral and Master classclass BoolOutPeriph : public Peripheral {public:int value;
};class BoolOutPeriphMaster : public BoolOutPeriph {// Initialize and synchrnonize local class variables// to Slave instantiations over network
};
// User completed Slave functionality classclass BoolOutPeriphSlave : public BoolOutPeriph {public:BoolOutDevice(PinName pin) : dout_pin(pin) { }void step(void): { dout_pin.write(value); }
protected:DigitalOutPin dout_pin;
};
SOB Programming 23
program logic agnostic to device placementuser defines init and main on mastertransform input to output data through net addressable registers
generate HW + SW togetherHW IDsdevice / data layout
use RPC for remote control/status registersbootloader loads code on i2c according to ids
#include "master.h"
void main (void) {init(); // init user code / driversfor (;;) {motor0.torque = f(motor0.pos, ...);motor1.torque = g(motor1.pos, ...);step(); // step drivers
} }
SOB Programming 24master.h (CPU16.h)
MotorMaster motor0, motor1;
void pull(void) { ... } ... void push(void) { ... }
CPU18.h
MotorSlave motor0(pin3, ...);
void pull(void) { ... } ... void push(void) { ... }
CPU20.h
MotorSlave motor1(pin3, ...);
void pull(void) { ... } ... void push(void) { ... }
Bootloader 25
programmed over I2Ccode organized by IO processor from low to high with cpu-id.elftoken passed down i2c bus programming processors in orderIOP with token gets programmed
IOP IOP IOP
gnd
code
token
i2c
Entire JITPCB Workflow 26
0.hex
JITPCB
boardlayout*.brd
SOBDescription
*.stanza
g++App*.cpp
0.hexbinaries*.elf *.bin
Router MillGerber
BootLoader
HW/SWPeripheral
Library.stanza + .cpp
HW/SWPeripheral
Library.stanza + .cpp
HW/SWPeripheral
Library*.stanza + *.cpp
mbed libs*.cpp
IOP Library
*.stanza
firmwarescaffolding
*.cpp SOB
PCBPCBPCB
User DefinedSystem or
CommunitySupplied
boardlayout*.brd
boardlayout*.brd
GerberGerber
Generated Files Product
Results 27
pongrobot armmobile robot
Pong 28
M IOP S IOP
S IOP S IOP
S IOP S IOP
Peripheral layout. IOP layout.
Board front. Board back.
Robot Arm 29
Arm mechanism. Master board. Motor board.
System of three boards.
Mobile Robot 30
Mobile Robot. Board detail.
Mobile Robot with Nucleo 31
Arduino Boards with JITPCB 32
physically soundautomatic pin assignmentscalable
Solver 33
voltage + resistance + current annotationssolve for missing quantitiescheck for correct wiringsolve for power supply
References 34
Fabricated: The New World of 3D Printing, by Hod Lipson, MelbaKurmanMakers: The New Industrial Revolution, by Chris AndersonMakers, by Cory DoctorowThe Third Industrial Revolution, The EconomistJITPCB, by Jonathan Bachrach, David Biancolin, Austin Buchan,Duncan Haldane, Richard Lin