I see the problem. The code has a main.cpp which creates a linked list of controller port names, and then searches it. Controllers get added to that list with a call to addToList().
This is a search for addToList in the code.
corvette:~/scratch/EZ4axis>git grep addToList
allmotionApp/src/allmotion.h:bool addToList(const char *portName, almController *drv);
allmotionApp/src/almController.cpp: if (!addToList(portName, this)) {
allmotionApp/src/main.cpp:bool addToList(const char *portName, almController *drv)
The problem appears to be that almController.cpp calls addToList to add the new controller to the list, but almEZ4Controller.cpp does not.
This whole mechanism of maintaining a linked list of controller names in the code is obsolete. It should be replaced with a call to findAsynPortDriver() which is part of asyn.
That is what these motor drivers do:
corvette:~/devel/motor/modules>find . -name '*.cpp' -exec grep -H findAsynPortDriver {} \;
./motorScriptMotor/scriptMotorApp/src/ScriptMotorDriver.cpp: ScriptMotorController *pC = (ScriptMotorController*) findAsynPortDriver(ScriptMotorName);
./motorScriptMotor/scriptMotorApp/src/ScriptMotorDriver.cpp: ScriptMotorController* controller = (ScriptMotorController*) findAsynPortDriver(port);
./motorMicos/micosApp/src/SMCcorvusDriver.cpp: pC = (SMCcorvusController*) findAsynPortDriver(SMCcorvusPortName);
./motorMicos/micosApp/src/SMChydraDriver.cpp: pC = (SMChydraController*) findAsynPortDriver(SMChydraPortName);
./motorMicroMo/microMoApp/src/MVP2001Driver.cpp: pC = (MVP2001Controller*) findAsynPortDriver(MVP2001Name);
./motorSmarAct/smarActApp/src/smarActMCSMotorDriver.cpp: pC = (SmarActMCSController*) findAsynPortDriver(controllerPortName);
./motorSmarAct/smarActApp/src/smarActSCUMotorDriver.cpp: pC = (SmarActSCUController*) findAsynPortDriver(controllerPortName);
./motorAMCI/amciApp/src/ANF2Driver.cpp: pC = (ANF2Controller*) findAsynPortDriver(ANF2Name);
./motorAMCI/amciApp/src/ANF2Driver.cpp: pC = (ANF2Controller*) findAsynPortDriver(ANF2Name);
./motorNewport/newportApp/src/AG_UC.cpp: pC = (AG_UCController*) findAsynPortDriver(AG_UCName);
./motorNewport/newportApp/src/XPSController.cpp: pC = (XPSController*) findAsynPortDriver(XPSName);
./motorNewport/newportApp/src/XPSController.cpp: pC = (XPSController*) findAsynPortDriver(XPSName);
./motorNewport/newportApp/src/XPSController.cpp: pC = (XPSController*) findAsynPortDriver(XPSName);
./motorNewport/newportApp/src/XPSController.cpp: pC = (XPSController*) findAsynPortDriver(XPSName);
./motorNewport/newportApp/src/XPSController.cpp: pC = (XPSController*) findAsynPortDriver(XPSName);
Mark
________________________________
From: Siddons, David <siddons at bnl.gov>
Sent: Tuesday, December 8, 2020 4:06 PM
To: Mark Rivers
Subject: Re: multiple USB devices in Asyn
Hi Mark,
Someone gave me the IOC code, but I discovered it on GitHub.
https://github.com/klauer/EZ4axis
I'll clone this repo and see if it is the same as what I have. As you can see, it is fairly old, and Ken doesn't remember much about it. Kaz Gofron is using it here, which is how I got onto it. He's not around much for the past month or two, so I haven't got much from him.
Pete.
________________________________
From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Tuesday, December 8, 2020 4:23 PM
To: Siddons, David <siddons at bnl.gov>
Subject: RE: multiple USB devices in Asyn
Hi Pete,
From the output you sent it creates the first controller with no messages.
almCreateEZ4Controller("ALM1", "IP1", "1", 4, 200, 500)
Firmware version: EZController AllMotion V7.50h6 5-8-13
Limit thresholds 6150,6150,6150,6150,6150,6150,6150,6150
When it creates the second controller it prints the message “AllMotion: allmotion on port ALM2 not found”, but then it seems to work, because it correctly prints the firmware version and the limit thresholds.
almCreateEZ4Controller("ALM2", "IP2", "2", 4, 200, 500)
AllMotion: allmotion on port ALM2 not found
Firmware version: EZController AllMotion V7.50h6 5-8-13
Limit thresholds 6150,6150,6150,6150,6150,6150,6150,6150
So my question is what code is printing the message “AllMotion: allmotion on port ALM2 not found”?
- It is not printed in the driver code you sent me, the string “found” does not exist in that file.
- It is not printed in the asynMotorController or asynPortDriver base classes, because those would print timestamps.
It looks like you must have some additional code you did not send. Do you have an additional file that does the iocsh registration, for example?
Mark
From: Siddons, David <siddons at bnl.gov>
Sent: Tuesday, December 8, 2020 3:02 PM
To: Mark Rivers <rivers at cars.uchicago.edu>
Subject: Re: multiple USB devices in Asyn
Sure:
#!../../bin/linux-x86_64/ez4axis
epicsEnvSet("ENGINEER", "siddons")
epicsEnvSet("LOCATION", "740 various?")
# epicsEnvSet("EPICS_CA_AUTO_ADDR_LIST", "NO")
# epicsEnvSet("EPICS_CA_ADDR_LIST", "10.3.0.255")
< envPaths
epicsEnvSet("IOC","iocez4axis")
epicsEnvSet("TOP","/home/peter/det_grp/fy20/fffi/ez4axis/EZ4axis-master/ez4axis_example")
epicsEnvSet("SUPPORT","/home/peter/synApps/support")
epicsEnvSet("ASYN","/home/peter/synApps/support/asyn-R4-41")
epicsEnvSet("ALLMOTION","/home/peter/det_grp/fy20/fffi/ez4axis/EZ4axis-master/ez4axis_example/../")
epicsEnvSet("MOTOR","/home/peter/synApps/support/motor-R7-2-1")
epicsEnvSet("AUTOSAVE","/home/peter/synApps/support/autosave-R5-10-2")
epicsEnvSet("CALC","/home/peter/synApps/support/calc-R3-7-4")
epicsEnvSet("EPICS_BASE","/home/peter/epics/base")
## Register all support components
dbLoadDatabase("../../dbd/ez4axis.dbd",0,0)
ez4axis_registerRecordDeviceDriver(pdbbase)
epicsEnvSet(EZ_IP , "10.3.2.61")
epicsEnvSet(EZ_PORT , 4001)
epicsEnvSet(CtlSys , "FFFI")
epicsEnvSet(Sys , "FFFI")
epicsEnvSet(CntlDev1 , "Ez4:1")
epicsEnvSet(CntlDev2 , "Ez4:2")
epicsEnvSet("IOCNAME", "ez4axis-1") # set by softioc init.d script
epicsEnvSet("IOC_P", "FFFI{IOC:ez4axis-1}")
## NOTE: RS485 address must match up with the address selected on the device with its address switch:
epicsEnvSet(ALM_ADDR1, 1)
epicsEnvSet(ALM_ADDR2, 2)
## Load record instances
dbLoadRecords("/home/peter/det_grp/fy20/fffi/ez4axis/EZ4axis-master/ez4axis_example/..//db/ez4axis.db","Sys=FFFI,Dev={Ez4:1},PORT=ALM1,ADDR=0")
dbLoadRecords("/home/peter/det_grp/fy20/fffi/ez4axis/EZ4axis-master/ez4axis_example/..//db/ez4axis.db","Sys=FFFI,Dev={Ez4:2},PORT=ALM2,ADDR=1")
dbLoadTemplate("motors8.sub")
dbLoadRecords("/home/peter/det_grp/fy20/fffi/ez4axis/EZ4axis-master/ez4axis_example/db/example.db")
Bad character '$' in record name "$(P)allstop"
$(P)allstop.FLNK Has unexpanded macro
Can't set "$(P)allstop.FLNK" to "$(P)KILL_ALL"
Error at or before ")" in file "/home/peter/det_grp/fy20/fffi/ez4axis/EZ4axis-master/ez4axis_example/db/example.db" line 2
# drvAsynIPPortConfigure 'port name' 'host:port [protocol]' priority 'disable auto-connect' noProcessEos
drvAsynSerialPortConfigure("IP1", "/dev/ttyUSB0", 0, 0, 0)
asynSetOption("IP1", -1, "baud", "115200")
asynSetOption("IP1", -1, "bits", "8")
asynSetOption("IP1", -1, "parity", "none")
asynSetOption("IP1", -1, "stop", "1")
asynSetOption("IP1", -1, "clocal", "Y")
asynSetOption("IP1", -1, "crtscts", "N")
drvAsynSerialPortConfigure("IP2", "/dev/ttyUSB1", 0, 0, 0)
asynSetOption("IP2", -1, "baud", "115200")
asynSetOption("IP2", -1, "bits", "8")
asynSetOption("IP2", -1, "parity", "none")
asynSetOption("IP2", -1, "stop", "1")
asynSetOption("IP2", -1, "clocal", "Y")
asynSetOption("IP2", -1, "crtscts", "N")
# almCreateController(AllMotion port name, asyn port name, RS485 address,
# Number of axes, Moving poll period (ms), Idle poll period (ms))
almCreateEZ4Controller("ALM1", "IP1", "1", 4, 200, 500)
Firmware version: EZController AllMotion V7.50h6 5-8-13
Limit thresholds 6150,6150,6150,6150,6150,6150,6150,6150
almCreateEZ4Controller("ALM2", "IP2", "2", 4, 200, 500)
AllMotion: allmotion on port ALM2 not found
Firmware version: EZController AllMotion V7.50h6 5-8-13
Limit thresholds 6150,6150,6150,6150,6150,6150,6150,6150
#asynSetTraceMask("ALM1", -1, 0x01)
#asynSetTraceIOMask("IP1", -1, 0x0)
# asynSetTraceMask("ALM1", -1, 0x0)
# asynSetTraceMask("IP1", -1, 0x0)
cd /home/peter/det_grp/fy20/fffi/ez4axis/EZ4axis-master/ez4axis_example/
#dbLoadRecords("$(EPICS_BASE)/db/save_restoreStatus.db", "P=$(IOC_P)")
#save_restoreSet_status_prefix("$(IOC_P)")
#set_savefile_path("${TOP}/as/save","")
#set_requestfile_path("$(EPICS_BASE)/as/req")
#set_requestfile_path("${TOP}/as/req")
#system("install -m 777 -d ${TOP}/as/save")
#system("install -m 777 -d ${TOP}/as/req")
#set_pass0_restoreFile("allmotion_pass0.sav")
#set_pass0_restoreFile("ioc_settings.sav")
#set_pass1_restoreFile("allmotion_pass1.sav")
#set_pass1_restoreFile("ioc_pass1_settings.sav")
iocInit()
Starting iocInit
############################################################################
## EPICS R3.15.6
## EPICS Base built May 2 2019
############################################################################
Warning: Duplicate EPICS CA Address list entry "192.168.1.255:5065" discarded
iocRun: All initialization complete
#makeAutosaveFileFromDbInfo("$(TOP)/as/req/allmotion_pass0.req", "autosaveFields_pass0")
#makeAutosaveFileFromDbInfo("$(TOP)/as/req/allmotion_pass1.req", "autosaveFields_pass1")
#create_monitor_set("allmotion_pass0.req", 10, "")
#create_monitor_set("allmotion_pass1.req", 10, "")
# caPutLogInit("ioclog.cs.nsls2.local:7004", 1)
# cd ${TOP}
dbl > ./records.dbl
# system "cp ./records.dbl /cf-update/$HOSTNAME.$IOCNAME.dbl"
epics>
________________________________
From: Mark Rivers <rivers at cars.uchicago.edu<mailto:rivers at cars.uchicago.edu>>
Sent: Tuesday, December 8, 2020 3:52 PM
To: Siddons, David <siddons at bnl.gov<mailto:siddons at bnl.gov>>
Cc: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov> <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>>
Subject: RE: multiple USB devices in Asyn
Can you send the complete output when you start the IOC?
From: Siddons, David <siddons at bnl.gov<mailto:siddons at bnl.gov>>
Sent: Tuesday, December 8, 2020 2:49 PM
To: Mark Rivers <rivers at cars.uchicago.edu<mailto:rivers at cars.uchicago.edu>>
Cc: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>
Subject: Re: multiple USB devices in Asyn
Hi Mark,
Here is the code. I tried to send the whole IOC, but your mailer rejected it.
Pete.
________________________________
From: Mark Rivers <rivers at cars.uchicago.edu<mailto:rivers at cars.uchicago.edu>>
Sent: Tuesday, December 8, 2020 2:36 PM
To: Siddons, David <siddons at bnl.gov<mailto:siddons at bnl.gov>>
Cc: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov> <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>>
Subject: RE: multiple USB devices in Asyn
Hi Pete,
Where is the source code containing this driver?
almCreateEZ4Controller("ALM1", "IP1", "$(ALM_ADDR1)", 4, 200, 500)
Mark
From: Tech-talk <tech-talk-bounces at aps.anl.gov<mailto:tech-talk-bounces at aps.anl.gov>> On Behalf Of Siddons, David via Tech-talk
Sent: Tuesday, December 8, 2020 1:13 PM
To: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>
Subject: multiple USB devices in Asyn
I have a setup with two identical USB devices. They connect as ttyUSB0 and ttyUSB1. I tried to set up an asyn interface using the following commands:
drvAsynSerialPortConfigure("IP1", "/dev/ttyUSB0", 0, 0, 0)
asynSetOption("IP1", -1, "baud", "115200")
asynSetOption("IP1", -1, "bits", "8")
asynSetOption("IP1", -1, "parity", "none")
asynSetOption("IP1", -1, "stop", "1")
asynSetOption("IP1", -1, "clocal", "Y")
asynSetOption("IP1", -1, "crtscts", "N")
drvAsynSerialPortConfigure("IP2", "/dev/ttyUSB1", 0, 0, 0)
asynSetOption("IP2", -1, "baud", "115200")
asynSetOption("IP2", -1, "bits", "8")
asynSetOption("IP2", -1, "parity", "none")
asynSetOption("IP2", -1, "stop", "1")
asynSetOption("IP2", -1, "clocal", "Y")
asynSetOption("IP2", -1, "crtscts", "N")
# almCreateController(AllMotion port name, asyn port name, board address,
# Number of axes, Moving poll period (ms), Idle poll period (ms))
almCreateEZ4Controller("ALM1", "IP1", "$(ALM_ADDR1)", 4, 200, 500)
almCreateEZ4Controller("ALM2", "IP2", "$(ALM_ADDR2)", 4, 200, 500)
This fails, saying port ALM2 cannot be found. If I try to connect the second one also to ALM1, it complains that ALM1 is already registered.
If I comment out the first device, the second one (with port ALM2) comes up fine. How should I be doing this?
Pete.
- References:
- multiple USB devices in Asyn Siddons, David via Tech-talk
- RE: multiple USB devices in Asyn Mark Rivers via Tech-talk
- Re: multiple USB devices in Asyn Siddons, David via Tech-talk
- RE: multiple USB devices in Asyn Mark Rivers via Tech-talk
- Navigate by Date:
- Prev:
Re: multiple USB devices in Asyn Siddons, David via Tech-talk
- Next:
serial IOC connection problem Ivashkevych, Oksana 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
2023
2024
- Navigate by Thread:
- Prev:
Re: multiple USB devices in Asyn Siddons, David via Tech-talk
- Next:
serial IOC connection problem Ivashkevych, Oksana 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
2023
2024
|