Steps to prepare Turbo PMAC VME working with EPICS

This document describes how to setup Turbo PMAC VME working with the EPICS system implemented at four sectors (19:SBC-CAT, 18:Bio-CAT, 23:GMCA, 21:LS-CAT). These groups use a set of standard EPICS records (ai, ao, bi, bo, calc, fanout) interacting with each other in order to achieve flexible mapping into EPICS of the complex PMAC functionality where one deals with coordinated motions of 1,2,3,4,... and etc motors. This extensive set (about 100 records per motor at GMCA and LS-CAT and considerably more in the older systems used at SBC and BioCAT) is introduced instead of a single Motor Record per motor because the latter is not flexible enough to map the PMAC coordinated motions, choice of motion programs and etc. For those who still want to try Motor Record with PMAC, respective driver support is included in pmacApp/pmacAsynMotorSrrc.

Step-1: Setup all motors in PEWIN32

This step is a pre-requisition because EPICS support is built on top of tuned, working motors. The tools to tune motors in EPICS are rather limited. That is why even after the EPICS support is built and made operational, you will still need to have PEWIN around and the possibility to connect the PC with PEWIN to the PMAC serial console. In most case the two systems (EPICS and PEWIN) can be used simultaneously.

Step-2: Prepare PMAC for VME communications

This part is described in a separate document.

Step-3: Prepare PMAC to work with EPICS

Set the following I-variables:

I1=0 Serial port mode = CS handshake used
I2=3 Control panel = disable.
I3=2 I/O Handshake Control: PMAC acknowledges valid command with "ACK" and invalid with "BELL" Messages are sent as DATA ... DATA .
I4=0 Communications Integrity Mode: checksums disabled; serial errors are reported immediately.
I6=1 Error Reporting Mode: the error message format is {error message}.
I7=9 Phase Cycle Extension: number of consecutive cycles to detect "In-position".
I9=0 Full/Abbreviated Listing Control: the programs are sent back in short form; decimal-address I-variable return.
I58=1 DPRAM ASCII Communications Enable = yes.
I68=15 Coordinate System Activation Control: (number of PCS)-1.

Step-4: Map your PMAC coordinate systems

Produce with text editor a file pcs.pmc (see examples in pmc/2_ioc-specific). The file will look like:

; (1) WS:Av:
&1
#1->X  ; WS:mt:
#2->Y  ; WS:mb:

; (2) WS:Ah:
&2
#3->X  ; WS:mo:
#4->Y  ; WS:mi:

; (3) VC:Vz:
&3
#5->X ; VC:mz1:
#6->Y ; VC:mz2:
#7->Z ; VC:mz3:

... and etc. Then, using the script called mapDPRAM.pl produce the two files m3300.pmc and q70.pmc mapping PMAC DPRAM for these coordinate systems. Load all three files into PMAC using PEWIN32.

Step-5: Load motion programs

Load into PMAC the set of motion programs from pmc/3_motion-prg. The set contains 9 basis programs for the coordinate systems of 1,2 and 3 motors:

These operations conclude preparing the PMAC communications and PMAC DPRAM.

Step-6: Edit EPICS DB loading templates

Now, prepare EPICS databases for loading. In many cases no database development is needed because the provided set has DBs for a number of common coordinations like slits, double-crystal monochromator, mirrors. 3-point tables, and etc. Locate examples in the iocboot directory and analyze the files st_pmac.cmd and EPICS templates in the dbLoad subdirectories. Start with assy.AssyGeneric and edit the files one by one. These templates are self-explanatory: they contain comments on what offsets should be used to properly map PMAC DPRAM access at the EPICS DB side.

Note that in the current setup the communication with assembly of 1 motor requires 5 addresses of DPRAM, communication with assembly of 2 motors requires 8 addresses of DPRAM, and communication with assembly of 3 motors requires 11 addresses of DPRAM. Only those databases that reside in pmacDB communicate with PMAC. The databases in softDb serve common DB interaction and locking and the databases in the other directories are specific for a given coordination (slits, mono, mirror, and etc).

Finally, locate pmacApp/opi/tcl and edit file configXX.tcl (where XX stand for the beamline name). This file will contain the information about configuration of PMAC motors loaded into IOC in order to call the right MEDM screens.

Some DB naming conventions:

prefix: use something like 23i, 23o, 23b, 18ID, and etc. for the beamline name prefix.
pmac names: use pmac10, pmac11, pmac12,... for PMACs in IOC1 and pmac20, pmac21, pmac22,... for PMACs in IOC2.

Step-7: If you need to design a new type of motor assembly

  1. take one of existing assemblies with the same number of motors as a template and edit respective 5 files:
  2. take an existing tsub routine from pmacApp/tsubSrc, tweak and name it accordingly, and add the tsubSrc Makefile.