# areaDetector Prosilica driver

## August 18, 2009

## Mark Rivers

## University of Chicago

## Contents

- Overview
- Implementation of standard driver parameters
- Prosilica specific parameters
- Configuration
- MEDM screens
- Future enhancements

## Overview

This is a driver for Gigabit Ethernet and Firewire cameras from Prosilica. The driver is only supported under Windows (EPICS win32-x86 architecture) and Linux because the vendor library is only provided as a pre-built binary for those operating systems. The vendor library provided by Prosilica does callbacks to a user-supplied function each time there is a new frame. Thus, the driver does not need to create a thread itself for callbacks."

The vendor library supports saving individual frames as TIFF files, and this is implemented in the driver. The NDFileNetCDF plugin can be used to capture or stream images much more rapidly in the netCDF file format.

This driver inherits from ADDriver. It implements nearly all of the parameters in NDStdDriverParam_t (see asynNDArryDriver.h) and in ADStdDriverParam_t (see ADArrayDriver.h). It also implements a number of parameters that are specific to the Prosilica cameras. The prosilica class documentation describes this class in detail.

## Implementation of standard driver parameters

The driver redefines the choices for several of the parameters defined in ADDriver.h. The ADTriggerMode choices for the Prosilica are:

- Free Run (collects images as fast as allowed by the camera readout and the exposure time)
- Sync In 1 (external trigger on line 1)
- Sync In 2 (external trigger on line 2)
- Sync In 3 (external trigger on line 3)
- Sync In 4 (external trigger on line 4)
- Fixed Rate (collects images at a fixed rate)
- Software (single software trigger)

The Prosilica supports hardware timing input and output signals that are supported in the driver.

The NDFileFormat choices for the Prosilica are:

- TIFF (this is the only format supported)
- Invalid (this menu item is defined only because MEDM will not display a menu widget with only 1 choice)

The NDDataType choices for the Prosilica are:

- NDUInt8 (8-bit data)
- NDUInt16 (12 or 16 bit data)

The NDColorMode choices for the Prosilica are:

- NDColorModeMono (monochromatic data)
- NDColorModeBayer (raw Bayer data)
- NDColorModeRGB1 (RGB1 data)

The color Prosilica cameras are also capable of various YUV color formats but these are not supported in the driver. They may be added in a future release.

## Pilatus specific parameters

The Prosilica driver implements the following parameters in addition to those in asynNDArrayDriver.h and ADDriver.h:

Parameter Definitions in prosilica.cpp and EPICS Record Definitions in prosilica.template
Parameter index variable | asyn interface | Access | Description | drvInfo string | EPICS record name | EPICS record type
--- | --- | --- | --- | --- | --- | ---
Trigger and I/O Control
PSSyncIn1Level | asynInt32 | r/o | The level of the Sync In 1 signal | PS_SYNC_IN_1_LEVEL | $(P)$(R)SyncIn1Level_RBV | bi
PSSyncIn2Level | asynInt32 | r/o | The level of the Sync In 2 signal | PS_SYNC_IN_2_LEVEL | $(P)$(R)SyncIn2Level_RBV | bi
PSSyncOut1Mode | asynInt32 | r/w | The mode of the Sync Out 1 signal. Allowed values are: GPO (general purpose output) AcqTrigReady FrameTrigReady FrameTrigger Exposing FrameReadout Imaging Acquiring SyncIn1 SyncIn2 SyncIn3 SyncIn4 Strobe1 Strobe2 Strobe3 Strobe4 | PS_SYNC_OUT_1_MODE | $(P)$(R)SyncOut1Mode $(P)$(R)SyncOut1Mode_RBV | mbbo mbbi
PSSyncOut1Level | asynInt32 | r/w | The level of the Sync Out 1 signal. This is only programmable when SyncOut1Mode=GPO. | PS_SYNC_OUT_1_LEVEL | $(P)$(R)SyncOut1Level $(P)$(R)SyncOut1Level_RBV | bo bi
PSSyncOut1Invert | asynInt32 | r/w | Flag to invert the Sync Out 1 signal. | PS_SYNC_OUT_1_INVERT | $(P)$(R)SyncOut1Invert $(P)$(R)SyncOut1Invert_RBV | bo bi
PSSyncOut2Mode | asynInt32 | r/w | The mode of the Sync Out 2 signal. Allowed values are the same as for PSSyncOut1Mode. | PS_SYNC_OUT_2_MODE | $(P)$(R)SyncOut2Mode $(P)$(R)SyncOut2Mode_RBV | mbbo mbbi
PSSyncOut2Level | asynInt32 | r/w | The level of the Sync Out 2 signal. This is only programmable when SyncOut2Mode=GPO. | PS_SYNC_OUT_2_LEVEL | $(P)$(R)SyncOut2Level $(P)$(R)SyncOut1Level_RBV | bo bi
PSSyncOut2Invert | asynInt32 | r/w | Flag to invert the Sync Out 2 signal. | PS_SYNC_OUT_2_INVERT | $(P)$(R)SyncOut2Invert $(P)$(R)SyncOut2Invert_RBV | bo bi
PSSyncOut3Mode | asynInt32 | r/w | The mode of the Sync Out 3 signal. Allowed values are the same as for PSSyncOut1Mode. | PS_SYNC_OUT_3_MODE | $(P)$(R)SyncOut3Mode $(P)$(R)SyncOut3Mode_RBV | mbbo mbbi
PSSyncOut3Level | asynInt32 | r/w | The level of the Sync Out 3 signal. This is only programmable when SyncOut3Mode=GPO. | PS_SYNC_OUT_3_LEVEL | $(P)$(R)SyncOut3Level $(P)$(R)SyncOut3Level_RBV | bo bi
PSSyncOut3Invert | asynInt32 | r/w | Flag to invert the Sync Out 3 signal. | PS_SYNC_OUT_3_INVERT | $(P)$(R)SyncOut3Invert $(P)$(R)SyncOut3Invert_RBV | bo bi

