Hello Hongchunxia
Everything looks fine to me, except that your hardware seems not to be
working. It may be the Moxa (serial to IP converter, right?) or the
serial device.
Have you checked the cable?
Maybe you need a nullmodem cable?
I don't see where you set the baud rate. Use something like
asynSetOption ("MOXA1", 0, "baud", "9600")
Also check number of bits, stop bits, hardware handshake.
Try without EPICS first, do a 'telnet 192.168.127.254 4001'
Does everything work there?
Does the device work when you connect it directly to the serial port of
your PC (or to a USB converter), maybe using minicom?
Dirk
洪春霞 wrote:
> Hello,everyone.
>
> Now I want to use StreamDevice and ASYN to create EPICS device support
> for a serial, and the serial device connected to Ethernet/Serial
> converters, the serial device is 9x Series Motor Controllers/Drivers(Net
> Controls, LLC).
>
> My epics base is 3.14.8.2 and ASYN is 4-6 and StreamDevice-2-5 and CALC
> is 2-6-3. After I modify some files and the compile is ok, but when I
> run st.cmd in the host of linux-x86, there are some problems. The error
> message is as follows:
>
> ---------------------- error message -------------------------------------
>
> [saxs@localhost iocserial]$ ./st.cmd
> #!../../bin/linux-x86/serial
> ## You may have to change serial to something else
> ## everywhere it appears in this file
> < envPaths
> epicsEnvSet(ARCH,"linux-x86")
> epicsEnvSet(IOC,"iocserial")
> epicsEnvSet(TOP,"/home/saxs/serial")
> epicsEnvSet(SUPPORT,"/BLC/epics/synApps_5_2/support")
> epicsEnvSet(ASYN,"/BLC/epics/synApps_5_2/support/asyn/4-6")
> epicsEnvSet(CALC,"/BLC/epics/synApps_5_2/support/calc/2-6-3")
> epicsEnvSet(STREAM,"/BLC/epics/synApps_5_2/support/stream-2-5")
> epicsEnvSet(EPICS_BASE,"/BLC/epics/base")
> cd /home/saxs/serial
> ## Register all support components
> dbLoadDatabase("dbd/serial.dbd")
> serial_registerRecordDeviceDriver(pdbbase)
> epicsEnvSet("STREAM_PROTOCOL_PATH",".:../protocols")
> drvAsynIPPortConfigure("MOXA1","192.168.127.254:4001",0,0,0)
>
> asynSetTraceMask("MOXA1",0,255)
> 2012/05/24 16:14:12.091 MOXA1 -1 exceptionOccurred calling exceptionUser
> But when asynSetTraceMask("MOXA1",0,1),there is no the error message.
>
>
> ## Load record instances
> #dbLoadRecords("db/dbExample1.db","user=saxsHost")
> #dbLoadRecords("db/dbExample2.db","user=saxsHost,no=1,scan=1 second")
> #dbLoadRecords("db/dbExample2.db","user=saxsHost,no=2,scan=2 second")
> #dbLoadRecords("db/dbExample2.db","user=saxsHost,no=3,scan=5 second")
> #dbLoadRecords("db/dbSubExample.db","user=saxsHost")
> dbLoadRecords("db/serial.db")
> 2012/05/24 16:14:12.092 asynManager connect queueCallback port:MOXA1
> 2012/05/24 16:14:12.092 Open connection to 192.168.127.254:4001
> ## Set this to see messages from mySub
> #var mySubDebug 1
> cd /home/saxs/serial/iocBoot/iocserial
> iocInit()
> Starting iocInit
> ############################################################################
> ### EPICS IOC CORE built on Apr 24 2012
> ### EPICS R3.14.8.2 $R3-14-8-2$ $2006/01/06 15:55:13$
> ############################################################################
> 2012/05/24 16:14:12.094 Opened connection to 192.168.127.254:4001
> 2012/05/24 16:14:12.094 MOXA1 -1 exceptionOccurred calling exceptionUser
> 2012/05/24 16:14:12.094 asynManager connect queueCallback port:MOXA1
> 2012/05/24 16:14:12.094 asynManager connect queueCallback port:MOXA1
> 2012/05/24 16:14:12.196 MOXA1 addr -1 queueRequest priority 0 not lockHolder
> 2012/05/24 16:14:12.196 MOXA1 callback
> 2012/05/24 16:14:12.196 MOXA1 addr -1 queueRequest priority 0 not lockHolder
> 2012/05/24 16:14:12.196 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:12.196 MOXA1 callback
> 2012/05/24 16:14:12.196 MOXA1 flush
> 2012/05/24 16:14:12.196 192.168.127.254:4001 flush
> 2012/05/24 16:14:12.196 MOXA1 get Eos 0
> 2012/05/24 16:14:12.196 MOXA1 set Eos 0
> 2012/05/24 16:14:12.196 192.168.127.254:4001 write.
> 2012/05/24 16:14:12.196 192.168.127.254:4001 write 11
> 2012/05/24 16:14:12.196 MOXA1 write
> 2012/05/24 16:14:12.197 MOXA1 set Eos 0
> 2012/05/24 16:14:12.197 MOXA1 addr -1 queueRequest priority 0 from
> lockHolder
> 2012/05/24 16:14:12.197 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:12.197 MOXA1 callback
> 2012/05/24 16:14:12.197 MOXA1 get Eos 0
> 2012/05/24 16:14:12.197 MOXA1 set Eos 2
> 2012/05/24 16:14:12.197 192.168.127.254:4001 read.
>
>
> 2012/05/24 16:14:13.196 MOXA1 MOXA1:setPosition: No reply from device
> within 1000 ms
> 2012/05/24 16:14:13.196 MOXA1 set Eos 0
>
> 2012/05/24 16:14:13.196 _main_ MOXA1:setPosition: @init handler failed
> 2012/05/24 16:14:13.196 _main_ MOXA1:setPosition: Record initialization
> failed
> Bad init_rec return value PV: MOXA1:setPosition ao: init_record
> iocInit: All initialization complete
> ## Start any sequence programs
> #seq sncExample,"user=saxsHost"
>
>
> epics> 2012/05/24 16:14:15.200 MOXA1 addr -1 queueRequest priority 0 not
> lockHolder
>
>
> 2012/05/24 16:14:15.200 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:15.200 MOXA1 callback
> 2012/05/24 16:14:15.200 MOXA1 addr -1 queueRequest priority 0 not lockHolder
> 2012/05/24 16:14:15.200 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:15.200 MOXA1 callback
> 2012/05/24 16:14:15.200 MOXA1 flush
> 2012/05/24 16:14:15.200 192.168.127.254:4001 flush
> 2012/05/24 16:14:15.200 MOXA1 get Eos 0
> 2012/05/24 16:14:15.200 MOXA1 set Eos 0
> 2012/05/24 16:14:15.200 192.168.127.254:4001 write.
> 2012/05/24 16:14:15.200 192.168.127.254:4001 write 11
> 2012/05/24 16:14:15.200 MOXA1 write
> 2012/05/24 16:14:15.200 MOXA1 set Eos 0
> 2012/05/24 16:14:15.200 MOXA1 addr -1 queueRequest priority 0 from
> lockHolder
> 2012/05/24 16:14:15.200 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:15.200 MOXA1 callback
> 2012/05/24 16:14:15.201 MOXA1 get Eos 0
> 2012/05/24 16:14:15.201 MOXA1 set Eos 2
> 2012/05/24 16:14:15.201 192.168.127.254:4001 read.
> 2012/05/24 16:14:16.200 MOXA1 MOXA1:getPosition: No reply from device
> within 1000 ms
> 2012/05/24 16:14:16.200 MOXA1 set Eos 0
> 2012/05/24 16:14:17.200 MOXA1 addr -1 queueRequest priority 0 not lockHolder
> 2012/05/24 16:14:17.200 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:17.200 MOXA1 callback
> 2012/05/24 16:14:17.200 MOXA1 addr -1 queueRequest priority 0 not lockHolder
> 2012/05/24 16:14:17.200 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:17.200 MOXA1 callback
> 2012/05/24 16:14:17.200 MOXA1 flush
> 2012/05/24 16:14:17.200 192.168.127.254:4001 flush
> 2012/05/24 16:14:17.200 MOXA1 get Eos 0
> 2012/05/24 16:14:17.200 MOXA1 set Eos 0
> 2012/05/24 16:14:17.200 192.168.127.254:4001 write.
> 2012/05/24 16:14:17.200 192.168.127.254:4001 write 11
> 2012/05/24 16:14:17.200 MOXA1 write
> 2012/05/24 16:14:17.200 MOXA1 set Eos 0
> 2012/05/24 16:14:17.200 MOXA1 addr -1 queueRequest priority 0 from
> lockHolder
> 2012/05/24 16:14:17.201 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:17.201 MOXA1 callback
> 2012/05/24 16:14:17.201 MOXA1 get Eos 0
> 2012/05/24 16:14:17.201 MOXA1 set Eos 2
> 2012/05/24 16:14:17.201 192.168.127.254:4001 read.
> 2012/05/24 16:14:18.200 MOXA1 MOXA1:getPosition: No reply from device
> within 1000 ms
> 2012/05/24 16:14:18.200 MOXA1 set Eos 0
> 2012/05/24 16:14:19.200 MOXA1 addr -1 queueRequest priority 0 not lockHolder
> 2012/05/24 16:14:19.200 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:19.200 MOXA1 callback
> 2012/05/24 16:14:19.200 MOXA1 addr -1 queueRequest priority 0 not lockHolder
> 2012/05/24 16:14:19.200 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:19.200 MOXA1 callback
> 2012/05/24 16:14:19.200 MOXA1 flush
> 2012/05/24 16:14:19.200 192.168.127.254:4001 flush
> 2012/05/24 16:14:19.200 MOXA1 get Eos 0
> 2012/05/24 16:14:19.200 MOXA1 set Eos 0
> 2012/05/24 16:14:19.200 192.168.127.254:4001 write.
> 2012/05/24 16:14:19.200 192.168.127.254:4001 write 11
> 2012/05/24 16:14:19.201 MOXA1 write
> 2012/05/24 16:14:19.201 MOXA1 set Eos 0
> 2012/05/24 16:14:19.201 MOXA1 addr -1 queueRequest priority 0 from
> lockHolder
> 2012/05/24 16:14:19.201 MOXA1 schedule queueRequest timeout
> 2012/05/24 16:14:19.201 MOXA1 callback
> 2012/05/24 16:14:19.201 MOXA1 get Eos 0
> 2012/05/24 16:14:19.201 MOXA1 set Eos 2
> 2012/05/24 16:14:19.201 192.168.127.254:4001 read.
> 2012/05/24 16:14:19.808 Close 192.168.127.254:4001 connection.
> 2012/05/24 16:14:19.808 MOXA1 -1 exceptionOccurred calling exceptionUser
> 2012/05/24 16:14:19.808 MOXA1 MOXA1:getPosition: connection closed in read
> 2012/05/24 16:14:19.808 MOXA1 MOXA1:getPosition: I/O error after reading
> 0 bytes: ""
> 2012/05/24 16:14:19.808 MOXA1 MOXA1:getPosition: Protocol aborted
>
> Can anyone help with this problem please?
>
> Thank you very much.
>
> hongchunxia
> ===================================================
> No.239 Zhangheng Road
> PuDong District
> Shanghai Institute of Applied Physics CAS
> Shanghai, China
>
>
>
> ---------------------- serial.proto -------------------------------------
> Terminator = CR LF;
>
> getPosition{
> out "Position?";
> in "Position %f nm";
> }
>
> setPosition {
> out "Position %.2f";
> @init {
> out "Position?";
> in "Position %f nm";
> }
> }
>
>
> ---------------------- serial.db -------------------------------------
> record (ai, "MOXA1:getPosition")
> {
> field (DESC, "get Position")
> field (DTYP, "stream")
> field (SCAN, "2 second")
> field (PREC, "3")
> field (INP, "@serial.proto getPosition MOXA1")
> #field (DRVL, "-10000")
> #field (DRVH, "10000")
> field (EGU, "nm")
> }
>
> record (ao, "MOXA1:setPosition")
> {
> field (DESC, "set Position")
> field (DTYP, "stream")
> field (SCAN, "Passive")
> field (PREC, "3")
> field (OUT, "@serial.proto setPosition MOXA1")
> #field (DRVL, "-10000")
> #field (DRVH, "10000")
> field (EGU, "nm")
> }
>
>
> ---------------------- serialApp/src/Makefile ---------------------------
>
> TOP=../..
>
> include $(TOP)/configure/CONFIG
> #----------------------------------------
> # ADD MACRO DEFINITIONS AFTER THIS LINE
> #=============================
>
> #==================================================
> # Build an IOC support library
>
> LIBRARY_IOC += xxxSupport
>
> # xxxRecord.h will be created from xxxRecord.dbd
> DBDINC += xxxRecord
> # install devXxxSoft.dbd into <top>/dbd
> DBD += xxxSupport.dbd
>
> # The following are compiled and added to the Support library
> xxxSupport_SRCS += xxxRecord.c
> xxxSupport_SRCS += devXxxSoft.c
>
> xxxSupport_LIBS += $(EPICS_BASE_IOC_LIBS)
>
> #=============================
> # build an ioc application
>
> PROD_IOC = serial
> # serial.dbd will be created and installed
> DBD += serial.dbd
>
> # serial.dbd will be made up from these files:
> serial_DBD += base.dbd
> serial_DBD += xxxSupport.dbd
> serial_DBD += dbSubExample.dbd
> serial_DBD += serialHello.dbd
>
> serial_DBD += stream.dbd
> serial_DBD += asyn.dbd
> serial_DBD += drvAsynIPPort.dbd
>
> # <name>_registerRecordDeviceDriver.cpp will be created from <name>.dbd
> serial_SRCS += serial_registerRecordDeviceDriver.cpp
> serial_SRCS_DEFAULT += serialMain.cpp
> serial_SRCS_vxWorks += -nil-
>
> # Add locally compiled object code
> serial_SRCS += dbSubExample.c
> serial_SRCS += serialHello.c
>
> # The following adds support from base/src/vxWorks
> serial_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary
>
> serial_LIBS += xxxSupport
>
> serial_LIBS += stream
> serial_LIBS += asyn
>
> # NOTE: To build SNL programs, SNCSEQ must be defined
> # in the <top>/configure/RELEASE file
>
> ifneq ($(SNCSEQ),)
> # This builds sncExample as a component of serial
> serial_SNCFLAGS += +r
> serial_DBD += sncExample.dbd
> serial_SRCS += sncExample.stt
> serial_LIBS += seq pv
>
> # The following builds sncProgram as a standalone application
> PROD_HOST += sncProgram
> sncProgram_SNCFLAGS += +m
> sncProgram_SRCS += sncProgram.st
> sncProgram_LIBS += seq pv
> sncProgram_LIBS += $(EPICS_BASE_HOST_LIBS)
> endif
>
> serial_LIBS += $(EPICS_BASE_IOC_LIBS)
>
> #===========================
>
> include $(TOP)/configure/RULES
> #----------------------------------------
> # ADD RULES AFTER THIS LINE
>
- Replies:
- Re: "@init handler failed" , "Record initialization failed" and "No reply from device within 1000 ms" Dirk Zimoch
- References:
- "@init handler failed" , "Record initialization failed" and "No reply from device within 1000 ms" 洪春霞
- Navigate by Date:
- Prev:
Announce: sequencer release 2.1.7 Benjamin Franksen
- Next:
Re: "@init handler failed" , "Record initialization failed" and "No reply from device within 1000 ms" Dirk Zimoch
- 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:
"@init handler failed" , "Record initialization failed" and "No reply from device within 1000 ms" 洪春霞
- Next:
Re: "@init handler failed" , "Record initialization failed" and "No reply from device within 1000 ms" Dirk Zimoch
- 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
|