EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: Help creating IOC for Lakeshore 336
From: montis via Tech-talk <tech-talk at aps.anl.gov>
To: Brandon Gunn <bgunn at ucsd.edu>
Cc: tech-talk at aps.anl.gov
Date: Fri, 23 Jun 2023 11:12:12 +0200

Hi Brandon,

we use similar devices (lakeshore 421) in our lab and the setup for the IOC application should be similar.

You mentioned you still have "opportunities" during compilation; comparing the info about your LakeshoreIOCApp/src/Makefile  and ours, you should add the following lines:

lakeshoreIOC_LIBS += stream
lakeshoreIOC_LIBS += asyn
lakeshoreIOC_LIBS += calc
lakeshoreIOC_LIBS += lakeshore336

lakeshoreIOC_DBD += calc.dbd
lakeshoreIOC_DBD += stream.dbd
lakeshoreIOC_DBD += drvAsynSerialPort.dbd    (if you need serial port communication)
lakeshoreIOC_DBD += drvAsynIPPort.dbd          (if you need web socket communication)
lakeshoreIOC_DBD += asyn.dbd

Calc is required by stream because you are importing stream.dbd file which contains particular dependencies to sCalcout record. If you don't need it, you can consider to import stream-base.dbd instead of stream.dbd

drvAsynSerialPort.dbd and drvAsynIPPort.dbd are required to proper configure your st.cmd file to communicate to the device. You can import both of them or choose which is your best solution.

In case of Serial port communication, your startup file (st.cmd) should include the following lines:

# drvAsynSerialPortConfigure port ipInfo priority noAutoconnect noProcessEos
drvAsynSerialPortConfigure("$(PORTNAME)","$(TTYS)",0,0,0)
asynSetOption("$(PORTNAME)", -1, "baud", "9600")
asynSetOption("$(PORTNAME)", -1, "bits", "7")
asynSetOption("$(PORTNAME)", -1, "parity", "odd")
asynSetOption("$(PORTNAME)", -1, "stop", "1")
asynSetOption("$(PORTNAME)", -1, "clocal", "Y")
asynSetOption("$(PORTNAME)", -1, "crtscts", "N")
asynOctetSetInputEos("$(PORTNAME)", -1, "\n")
asynOctetSetOutputEos("$(PORTNAME)", -1, "\n")

In case of web socket:

# drvAsynIPPortConfigure("portName","hostInfo",priority,noAutoConnect,noProcessEos)
drvAsynIPPortConfigure("$(PORTNAME)","$(IPADDR):$(PORT)",0,0,0)

# for debug (optional - consider to keep these lines commented)
asynSetTraceIOMask("$(PORTNAME)",-1,0x2)
asynSetTraceMask("$(PORTNAME)",-1,0x9)

 
For template and protocol files, you can use/import them in different ways.
 
About templates, in our case we created dedicated substitution files in the IOC application that directly point to the template file stored in the support folder:
 
file "$(LS421)/db/devLS421.template" {
 
pattern {facsys, funsys, subsys, count1, obj, count2, port}
                {"PI0", "Diag",         "",             "",     "Gaus", "01", "SOCK01"}
}

$(LS421) is resolved with the line inserted in configure/RELEASE. In your case, for example, you can use something like $(LAKESHORE336)/db/<your file>.template

To use protocol files, you need to define the STREAM_PROTOCOL_PATH env variable in your st.cmd; in our application we defined it as:

epicsEnvSet ("STREAM_PROTOCOL_PATH", "$(LS421)/protocol")

and you can see the usage of $(LS421) to point to the file directly stored in the support.


Hope this info can help you.

Best,

Maurizio


PS: it is correct to use makeBaseApp.pl -t ioc (and not -t example) to create a brand new IOC application.


---
~~ Maurizio Montis - Control System Engineer ~~
   office: +39 0498068558
   mobile: +39 3408428089
   mail: maurizio.montis at lnl.infn.it
   skype: maurizio_montis

Istituto Nazionale di Fisica Nucleare - Laboratori Nazionali di Legnaro
   V.le dell'Universita', 2
   35020 LEGNARO (PD) - ITALY


Il 2023-06-22 23:58 Brandon Gunn via Tech-talk ha scritto:

Hi Keenan,
 
Thank you very much for the clarification, that certainly makes a lot more sense! 
 
