EPICS driver for the IRM (Internet Rack Monitor)

Digital Interface (IPDig3) and Analog subsystem (IPAnlg3)

Cai Mingfu
DESY-MKS 2
March 1996

Description:

This EPICS driver/device is for the IRM (Internet Rack Monitor). [1] This manual shows how to include and access this device through EPICS CA (Channel Access).

This driver/device supports several possible type of operations:

Include new driver/device:

Before using EPICS tool DCT (Database Editor and Configuration Tool) to add some records to your database file, you need tell EPICS about the new device. Means that the sdr (Self Defining Record) files should include information of the new driver/device. And your devSup.o and drvSup.o should also include the new device and driver support routines.

If you want keep all other records of your database file as they were before, you need update your database file.

These should be done as following: [2]

--- add new device and driver --- 

1> device support routine
   directory: ./src/dev/

 (1) create new device support routine set, pointed by dset (Device Support 
   Entry Table)
 e.g. ./src/dev/devIrm.c
 IrmDSET devAoIrm =
        { 6, NULL, NULL, initRecAo, getInfo, AoWrite, NULL }

 (2) modify Makefile.Vx, add to SRCS.c and OBJS 
 e.g. SRCS.c = \
        ../devIrm.c\
	...

       OBJS = \
        devIrm.o\
        ...

 (3) run gmake after modifying, it will create new devSup.o

2> driver support routine
   base directory:     ./src/drv
   DESY own directory:         ./desy
   combine directory:          ./combine
   (1) create new driver and driver entry table (drvet) for hardware 
      initialization when calling iocInit.
     e.g. ./src/drv/desy/drvIrm.c
	typedef struct drvet drvIrmET;   /* driver Entry Table */
	drvIrmET drvIrmAnalog = { 3, NULL, drvIrmAnlgInit, NULL };
	drvIrmET drvIrmDigital = { 3, NULL, drvIrmDigInit, NULL };

   (2) modify Makefile.Vx, add to SRCS.c and OBJS 
     e.g. SRCS.c += ../drvIrm.c

          TARGETS += drvIrm.o

   (3) run gmake after modifying to compile it.

   (4) change to directory ../combine, run gmake. It will create new drvSup.o

EPICS release R3.12
-------------------

3> modify ascii files
   directory: ./src/ascii/

Note: Before make new sdr files keep all your database records in a report file:
   dct -r irm ./REPORTS/irm.report

 (1) modify devSup.ascii to include your new dset name (Device Support 
   Entry Table) of your device support routine.
   e.g.
	"ai"            VME_IO  "devAiIrm"      "IRM drv interface"
	"ao"            VME_IO  "devAoIrm"      "IRM drv interface"
	"longin"        VME_IO  "devLonginIrm"  "IRM drv interface"
	"longout"       VME_IO  "devLongoutIrm" "IRM drv interface"


 (2) modify drvSup.ascii to include your new drvet (driver Entry Table).
   e.g.
	"drvIrmAnalog"
	"drvIrmDigital"

 (3) run gmake after modifying, it will create new sdr files (Self Defining 
   Records), which will be used by dct and ect..

--- Update database ---

After you have modified your devSup.ascii and drvSup.ascii in ./ascii, for 
example add some new driver or new device type, you need update you database
file from your report file in directory ./REPORTS/ as following:
   makeupdate irm 

EPICS release R3.13
-------------------

File "include.dbd" (containing all .dbd descriptions for all records,
devSup and drvSup used) have to include following descriptions 

for IRM devSup:

device(longin,VME_IO,devLonginIrm,"IRM drv interface")
device(longout,VME_IO,devLongoutIrm,"IRM drv interface")
device(ai,VME_IO,devAiIrm,"IRM drv interface")
device(ao,VME_IO,devAoIrm,"IRM drv interface")

for IRM drvSup:

driver(drvIrmDigital)
driver(drvIrmAnalog)

Using device:

There are one Digital Interface and one Analog Subsystem in the IRM crate. You may add one of each more into the crate.

The IP modules, IPDig3(Digital Interface IP Module) and IPAnlg3 (Analog Subsystem IP Module), are installed on the IP slots (0..3) of the main CPU board.