PSStrobe1Mode

asynInt32

r/w

The mode of the Strobe 1 signal. The Strobe signals are based on the following values, but allow for changing the delay and width relative to the underlying value. Any of the outputs can be set to the Stobe1 value, rather than the raw values of these signals. Allowed values are:
AcqTrigReady
FrameTrigReady
FrameTrigger
Exposing
FrameReadout
Acquiring
SyncIn1
SyncIn2
SyncIn3
SyncIn4

PS_STROBE_1_MODE

$(P)$(R)Strobe1Mode
$(P)$(R)Strobe1Mode_RBV

mbbo
mbbi

PSStrobe1CtlDuration | asynInt32 | r/w | Flag to allow controlling the strobe duration. | PS_STROBE_1_CTL_DURATION | $(P)$(R)Strobe1CtlDuration $(P)$(R)Strobe1CtlDuration_RBV | bo bi
PSStrobe1Duration | asynFloat64 | r/w | The strobe duration if PSStrobe1CtlDuration is On. | PS_STROBE_1_DURATION | $(P)$(R)Strobe1Duration $(P)$(R)Strobe1Duration_RBV | ao ai
PSStrobe1Delay | asynFloat64 | r/w | The strobe delay relative to the underlying signal that the strobe is based on. | PS_STROBE_1_DELAY | $(P)$(R)Strobe1Delay $(P)$(R)Strobe1Delay_RBV | ao ai
Statistics Information
PSReadStatistics | asynInt32 | r/w | Read the Gigabit Ethernet statistics when 1 | PS_READ_STATISTICS | $(P)$(R)PSReadStatistics | longout
PSStatDriverType | asynOctet | r/o | Driver type | PS_DRIVER_TYPE | $(P)$(R)PSDriverType_RBV | stringin
PSStatFilterVersion | asynOctet | r/o | Packet filter version | PS_FILTER_VERSION | $(P)$(R)PSFilterVersion_RBV | stringin
PSStatFrameRate | asynFloat64 | r/o | Frame rate (Hz) | PS_FRAME_RATE | $(P)$(R)PSFrameRate_RBV | ai
PSStatFramesCompleted | asynInt32 | r/o | Number of frames completed | PS_FRAMES_COMPLETED | $(P)$(R)PSFramesCompleted_RBV | longin
PSStatFramesDropped | asynInt32 | r/o | Number of frames dropped | PS_FRAMES_DROPPED | $(P)$(R)PSFramesDropped_RBV | longin
PSStatPacketsErroneous | asynInt32 | r/o | Number of erroneous packets | PS_PACKETS_ERRONEOUS | $(P)$(R)PSPacketsErroneous_RBV | longin
PSStatPacketsMissed | asynInt32 | r/o | Number of missed packets | PS_PACKETS_MISSED | $(P)$(R)PSPacketsMissed_RBV | longin
PSStatPacketsReceived | asynInt32 | r/o | Number of received packets | PS_PACKETS_RECEIVED | $(P)$(R)PSPacketsReceived_RBV | longin
PSStatPacketsRequested | asynInt32 | r/o | Number of packets requested | PS_PACKETS_REQUESTED | $(P)$(R)PSPacketsRequested_RBV | longin
PSStatPacketsResent | asynInt32 | r/o | Number of packets resent | PS_PACKETS_RESENT | $(P)$(R)PSPacketsResent_RBV | longin
PSBadFrameCounter | asynInt32 | r/o | Number of bad frames | PS_BAD_FRAME_COUNTER | $(P)$(R)PSBadFrameCounter_RBV | longin

## Configuration

The Prosilica driver is created with the prosilicaConfig command, either from C/C++ or from the EPICS IOC shell.

    int prosilicaConfig(char *portName,
                        int uniqueId,
                        int maxBuffers, size_t maxMemory,
                        int priority, int stackSize)

The uniqueId parameter is a unique number assigned to each Prosilica camera. areaDetector uses this number, rather than the TCP/IP address, to find the camera and connect to it. This is done so that the cameras can be configured to use DHCP, and hence have non-predictable TCP/IP addresses. This does mean that areaDetector IOC must be on the same subnet as the camera, since cameras cannot be found by UniqueID through routers. The simplest way to determine the uniqueId of a camera is to run the Prosilica GigEViewer application, select the camera, and press the "i" icon on the bottom of the main window to show the camera information for this camera. The Unique ID will be displayed on the first line in the information window. For details on the meaning of the other parameters to this function refer to the detailed documentation on the prosilicaConfig function in the prosilica.cpp documentation and in the documentation for the constructor for the prosilica class.

There an example IOC boot directory and startup script (iocBoot/iocProsilica/st.cmd) provided with areaDetector.

## MEDM screens

The following is the MEDM screen ADBase.adl connected to a Prosilica camera.

### ADBase.adl

The following is the MEDM screen that provides access to the specific parameters for the Prosilica detector.

### prosilica.adl

The following is an IDL epics_ad_display screen displaying the Prosilica detector images.

### epics_ad_display.pro

## Future enhancements

Work is needed on connection management. If the camera is unplugged or powered off when the areaDetector driver is running it does not gracefully recover.

The Linux driver requires a patch for EPICS base R3.14.10 because EPICS does not correctly pass on SIGALARM signals. This will be fixed in R3.14.11.