## Introduction

piscope is a logic analyser (digital waveform viewer) for the Raspberry. It shows the state (high or low) of selected GPIO in real-time.
See video.
piscope uses the services of the pigpio library. pigpio needs to be running on the Pi whose GPIO are to be monitored.
The pigpio library may be started as a daemon (background process) by the following command.
`sudo pigpiod
`
piscope may be invoked in several different ways

Pi | pi_host ~ $ piscope & | Pi captures data Pi processes data Pi displays data
Pi plus Linux PC (with the display on a remote Linux PC) | remote_host ~ $ ssh -X pi_host pi_host ~ $ piscope & | Pi captures data Pi processes data Remote Linux PC displays data

Pi plus Windows PC
(with the
display on a remote
Windows PC)

You need to install an SSH client (putty suggested) and a X11 server (xming suggested).
Run Program Files -> Xming -> XLaunch and accept the defaults.
Run putty and enter the Pi's host name or IP address. Click on SSH X11 and tick Enable X11 forwarding and then select Open.
pi_host ~ $ piscope &

Pi captures data
Pi processes data
Remote Windows PC displays data

Pi plus Linux PC (with the display and processing on a remote Linux PC) | remote_host ~ $ export PIGPIO_ADDR=pi_host remote_host ~ $ piscope & | Pi captures data Remote processes data Remote displays data

piscope operates in one of three modes

Live

The latest GPIO samples are displayed.
The mode will automatically change to Pause if a sampling trigger is detected.
There are four triggers. Each trigger is made up of a combination of GPIO states (one of don't care, low, high, edge, falling, or rising per GPIO). Triggers are always counted. In addition a trigger may be sample to, sample around, or sample from, a so called sampling trigger.

New samples are added to the sample buffer.
Once the sample buffer is full the oldest samples are discarded.

Play | Recorded GPIO samples are displayed. The play speed may be varied between 64 times real-time to 1/32768 of real-time. The page up key increases the play speed by a factor of 2. The page down key decreases the play speed by a factor of 2. The home key sets the play speed to 1X. | New samples are added to the sample buffer. Once the sample buffer is full new samples are discarded.

Pause

Recorded GPIO samples are displayed.
The left and right cursor keys move the blue marker to the previous or next edge. By default all GPIO edges are considered. Clicking on a GPIO name will limit edge searches to the highlighted GPIO only.
The left and right square bracket keys move the blue marker to the previous or next trigger.
The time between the blue and gold markers is displayed. The gold marker is set to the blue marker by a press of the 'g' key.

New samples are added to the sample buffer.
Once the sample buffer is full new samples are discarded.

In all modes the down and up cursor keys zoom the time scale in and out.
Samples can be saved with File Save All Samples or File Save Selected Samples.

To select samples enter pause mode. Press 1 to specify the start of the samples (green marker) and 2 to specify the end of the samples (red marker).

The samples may be saved in the native piscope format or in VCD format.

Data saved in VCD format may be viewed and further processed with GTKWave.

Data saved in the native piscope format may be restored later with File Restore Saved Data.

## Installation

To download and install piscope.

### Pi (pre-built image)

`wget abyz.me.uk/rpi/pigpio/piscope.tar
tar xvf piscope.tar
cd PISCOPE
make hf
make install`

### Linux 64 bit X86/AMD (pre-built image)

`wget abyz.me.uk/rpi/pigpio/piscope.tar
tar xvf piscope.tar
cd PISCOPE
make x86_64
make install
`

### All machines (building from source)

You only need to perform this step if you want to build the executable from the source files. This is not needed if you use a pre-built image.
WARNING: Installing gtk+-3.0 uses a lot of SD card space.
Most of the space used by gtk+-3.0 is taken up by unneeded *-dbg packages.
With *-dbg packages an additional 3753MB SD space is required.
If you edit the list of packages to be downloaded and remove the *-dbg packages only 134MB of additional SD space is needed (as at the time of writing).
`#
` `# *** This may take a lot of time and use a lot of SD card space ***
` `#
sudo apt-get install gtk+-3.0
` `#
` `wget abyz.me.uk/rpi/pigpio/piscope.tar
tar xvf piscope.tar
cd PISCOPE
make
make install
`