# General

## I found a bug! What can I do about it?

1. See if you can reproduce the bug.
2. Ask on the geda-user mailing list if there is a work around, or has been dealt with in the bleeding edge version of gEDA/gaf. Note, that you must subscribe to the geda-user e-mail list before you can post to this list.
3. See whether the issue is already in the bug tracking system of geda/gaf. If not, file a bug report. Make sure to give all information necessary to reproduce the bug and add the version of gEDA/gaf that contains the bug.
4. Finally, as with all open source projects, you may flex your programming muscles and try to fix the bug yourself. Please file a patch of the changes you had to make to the BTS of geda/gaf. The patch will be gladly accepted to improve the next release of gEDA/gaf.

# Gschem usage

## How do I move a component?

In versions equal to or more recent than 20060824, do this:

1. Select the component by clicking it with the left mouse button. The component will highlight.
2. Drag the component (using the left mouse button) to the place you want it.

This is probably what you are already used to doing.

For folks with older versions of gschem, here are three ways to move components within gschem:

One:

1. Grab the component with the middle mouse button. The component will follow the cursor around as you move it.
2. To place the component, release the middle mouse button. The component will stay where you placed it.

Two:

1. Select the component by clicking it with the left mouse button. The component will highlight.
2. Hit the “M” key on the keyboard. The component will now follow the cursor around as you move it.
3. To place the component, click the left mouse button. The component will stay where you placed it.

Three:

1. Select the component by clicking it with the left mouse button. The component will highlight.
2. Click the right mouse button. A pop-up menu will appear.
3. With the left mouse button, click on the “move” option in the pop-up menu.
4. Click on the component with the left mouse button. The component will now follow the cursor around as you move it.
5. To place the component, click the left mouse button. The component will stay where you placed it.

## How do I move components without dragging a tail of connectet nets?

Type [or] to toggle this behaviour. That is, the “o” key followed by the “r” key. The status window will report if the toggle command was performed. The command can also be accessed via the Options menu.

## How do I change the size of the text on a symbol?

1. Select the symbol.
2. Right click → down symbol (or do Hierarchy → down symbol). This takes you to the symbol editor.
3. Select the pinnumber you want to change.
4. Do Edit → Edit Text (or type keyboard shortcut “ex”).
5. Change the font size in the pop-up box.
6. Repeat for all desired text elements.
7. File → save
8. Right click → up (or Hierarchy → Up). Now you are back in the schematic editor.
9. With the symbol still selected do Edit → Update component (or use the keyboard shortcut “ep”). If this doesn’t work, just delete the symbol and reload it.

More generally, you can use this procedure to edit anything on a symbol. (Substitute “Edit Text” for your desired edit, of course.)

## How do I unlock a locked component

When a component is locked it cannot be selected with the middle mouse button; however it is selectable using a window select. To window select a component, click and hold the left mouse button and drag the mouse to create a rectangular region containing the component to be unlocked. Execute the command Edit → unLock to unlock the component.

## How can I get refdes automatically numbered when I draw a schematic?

Edit the system-gschemrc file or place the following into a gschemrc file (either `~/.gEDA/gschemrc` or a `gschemrc` file in the local directory where you invoke gschem):

    (load (string-append gedadata "/scheme/auto-uref.scm")) ; load the autonumbering script
    (add-hook! add-component-hook auto-uref)       ; autonumber when adding a component
    (add-hook! copy-component-hook auto-uref)      ; autonumber when copying a component

Please substitute $YOUR_INSTALL_PATH by the path where geda is installed.

## What is a Bus and how do I use it?

A ‘bus’ is purely decoration. The netlister ignores it. The netname= attribute does actual work of connecting points together–this is what gnetlist reads and transforms into your netlist. It is not possible to connect to a discrete line or ‘bit’ on a bus because, again, the bus is merely a graphical entity.

Some users have found it helpful to organize their nets by incorporating a bus name into the net name. For example “net=busA:1” may be added to each busripper to aid in sorting out the nets.

## How can I change Key Bindings in gschem?

Key accels are determined by configuration files read on start-up. The default key bindings are set in the file system-gschemrc. If you want to change them, it is recommended to copy and modify the corresponding keymap section to a local config file ($HOME/.gEDA/gschemrc, or $PWD/gschemrc). The modified section will override the the definitions given in system-gschemrc.

## What are the mouse bindings in gschem?

By default you get:

- Left mouse button is used for picking and drawing.
- Middle mouse button is either move object (just hold down the middle button over an object and move the mouse) or copy object (ALT key held down while holding down the middle button over object and move the mouse).
- Right mouse button is a popup menu.

