Epics@GSI Webhome

2nd PANDA - EPICS tutorial & workshop - December 13, 2011

Date and Location

  • Location:
    • PANDA XXXIX. Collaboration Meeting, KBW Seminar Room, GSI
  • Time and Date:
    • December 13, 2011, 11:00 - 13:00

Organizers:

  • Peter Zumbruch, ITEE/KS, GSI, Germany
  • Florian Feldbauer, University of Bochum, Germany

Participants:

  • PANDA
  • NuSTAR
  • else

Topic

EPICS tutorial
2 hour class introduction to EPICS - Experimental Physics and Industrial Control System

    Introductory talks

    Tools Overview (FB)

    hadcon streamDevice IOC / Accessing serial ASCII device via StreamDevice/Asyn
    • by-hand/telnet
      1. login to hadcon via telnet (twice → a/b)
        $ telnet etraxXYZ
      2. a) open listener:
        $ cat /dev/ttyS1
      3. b) send command:
        $ echo "VERS" > /dev/ttyS1
      4. a) will respond:
        $ RECV VERS 4.3
    • via EPICS using streamDevice:
      1. have an installation of EPICS
      2. create example IOC TOP directory
        $ mkdir -p <myTopDir> && cd <myTopDir>
      3. create example IOC
        $ makeBaseApp.pl -t ioc <myApp>
        $ makeBaseApp.pl -t ioc <myApp>
      4. extend configure/RELEASE file for streamDevice support
        add to it:
        1. ASYN=$(EPICS_HOME)/modules/soft/asyn/asyn-4.9
        2. STREAM=$(EPICS_HOME)/modules/soft/StreamDevice
      5. build streamDevice extended example IOC
        $ cd <myTopDir> && make
      6. make protocol directory
        $ mkdir -p <myApp>App/protocols && cd <myAppr>App/protocols
      7. create protocol file <myProto>.proto
        1. header:
          Terminator = LF;
          LockTimeout = 5000;
          ReplyTimeout = 4000;
          ReadTimeout = 500;
          WriteTimeout = 3000;
          ExtraInput = Ignore;

        2. basic debug protocol function:
          # Connect a stringin record to this to get
          # a generic command interface.
          # After processing finishes, the record contains the reply.

          debug {
                 ExtraInput = Ignore;
                 out "%s";
                 in "%39c";
          }
        3. create your own protocol function to get the return value of VERS command
          • up to you as string %s or float %f
          • solution to come
      8. create your database
        1. change to Db database directory
          $ cd <myTopDir>App/Db
        2. create db file <myDb>.db (by hand or by using vdct:
          1. stringin debug record:
            record(stringin, "$(PREFIX)$(HADCON):debug)") {
                   field(DTYP, "stream")
                   field(SCAN, "Passive")
                   field(OUT, "@<myProto>.proto debug $(device)")
            }
          2. create your new records stringin, ai
          • up to you as string %%s or float %%f
          • solution to come
        3. edit Makefile
          • add line: DB += <myDb>.db
        4. make
          $ make
      9. edit your start-up configuration file st.cmd
        1. change to ioc database directory
          $ cd iocBoot/ioc<myAppr>
        2. edit st.cmd
          1. add correct path to protocols
            epicsEnvSet("STREAM_PROTOCOL_PATH", "$(TOP)/<myAppr>App/protocols")
          2. add register entry
            streamHadcon_registerRecordDeviceDriver pdbbase
          3. add asyn serial port configuration, e.g.
            drvAsynSerialPortConfigure("hadcon","/dev/ttyS1",0,0,0)
                   asynSetOption("hadcon",0,"baud","115200")
                   asynSetOption("hadcon",0,"bits","8")
                   asynSetOption("hadcon",0,"parity","none")
                   asynSetOption("hadcon",0,"stop","1")
                   asynSetOption("hadcon",0,"clocal","Y")
                   asynSetOption("hadcon",0,"crtscts","N")
          4. add your database instance <myDb>.db, e.g.
            dbLoadRecords ("db/<myDb>.db", "HADCON=${HOSTNAME}, PREFIX=PANDA:IOC:, device=hadcon")
          5. optional export and the end of script your record names to a file , e.g.
            dbl > ${TOP}/iocBoot/${IOC}/${HOSTNAME}.dbl
      10. start your ioc
        $ cd iocBoot/ioc<myAppr>
        $ ../../bin/<operating system>-<architecture>\<myApp> st.cmd
      11. use caput, caget, camonitor, or CSS, or any other client to test it

    Examples
    • Have a look at the other extended tutorials and their examples of EpicsTraining


-- PeterZumbruch - 30 Nov 2011

This topic: Epics > WebHome > EpicsTraining > EpicsTrainingPandaTutorialDecember2011
Topic revision: 2011-11-30, PeterZumbruch
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)