ahpcb
sections in this file
---------------------
DOCUMENTATION
STARTING_A_PROJECT
WHERE_ARE_SYMBOLS_AND_FOOTPRINTS
GSCH2PCB
SYMBOL_CREATION
FOOTPRINT_CREATION
:.!sed -n -e 's|^##* *([^#]*) ##*|1|p' %
###########################################################################
################################# DOCUMENTATION ###########################
###########################################################################
File format: ns http://geda.seul.org/wiki/geda:file_format_spec
symbols: ns http://geda.seul.org/wiki/geda:gschem_symbol_creation
gschem: ns http://geda.seul.org/wiki/geda:gschem_ug
attributes: ns http://geda.seul.org/wiki/geda:master_attributes_list
footprints: ns http://geda.seul.org/wiki/geda:pcb_footprint_naming_conventions
footprints: ns http://www.ssalewski.de/PcbFootprintRef.txt
gschem->pcb: ns http://geda.seul.org/wiki/geda:gsch2pcb_tutorial
###########################################################################
################################# STARTING_A_PROJECT ######################
###########################################################################
Good reference:
ns http://geda.seul.org/wiki/geda:gsch2pcb_tutorial
Create a directory for the project. We will refer to this dir as $PROJ and
project files will be named proj* (replace these with the name of your
project).
Create $PROJ/elements dir for project specific pcb elements (aka footprints)
Create $PROJ/symbols dir for project specific pcb elements (aka footprints)
Create $PROJ/gafrc file
=============== BEGIN $PROJ/gafrc
(component-library "./symbols")
=============== END $PROJ/gafrc
OPTIONAL: Create $PROJ/gschemrc file. It can be empty.
Note: the lines from gafrc actually do not need to be duplicated here.
OPTIONAL: Create $PROJ/gnetlistrc file
Note: the lines from gafrc actually do not need to be duplicated here.
Create a gsch2pcb project file. Use any name not ending in .sch. In this example:
- proj.prj is the name of the project file
- boardname1.sch is the first schematic
- boardname2.sch is the second schematic (optional - use 1 to N files)
- pcbname is the name of the pcb file and other generated files.
Note: It is fine if 'proj' 'boardname' and 'pcbname' are all the same word.
=============== BEGIN $PROJ/proj.prj
elements-dir ./elements
schematics boardname1.sch boardname2.sch
output-name pcbname
=============== END $PROJ/proj.prj
Use pcb to create elements and save them in $PROJ/elements/bar.pce
Use gschem to create symbols and save them in $PROJ/symbols/foo-1.sym
Run
gsymcheck -vv xxx.sym
on each symbol file to be sure it has no errors.
Use gschem to create boardname1.sch (and optionally boardname2.sch etc)
Add a slot attribute to symbols that have more than one component per package.
Slot value should be 1,2,3,... for components in a chip.
Use pcb to create an empty file pcbname.pcb
Run
refdes_renum --pgskip
to assign U?, R?, etc numbers to parts in schematic.
Run gschem and check assignments. Parts that use slotdef need to be reassigned
by hand so that multiple symbols use the same U? refdes (multiple parts in same
package).
Run
gsch2pcb proj.prj
This:
- creates pcbname.net
- creates pcbname.new.pcb with elements from *.sch not already
in pcbname.pcb
- removes named elements from pcbname.pcb that are not in *.sch
open pcbname.pcb and
- follow directions output from gsch2pcb
- Select->Disperse symbols
- File->load netlist (load pcbname.net)
- use o command to show rats
###########################################################################
################################# WHERE_ARE_SYMBOLS_AND_FOOTPRINTS ########
###########################################################################
How symbols are found
1) In system locations (see below)
2) in lines like
(component-library "/path/to/symbols")
in
/etc/gEDA/system-gafrc
~/gafrc
$PROJ/gafrc
/etc/gEDA/system-gschemrc
~/gschemrc
$PROJ/gschemrc
How footprints/elements are found
1) In system locations (see below)
2) gsch2pcb looks in lines like
elements-dir ./elements
in gsch2pcb project file (proj.prj)
3) pcb looks in the subdirectory ./packages ($PROJ/packages)
You can symlink this to ./elements or some other place
Actual symbol locations
- $PROJ/symbols
- ~/Projects/acorn_gschem_symbols
Actual footprint locations
- /usr/share/pcb/pcblib-newlib/...
- /usr/share/pcb/pcblib/...
- /usr/share/pcb/m4/...
- ALSO /usr/local/ above stuff -- if installed from source
- $PROJ/elements
- ~/Projects/acorn_pcb_elements
find /usr/local/share/pcb -name '*.fp' -o -name '*.pce' | grep xxx
###########################################################################
################################# GSCH2PCB ################################
###########################################################################
gschem is schematic capture (draw circuit diagrams). This (in theory) allows
such circuit diagrams to be imported into pcb.
1) Create one or more .sch files (a.sch, b.sch, ...) with gschem
2) ensure components have value= and footprint= attributes
3) save the .sch files and quit gschem
4) to renumber the U? values run
refdes_renum --pgskip a.sch b.sch
(You can also skip this and assign by hand)
5) run
gschem a.sch
and check each schematic to ensure the refdes numbers are reasonable.
4) create a project file foo.prj with contents:
elements-dir ./footprints
schematics a.sch b.sch
output-name foo
Replace foo with the name of the project (it will create foo.pcb)
5) run
pcb foo.pcb
This will create an empty pcb file. Save it (empty).
6) run
gsch2pcb foo.prj
This will update the (previously empty) foo.pcb file with the circuit.
7) run
pcb foo.pcb
To load the pcb.
To load the netlist do
###########################################################################
################################# SYMBOL_CREATION #########################
###########################################################################
ns http://geda.seul.org/wiki/geda:file_format_spec
Attribute format in file
------------------------
T x y color size vis showNameVal angle align numlines
T x y color 10 vis showNameVal 0 0 1
vis: 0=hidden 1=visible
showNameVal: 0=both 1=value 2=name
color:
3=graphic (non-electrical) (use for pinlabel)
5=attached attribute color
8=detached attribute color
9=text color (use for all non-attribute text (e.g. NameOfDevice))
Attributes in symbols
---------------------
Detached attributes:
T x y 8 10 1 1 0 0 1
refdes=U?
T x y 9 10 1 0 0 0 1
NameOfDevice
This is optional and not actually an attribute.
It just labels the part.
T x y 8 10 0 0 0 0 1
device=DEVICENAME
all caps, no spaces
T x y 8 10 0 0 0 0 1
author=Acorn Pooley
supposed to also have email address acorn at mad dot scientist dot com
T x y 8 10 0 0 0 0 1
description=one line arbitrary desctiption
T x y 8 10 0 0 0 0 1
documentation=url_of_data_sheet
T x y 8 10 0 0 0 0 1
numslots=0
T x y 8 10 0 0 0 0 1
footprint=PACKAGENAME
usually all caps, no spaces
T x y 8 10 0 0 0 0 1
symversion=1.1
If numslots is not 0 you also need a
slotdef=#:#,#,#
for each gate in the package. You also need
slot=1
Pin Attributes:
T x y 3 10 1 1 0 0 1
pinlabel=label describing function of pin (arbitrary text)
for logic low use a name like _RESET_ which will
appear with a line over it.
T x y 5 10 1 1 0 0 1
pinnumber=number or name of physical pin on package
T x y 5 10 0 1 0 0 1
pinseq=numeric pin sequence number (often same as pinnumber)
numbers must start at 1 and increment without skipping any numbers
T x y 5 10 0 1 0 0 1
pintype=in
in Input
out Output
io Input/Output
oc Open collector
oe Open emitter
pas Passive
tp Totem pole
tri Tristate (high impedance)
clk Clock
pwr Power/Ground
###########################################################################
################################# FOOTPRINT_CREATION ######################
###########################################################################
File format:
http://www.ssalewski.de/PcbFootprintRef.txt
see ~/Projects/picmodem2/circuit/elements/pcb_elem.py