35
Software Defined Printed Circuit Boards Jonathan Bachrach EECS UC Berkeley August 25, 2016

Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Software Defined Printed Circuit Boards

Jonathan Bachrach

EECS UC Berkeley

August 25, 2016

Page 2: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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”

Page 3: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 4: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Motivation 3

IoT Roboticsgood work labs Utah Valley University

Page 5: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Problem 4

Current Design Flows aretime consuminginaccessibly complicatednot reusable

Situation:idle printersdomain experts without access to fabrication

Page 6: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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)

Page 7: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

JITPCB Abstract 6

Declaratively design embedded systems

Inputslist of peripheralsapplication in C++

Outputs(multiple) board filescompiled firmwarenetworking layer

Page 8: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

JITPCB Movie 7

Page 9: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Current Breadboard Prototyping 8

ungainly formatfragilemanual and error prone efforts – pin conflictsdoesn’t scale

Page 10: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 11: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Current PCB Design + Fabrication 10

CAD is tedious and only WYSIWYGfabrication is slow and expensive

Page 12: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 13: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

OtherMill vs Alternatives (or MCB vs PCB) 12

othermill is an order of magnitude lower cost and time

Page 14: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 15: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Methods 14

SOB architecturestanzahardware descriptionsoftware model

Page 16: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 17: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 18: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 19: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Hardware Description 18

componentsmoduleslayoutautorouter

Page 20: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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)

Page 21: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Software Model 20

mBEDdriversvirtualized peripherals – RPC callsbootloader

Page 22: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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);

Page 23: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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;

};

Page 24: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

} }

Page 25: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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) { ... }

Page 26: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 27: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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

Page 28: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Results 27

pongrobot armmobile robot

Page 29: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Pong 28

M IOP S IOP

S IOP S IOP

S IOP S IOP

Peripheral layout. IOP layout.

Board front. Board back.

Page 30: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Robot Arm 29

Arm mechanism. Master board. Motor board.

System of three boards.

Page 31: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Mobile Robot 30

Mobile Robot. Board detail.

Page 32: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Mobile Robot with Nucleo 31

Page 33: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Arduino Boards with JITPCB 32

physically soundautomatic pin assignmentscalable

Page 34: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

Solver 33

voltage + resistance + current annotationssolve for missing quantitiescheck for correct wiringsolve for power supply

Page 35: Software Defined Printed Circuit Boardscs194-126/fa16/lectures/... · 2016-10-24 · Makers: The New Industrial Revolution, by Chris Anderson Makers, by Cory Doctorow The Third Industrial

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