Note: 
 One IPDig3: 		installed on slot b (1)		card_no = 0
 One IPAnlg3: 		installed on slot d (3)        	card_no = 0
 Second IPDig3(if any): installed on slot a (0) 	card_no = 1
 Second IPAnlg3(if any):installed on slot c (2) 	card_no = 1

Use EPICS tool dct to configure the database for data accessing and control. After loading and initialization of the IRM, you can also use CA (Channel Access) to access these channels.

When you create or modify a record with dct, in some fields must type or select correct value, which depend on the type of the record.

Following is an example to show only special value or selection of some fields:

Analog Inputs (Type: ai):

Device Type		DTYP  < SELECT >	IRM drv interface
Input Specification     INP   < ADDRESS >       #C0 S0 @
	|---------------------------|
	| Enter VME address	    |
	|	Card : 	 0/1 	    |
	|	Signal : 0..63	    |
	|	Parameter :	    |
	|	Exit :		    |
	|	Quit :              |
	|---------------------------|
Remark:
 Card (number) : 0 -- default IPAnlg3 module and analog card
		 1 -- second  IPAnlg3 module and analog card
 Signal (Input Channel): 0..63
 Parameter :	(don't care)

Linearization		LINR < SELECT >		LINEAR 
Engineer Units Full	EGUF <-1e+30 -> 1e+30>	10.0000 
Engineer Units Low      EGUL <-1e+30 -> 1e+30>  -10.000
Engineering Units       EGU   <16 chars>        Volts 
High Operating Range    HOPR <-10.0 -> 1e+30> 	10.0000 
Low Operating Range     LOPR <-1e+30 -> 10.0>	-10.0000

Analog Outputs (Type:ao):

Device Type 		DTYP < SELECT >		IRM drv interface
Output Specification    OUT  < ADDRESS >	#C0 S0 @
	|---------------------------|
	| Enter VME address	    |
	|	Card : 	 0/1 	    |
	|	Signal : 0..7	    |
	|	Parameter :	    |
	|	Exit :		    |
	|	Quit :              |
	|---------------------------|
Remark:
 Card (number) : 0 -- default IP module and analog card
		 1 -- second  IP module and analog card
 Signal (Output Channel): 0..7
 Parameter :	(don't care) 

Linearization LINR < SELECT > LINEAR Eng Units Full EGUF <-1e+30 -> 1e+30> 10.0000 Eng Units Low EGUL <-1e+30 -> 1e+30> -10.0000 Engineering Units EGU <16 chars> Volts Drive High Limit DRVH <-10.0 -> 1e+30> 10.0000 Drive Low Limit DRVL <-1e+30 -> 10.0> -10.0000 High Operating Range HOPR <-10.0 -> 10.0> 10.0000 Low Operating Range LOPR <-10.0 -> 10.0> -10.0000

Digital Inputs (type: longin) and Digital Output (type: longout):

Device Type 	DTYP < SELECT >  IRM drv interface
Input         	INP  < ADDRESS > #C0 S0 @			

	|---------------------------|
	| Enter VME address	    |
	|	Card : 	 0/1 	    |
	|	Signal : 0..7	    |
	|	Parameter :	    |
	|	Exit :		    |
	|	Quit :              |
	|---------------------------|

Remark:
 Card (number) : 0 -- default IPDig3 module and Digital card
		 1 -- second  IPDig3 module and Digital card
 Signal (Channel): 0..7 (must be coefficient with the direction switch )
 Parameter :	(don't care)

Front LED/Switches and other Access:

Similar to 3.3 except the Signal (Channel Number) are arranged as follows:
	signal		register name			data direction (I/O)
	0..7 		DIO 0..7 			I/O
	8		Relays bit-7,bit-6		O
	9		Data Direction			I
	10		Task LEDS0	 		O
	11		Task LEDS1			O
	32		front LEDS			O
	33		front DIP Switches		I
	34 		Latched Events          	I(16-bit)
	36 		FTP TIMER (Fast Time Plot) 	I(16-bit)
	38		up Start Delay       		O(16-bit)
	41		Trig Event			I
	42 		Int Vect1 (15Hz clock)		O
	43		Int Vect0 (Ext. clock event) 	O
	47		Time Control Reg.		O

Initializing the Driver:

In order to make all important values obviously define a number of SYMBOLS in drvIrm.c and set/modify their value in startup script file: they are:
 -- AD Trigger mode (Working mode):
	IRM_AD_TrigMode = 0
		# 0:(default) One digital card reads both alg cards,
		     post IRM_Card_0_Evnt and IRM_Card_1_Evnt
		# 1: IPDig3_0 reads card 0, post IRM_Card_0_Evnt
		#    and IPDig3_1 reads card1, post IRM_Card_1_Evnt 

Problems:

A-D Conversion Precision
        The input range of ADC is -10 .. +10 Volts,
        but the linear is not good when the input is high.
        inputs          reads
        -9.99V          -9.533
        9.6013          8.998
        6.4120          6.4025
        -6.4120         -6.4071

So the real Input Range is:
	-9.533 ( input = -9.99V) .. +9.553 (inputs = +9.99V)

Memory mapping The memory range of IP-boards was overlapping with MVME162's MK48T08 (BBRAM,TOD clock) chip. This caused crashes! It was changed to reserved but unused areas in FFF00000..FFFEFFFF. Digital I/O There is a bug - propably in the asic chip of the DIO-board - which causes the transceiver chip not to release its output driver even if the data direction is set to "input". -> Work-around: take the ABEN-pin out of the socket and pull it up to +5V. -> Digital output is not possible now! For accessing the registers of the DIO-IP-board there was included a 4 us recovery time as it was already for analogs. How to overcome this bug: (B.Schoeneburg ) Bus error with the IP local memory set to 0x630000. Reason: The local addresses 0x40 0000 ... 0xefff 0000 are assigned to one of the VMEbus masters. May use command 'ENV' of 162-bug to modify.

NOTE:

In the current version of software Clock Event Synchronization wasn't tested for the EPICS release R3.13. Perhaps, it doesn't work properly.

The current version of software for the EPICS release R3.13 doesn't support waveform- and datalogger-records. They will be included later on.

Supplements:

	D-A channels: 		(12-bit)
   	Output Range: 		+/- 10 Volts
   	Raw data and EGU:
   	RVAL(Hex)		Output(Volts)
	4095(fff)		10.0
	2047(7ff)		0.0
	0			-10.0	

   	AO DATABASE RECORDS:
        ESLO (Engineering Slope): ( EGUf - EGUl )/(2047-(-2048))
        ROFF (Raw value Offset) : 0

        EGU (Engineering Unit): Volts
        EGUf ( EGU Full ):      +10
        EGUl ( EGU Low ):      -10

   following calculation will be done by recAo.c (Linear):
        RVAL = (VAL - EGUl)/ESLO - ROFF;
	A-D channels: (16-bit)
   	Input Range: +/- 10 Volts

   	Raw data and EGU:
	Input(Volts)        RVAL(Hex)
	 10.0			7fff		
	  0.0			0
	-10.0			8000

	AI DATABASE RECORDS:
        ESLO (Engineering Slope): ( EGUf - EGUl )/(32767-(-32768))
        ROFF (Raw value Offset) : EGUl * ESLO          (-32768)

        EGU (Engineering Unit): Volts
        EGUf ( EGU Full ):      +10
        EGUl ( EGU Low ):      -10

   following calculation will be done by recSup.c (Linear):
        VAL = ( RVAL + ROFF ) * ESLO + EGUl;
 

Software sources

You can get source files of devIrm.c (IRM devSup) and drvIrm.c (IRM driver) from our ftp-server in directories /pub/EPICS/base/src/dev/ and /pub/EPICS/base/src/drv/ respectively.

References:

[1] Mike Shea, Bob Goodwin, and Mike Kucera Internet Rack Monitor(IRM) Information

[2] Kay-Uwe Kasemir, "HERACC::KRISTA$ROOT:[CSUKA.EPICS.DOC]EPICSMANV1_0.TXT" ---- EPICS - programmer's hints --


Last update: November 11th, 1999
V.Korobov