I have been attempting to work through it and here is what I've done so far, attempting to follow the EPICS documentation:
  1. mkdir lakeshoreIOC && cd lakeshoreIOC
  2. makeBaseApp.pl -t ioc lakeshoreIOC
  3. makeBaseApp.pl -i -t ioc lakeshoreIOC
  4. make
  5. appended to lakeshoreIOCApp/src/Makefile:
    1. lakeshoreIOC_LIBS += stream
    2. lakeshoreIOC_LIBS += asyn
    3. lakeshoreIOC_LIBS += lakeshore336
  6. touch lakeshoreIOCApp/src/xxxSupport.dbd (it did not already exist)
  7. appended to xxxSupport.dbd
    1. include "stream.dbd"
    2.  include "asyn.dbd"
    3. include "lakeshore336.template"
  8. added to configure/RELEASE
    1. ASYN=/home/specadm/EPICS/support/asyn
    2. STREAM=/home/specadm/EPICS/support/stream/StreamDevice
    3. LAKESHORE336=/home/specadm/EPICS/support/lakeshore/lakeshore336
  9. (from ...EPICS/IOCs/lakeshoreIOC) make distclean; make
The next step regards the st.cmd file, however make fails, so I am sure I've done something wrong above. Should I use "example" instead of "ioc" when calling makeBaseApp.pl? Is the lakeshore module information even supposed to be entered at this stage, or just the asyn/StreamDevice libraries and all of the lakeshore-specific references are only contained within st.cmd?
 
Thank you,
Brandon
 

On Wed, Jun 21, 2023 at 3:55 PM Lang, Keenan C. <klang at anl.gov> wrote:
Brandon,

The -t flag with makeBaseApp refers to application templates that are listed in epics-base/templates/makeBaseApp/top . These are entire directories that get copied and structured by the makeBaseApp script.

The template file that you are referring to is a Database Template File (https://urldefense.com/v3/__https://docs.epics-controls.org/en/latest/appdevguide/databaseDefinition.html*dbloadtemplate__;Iw!!Mih3wA!F3VYOcbOWJDcx8SKiZcVvWpnBgFgPZIAOjcz7FKfYkeJTBMhDkBmr0l68J89Tbs4gX9qnwPZP2Qf$  ) which is a file used at IOC startup to generate PV's using database definition files and macro replacement.

The lakeshore336.template file is meant to be loaded in your IOC's st.cmd file using the dbLoadTemplate command. That command will take in the path to the template file and a set of macros to apply to the template.


Keenan
________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Brandon Gunn via Tech-talk <tech-talk at aps.anl.gov>
Sent: Wednesday, June 21, 2023 5:16 PM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: Help creating IOC for Lakeshore 336

Hello,

Firstly, thank you to everyone who helped me with my EPICS installation last week!

I am now trying to create an IOC for our Lakeshore 336 using this, which I am very grateful someone has taken the time to create: https://urldefense.com/v3/__https://github.com/mp49/lakeshore__;!!Mih3wA!F3VYOcbOWJDcx8SKiZcVvWpnBgFgPZIAOjcz7FKfYkeJTBMhDkBmr0l68J89Tbs4gX9qn_r7NOWN$

Unfortunately, between the README and the EPICS documentation, I am a bit confused about how to set up this IOC.

So far, I cloned the repo into my ~/EPICS/support directory, edited the RELEASE file to include the appropriate paths, followed by make, which did not throw any errors.

I have now created a directory in ~/EPICS/IOCs and am attempting to call  makeBaseApp.pl to create a lakeshore336 IOC. I believe that I am supposed to link the lakeshore336.template file that I downloaded using the -t flag, but even using the full path does not seem to work.

Is this the correct way to link the Lakeshore336 module when creating the IOC? Am I supposed to create symlinks someplace for the downloaded template files so that makeAppBase.pl can find them?

Thank you,
Brandon

References:
Help creating IOC for Lakeshore 336 Brandon Gunn via Tech-talk
Re: Help creating IOC for Lakeshore 336 Lang, Keenan C. via Tech-talk
Re: Help creating IOC for Lakeshore 336 Brandon Gunn via Tech-talk

Navigate by Date:
Prev: Re: Help creating IOC for Lakeshore 336 Brandon Gunn via Tech-talk
Next: Scaling mA to A: EPICS or Phoebus? Leblanc, Gregory via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: Re: Help creating IOC for Lakeshore 336 Brandon Gunn via Tech-talk
Next: Epics-server used greatest stack depth LE-DANIEL Erwann via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
ANJ, 23 Jun 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·