You can change the middle button by adding the following to a gschemrc file:

    (middle-button "action")   ;default binding, move or copy an object

or:

    (middle-button "stroke")   ;draw mouse gestures/strokes (must install libstroke to enable

or:

    (middle-button "repeat")   ;repeat the last command executed

You can change the right button by adding the following to a gschemrc file:

    (third-button "popup")     ;default binding, show a popup menu

or:

    (third-button "mousepan")  ;use the mouse to pan around the schematic

For more information on these options, please see the `${install_prefix}/share/gEDA/system-gschemrc` file.

## Can gschem do hierarchical designs with sub sheets?

Yes. Sub sheets are represented by special symbols on the top level schematic. You can find an example for a hierarchical design in the doc section of gschem (`geda-doc/examples/gTAG/gTAG.sch`). Currently, there is no way to automatically build a sub sheet symbol from an actual sub sheet. The sub sheet symbol has to be drawn manually. Any patches or external scripts that get the job done would be greatly appreciated.

A source attribute attached to the sub sheet symbol gives the path to the sub sheet file. The pins of the symbol correspond to ports from top sheet to sub sheet. These ports should correspond to a refdes of a port symbol on the sub sheet. The port symbols in the default library of geda are `in-1.sym` and `out-1.sym`. Use the hierarchy menu to navigate within the hierarchy of sub sheets. Alternatively, you can navigate with the page manager.

To convert a hierarchy to a netlist just call gsch2pcb on the top level schematic. By default, net names and refdes’s of components are strictly local to the subsheet. They get the sub sheet symbol refdes as a prefix when inserted into the net list. You can even use multiple instances of a sub sheet symbol without undue short cuts. Whether or not net names and refdes’s are mangled and thus local to the sub sheet can be configured in the config file gnetlistrc. Copy the corresponding lines from `system-gnetlistrc` to `gnetlistrc` in the current working directory or to `$HOME/.gEDA/gnetlistrc`. A convenient configuration is to make nets delivered by power symbols global while ordinary nets remain local to the sub sheet. This can be achieved with “hierarchy-netattrib-mangle” enabled.

# gschem symbols

## What's this business about heavy vs. light symbols?

This nomenclature arose from a discussion which frequently appears on the geda-user and geda-dev mailing lists. A light symbol is one which contains very few built-in attributes in the symbol itself. It requires that the user attach almost all attributes at the schematic level (e.g. using either gschem or gattrib). A heavy symbol is one which contains many attributes (such as package footprints, SPICE model names, etc.) built into the symbol file itself. A heavy symbol therefore requires very little attribute attachment at the schematic level – you just place it and you’re done.

The debate between proponents of heavy and light symbols is very detailed and involved. Briefly, proponents of heavy symbols believe that they provide better integration between gschem and PCB since the important layout attributes (such as footprint name) are already built into the symbol. This is considered a good thing for new users (noobs) who just want to design a simple board and don’t appreciate or don’t care about the zillions of variations that even a simple resistor might have (e.g. different footprint, TCR, precision, material composition, etc). Proponents of light symbols prefer to deal with attributes at the schematic level because they believe it to be more flexible. They are quick to point out that a library of heavy symbols will quickly grow into the thousands of parts with grotesquely long names trying to distinguish between the different variations of the part. They also point out that the utility “gattrib” is the preferred tool for dealing with attributes at the schematic level (i.e. in the .sch file).

GEDA/gaf, as default configured, uses light symbols, although it can be configured to use heavy symbols. For further information, you may read these dicussions from the geda-user mailing list:

http://archives.seul.org/geda/user/Jun-2005/msg00001.html

http://archives.seul.org/geda/dev/Oct-2005/msg00043.html

## I am using a symbol out of the library. How come it's not aligned to the grid?

The symbols in the symbol library, like those available at the gedasymbols website are contributed by users just like you. Some people use different grid settings than other people (e.g. 50mil vs. 100mil). If you discover a symbol which seems to be off the grid, try reducing your grid spacing, move the symbol so that it sits on your grid, then revert to your preferred grid settings.

Yes, the gEDA docs suggest that you use a 100mil grid spacing. But everybody likes to do things their own way, and there is no overall symbol dictator to enforce the rules on contributed symbols. Therefore, you just need to be aware of this possibility.

## Is there an explicit "no connect" symbol that I can/should place in the schematic to prevent gnetlist from thinking I've forgotten a connection?

Answer: misc → nc-left, nc-right, nc-top, nc-bottom.

Caution: occassionally this may create a net called “no_connect” (or “NC??") which may lead to no-connect pins being connected together in gnetlist – which you probably _don’t_ want to happen.

If you want an entire symbol to be graphical (no elec. connections) , add a “graphical=1” attribute. The netlister will ignore these symbols entirely.

## How do I promote an invisible symbol attribute into the schematic?

Most attributes living in the symbol do not get promoted to the schematic unless they are visible. To promote invisible symbol attributes, look for the following keywords in the system-gschemrc file:

    (attribute-promotion "enabled");
    (promote-invisible "disabled") ; ⇐ This one
    (keep-invisible "enabled")

Add to your gschemrc file:

    (promote-invisible "enabled")

and you will get all the attributes promoted. The “keep-invisible” keyword will keep hidden those attributes that are hidden in the symbol file.

## What should I do about power pins on my symbols: Make them visible (explicit) or invisible (implicit)?

In the past, digital logic circuits often hid the power pin, and attached power nets using an attribute inside the symbol. Modern thought is that this is a bad practice (although religious wars still occasionally rage about this topic).

It’s marginally OK for an old logic circuit which is all 5V TTL to have hidden power and GND pins. If you only have +5V on your board, then hiding the power pin can simplify your schematic somewhat. However, few designers design such circuits nowadays; 5V TTL (and 5V CMOS) are rapidly becoming antique technologies.

It’s always been unacceptable to hide the power pins on analog chips. First, analog often has multiple power connections (VCC, VEE) which need to be explicitly drawn out. Second, good design practice is to place decoupling caps on each and every power pin. Sometimes one places an inductor in series with power also. Since these should be drawn into the schematic, it is best done by attaching them to an explicit power pin. Therefore, one should never use hidden power pins for analog symbols.

New logic circuits often use multiple supplies for different chip sections (OVDD, DVDD, etc). It is also typical to have several logic families on a single board (5V, 3.3V etc.). Therefore, it’s best to explicitly place and wire the power pins on the symbol. Hidden power pins are a recipe for disaster since you can all too easily misconnect a 5V part to a 3.3V power net, for example.

To paraphrase Nancy Reagan: Just say “no” to hidden power pins.

That said, it may still be useful to detach the power pins from the functional part of the symbol. To do so, define a seperate power symbol and give it the same refdes as the functional part. A run of gsch2pcb will treat the siblings properly as one single component. As neither gschem nor gsch2pcb explicitely know that the component is only complete with both symbols defined, you have to check yourself. With this workaround, you can draw all power related circuitry in one corner of the schematic where it does not interfere with the signal nets. In many cases this is advantageous with analog circuits.

## Is there a specification or manual for creating gschem symbols? Where is it?

Yes. It is the Symbol Creation Guide.

## Can my local library cover frequently needed sub circuits?

Yes. Symbols can contain symbols and nets.

1. Copy the subcircuit to a fresh sheet. (unlock and remove the default title block as you won’t need it)
2. The values of refdes attributes should end with "?", to allow to auto number them later.
3. Move the sub circuit to the lower left of the available space. (You can use symbol-translate from the edit menu)
4. Save the sub circuit as a *.sym file in your local library.
5. Choose “Include component as individual objects” when selecting this complex symbol for your actual schematic. The whole sub circuit will be pasted to your sheet. Be sure to switch back to the default mode for inclusion of ordinary symbols.

# Gschem configuration/customization

Gschem is configurable in more ways than can be describe here. Look at “system-gschemrc” for suggestions what else can be done.

## How do I configure my local gafrc to find my local symbol directory?

1. Create a project directory, for example ${HOME}/myproj.
2. Place the symbols you want to use into ${HOME}/myproj/symbols.
3. Create a gafrc file in ${HOME}/myproj.
4. In gafrc, put this line:

        (component-library "./symbols")

5. Run gschem from your project directory ${HOME}/myproj. That is, do this to run gschem:

       cd ${HOME}/myproj
       gschem myschematic.sch

Points to remember:

- The guile stuff which processes your RC file doesn’t understand or expand shell wildcards like "~" or ${HOME}. It does understand "." as the current working directory, and it does understand absolute file paths. If you want to do something tricky, you can try to use Scheme functions to get directory information.
- Make sure gafrc lives in your main project directory.
- Run all gEDA programs from your main project directory.
- Run the programs from the command line in a terminal shell – don’t use any whizzy, shiny desktop icons to run gschem (if you have them) since you won’t know what directory gschem is starting in, and gschem might not find gafrc.
- The key is: start gschem in the same directory as where your gafrc lives.

## Can gafrc use a variable to set the root of my library?

Currently (v1.3.1) gschem does not descend into subdirectories of the symbol library. You have to give individually each and every directory of your local lib in your gafrc file. You don’t have to repeat the absolute base path over and over. Alternatively you can use the function ‘build-path’ to concatenate the path on the fly:

    (define gedasymbols "/path/to/local/library")
    (component-library (build-path gedasymbols "analog"))
    (component-library (build-path gedasymbols "block"))
    (component-library (build-path gedasymbols "connector"))

## The library window is cluttered with default symbols. Can I restrict to my local lib?

Put a localized version of the following lines in a gafrc.

    ; empty the library path and populate it with local paths
    (reset-component-library)
    (component-library "/foo/localgedalib1")
    (component-library "/bar/foo/localgedalib2")

You have to add each and every dir of your local library. Subdirs are not automatically reckognized by gschem and gsch2pcb. Its a good idea to place this gafrc in your projects dir. That way, if you start gschem from some other place, you still get the system symbols shown. This also allows to configure special symbol libs for specific projects.

## How can I change the default size of floating text?

Put

    (text-size 10)

into your gschemrc and replace “10” with your favorite size.

## How can I have a different background color other than black?

Edit the system-gschemrc file and near the top you will find lines like:

    ;
    ; Start of color section
    ;
    ; Load up a color scheme has a light (almost white) background
    ; Comment out the first line and comment in the second line for a
    ; dark (black) background.  The dark background is the original look.
    ;
    (load (string-append gedadatarc "/gschem-darkbg")) ; dark background
    ;(load (string-append gedadatarc "/gschem-lightbg")) ; light background

Comment out the `darkbg` line (with a ;) and comment in the `lightbg` line. This will give you a light background instead of a black background. It also adjust all the other colors to be compatible with a light background.

Note, starting with version 1.2 of gschem the syntax of this line changed to

    (load (build-path geda-rc-path "gschem-lightbg")) ; light background

If you want more control over the colors, please edit `${prefix}/share/gEDA/gschem-darkbg` or `${prefix}/share/gEDA/gschem-lightbg` or create your own file and load it in the `system-gschemrc` file.

A dark background is preferred by many users.

## Each time I start gschem, the log message window is shown. Can I disable it?

In the system-gschemrc file, you will find the following section:

    ; log-window string
    ;
    ; Controls if the log message window is mapped when gschem is started up
    ; Possible options:
    ;       startup - opened up when gschem starts
    ;       later   - NOT opened up when gschem starts
    ;                 (can be opened by Options/Show Log Window)
    ;
    (log-window "startup")
    ;(log-window "later")

Comment out the `startup` line (with a ;) and comment in the `later` line, or add the following line to your gschemrc file:

    (log-window "later")

## Can I get a customized title block with new schematics?

Put the following line into your gschemrc file:

    (define default-titleblock "title-A3.sym")

Replace “title-A3.sym” with the file name of your favorite title block symbol.

# Printing/Output

## How do I print schematics from the command line?

Running the script `gschem-print.scm` will create the Postscript file that is specified on the command line.

The command line below creates a Postscript file from a schematic file (replace MY_SCH with the name of your schematic and GEDA_SCHEME_DIR with the name of the directory where your gEDA scheme files are installed):

    gschem -p -oMY_SCH.ps -sGEDA_SCHEME_DIR/gschem-print.scm MY_SCH.sch

The `bash` script below, which I name `gschem-print`, creates a Postscript file for each schematic file that is specified on the command line and then outputs each Postscript file to the default printer:

    #!/bin/bash

    # gschem options
    # -oPS_FILENAME output to Postscript file PS_FILENAME
    # -sSCRIPT_FILENAME run script SCRIPT_FILENAME
    # -p autoplace windows

    for name in $*
    do
        base="${name%.*}"
        gschem -p -o$base.ps -sGEDA_SCHEME_DIR/gschem-print.scm $base.sch
        lpr -P$PRINTER $base.ps
    done

## How can I get color postscript/PNG output?

Edit the `system-gschemrc` file or place the following into a `gschemrc` file (either `~/.gEDA/gschemrc` or a `gschemrc` file in the local directory where you invoke gschem):

    (output-color "enabled")      ; for color postscript output
    (image-color "enabled")       ; for color PNG output (enabled by default)

To control the background of the PS output, change the following line in either gschem-darkbg (for the default black colored background) or gschem-lightbg (for the alternative light colored background):

    (output-color-background 16 "black" "null" "0 0 0" 0 0 0)

The “0 0 0” is the RGB components (between 0..1) for the background color of the PS output.

To control the background of the PNG output, change the following line in either gschem-darkbg (for the default black colored background) or gschem-lightbg (for the alternative light colored background):

    (background-color 0 "grey94" "null" "1 1 1" 255 255 255)

The 255 255 255 are the RGB components for the background color of the PNG image.

## How can I get black and white postscript/PNG output?

For black and white PS output, place the following into a gschemrc file:

    (output-color "disabled")      ; for monochrome postscript output

For black and white PNG images, place the following into a gschemrc file:

    (image-color "disabled")       ; for monochromoe PNG output

## How can I insert schematics into my LaTex document?

1. Print the schematic to a file. This will be generic postscript (*.ps).
2. Convert the postscript file to epsi with the tool ps2epsi. This is a script from the ghostscript suite.
3. Include usepackage{graphicx} to the preamble of your latex document. Use the command includegraphics to place your schematic.

A simple example:

    \documentclass{article}
    \usepackage{graphicx}
    \begin{document}
      \begin{image}
      \includegraphics[width=100mm]{ModulPID.epsi}
      \end{image}
    \end{document}

## How can I split Postscript output over multiple pages?

gschem does not provide this functionality internally, however there is a program called “poster” which does exactly this. It can be downloaded from either here (GNU) or here (KDE Print).

# Gschem installation/run-time problems

## Gschem segfaults when I delete components on FC5 (and other Linux distributions)! Is there a work-around?

This bug emerged in mid 2006 for users of Fedora Core 5 (and other linux distributions that use glib 2.10.x). The bug has been fixed by the developers; the latest versions of gEDA/gaf (i.e. Oct 2006 and beyond) shouldn’t have this problem.

If you happen to have an older version of gEDA/gaf, you can work around this bug by setting the environment variable G_SLICE to “always-malloc”. Specifically, before you run gschem, do this:

bash:

    export G_SLICE=always-malloc

csh:

    setenv G_SLICE always-malloc

## After installation gschem does not work!? What could be wrong?

If you run gschem and you get a window without a menu bar, no colors, and the program terminates when you press a key with the following message:

    ERROR: Unbound variable: current-keymap

Or you get errors like this:

    Gtk-CRITICAL : file gtkpixmap.c: line 97 (gtk_pixmap_new): assertion `val != NULL’ failed.
    Gtk-CRITICAL : file gtkpixmap.c: line 97 (gtk_pixmap_new): assertion `val != NULL’ failed.
    Tried to get an invalid color: 0
    Tried to get an invalid color: 7
    Tried to get an invalid color: 0
    Tried to get an invalid color: 7

then gschem is not finding an rc file. There are two required rc files. The first is `system-gschemrc` and the second is `system-commonrc`.

- The system-gschemrc rc file should be installed when you install gschem and typically resides in `${prefix}/share/gEDA/system-gschemrc`. `${prefix}` is where you installed gschem (usually `/usr` or `/usr/local` or `$HOME/geda`). This file can also be installed in /etc/gEDA (the .debs packages do this).
- The system-commonrc rc file should be installed when you install the symbol library for gEDA/gaf. It resides in `${prefix}/share/gEDA/system-commonrc`. This file can also be installed in `/etc/gEDA` (the .debs packages do this). This file is not loaded directly by gschem. It is loaded by a “(load …)” in the system-gschemrc rc file.

Make sure these file are installed. The gschem.log file (which is created everytime you run gschem) holds valuable debugging information which should help in determining what is wrong. Check this file for where gschem is looking for the rc files.

Also, some older releases of gEDA/gaf had some bugs when the rc files were installed in other locations (other that `${prefix}/share/gEDA`), so please upgrade to a more current release.

## "Add Components" offers no symbols! What can I do about it?

Make sure that at least one of your config files contains a valid path to a symbol library. At startup, gschem checks for the following config files (on a Debian system):

1. system gafrc file: `/etc/gEDA/system-gafrc`
2. user gafrc file: `~/.gEDA/gafrc`
3. local gafrc file: `$PWD/gafrc`
4. system gschemrc file: `/etc/gEDA/system-gschemrc`
5. user gschemrc file: `~/.gEDA/gschemrc`
6. local gschemrc file: `$PWD/gschemrc`

All of these config files may or may not append paths to the library search list. If a config file conatins the command

    (reset-component-library)

the library search path will be emptied. Order is obviously important, as this command will erase any previously appended paths.

## I'm using gschem/gaf through a SSH connection and I get an error like: 'Xlib: extension "RENDER" missing on display "localhost:10.0".'

If you are getting into the remote machine by doing:

    $ ssh -X your_username@your_remote_machine

and afterwards you get the Xlib RENDER message, then try using:

    $ ssh -Y your_username@your_remote_machine

The latter enables trusted X11 forwarding.