Experimental Physics and Industrial Control System
On 11.07.2013 10:18, zhangning wrote:
hi,tech-talk members:
I'm using asyn+streamdevice for centos6 to send&receive hex bit arrays
between ioc and my asyn device. but I get problems.
first IOC need to send bit array to make connection with device, such as
0x03 0x00 0x00 0x13 0x0e 0xe0 0x00 0x00 0x00 0x05 0x00 0xc1 0x02 0x03
0x00 0xc2 0x02 0x02 0x00, if succeed, a same array would be recevied
such as 0x03,0x00,0x00,0x13........ so, this command should be send only
once in record init. and recevied bits should saved in a waveform record.
1. how could the bits send only once in record init?
Put it in the @init handler. @init is run during iocInit when
initializing the records. That is even before the PINI=YES records process.
2. when test for receving messages from device, error messages printed,
but using 'caget'command in another terminal, I can get the data in
record. What does the error messages mean?
here is the protocl/record and error messages:
test.proto ####################################################
ReplyTimeout = 80000;
ReadTimeout = 1000;
tpkt =
\x03\x00\x00\x13\x0e\xe0\x00\x00\x00\x05\x00\xc1\x02\x03\x00\xc2\x02\x02\x00;
array_in {
out "\${tpkt}";
in "%r"; }
waveform record ################################################
record (waveform, "$(user):test")
{
field (DTYP, "stream")
field (INP, "@test.proto array_in L0")
field (FTVL, "UCHAR")
field (NELM, "200")
field (PINI, "YES")
field (SCAN, "5 second")
}
error messages printed ###########################################
2013/07/11 15:51:25.815 L0 rootHost:test: connection closed in read
2013/07/11 15:51:25.816 L0 rootHost:test: I/O error after reading 0
bytes: ""
2013/07/11 15:51:25.816 L0 rootHost:test: Protocol aborted
I assume your device uses TCP, right? This looks like your device closed
the socket after it received the tpkt message. Maybe something was wrong
with that massage and device closes the socket when it gets data it does
not understand?
second, another bits array should be sent to device to get data
array,such as 0x03 0x00 0x00 0x2e 0x02 0xf0 0x80 0xa8 0x25 0x80 0x02
0x1f 0xfb 0x81 0x01 0x03 0x82 0x01 0x03 0x83 0x01 0x7f 0xa4 0x16 0x80
0x01 0x01 0x81 0x03 0x05 0xe8 0x00 0x82 0x0c 0x03 0xec 0x00 0x18 0x3f
0x0f 0xf6 0x10 0x03 0x01 0xf8 0x90, and a same hex bits array should
recevied,but when i do this ,error messages printed. it seems that the
bits array sent could not be recognize corrcetly.
3. how could I slove this problem?
here I use the same proto and record:
############################################################################################################################
mms_request="\x03\x00\x00\x2e\x02\xe0\x80\xa8\x25\x80\x02\x1f\xfb\x81\x01\x03\x82\x01\x03\x83\x01\x7f\xa4\x16\x80\x01\x01\x81\x03\x05\xe8\x00\x82\x0c\x03\xec\x00\x18\x3f\x0f\xf6\x10\x03\x01\xf8\x90";
array_in {
out "\${mms_request}";
in "%r"; }
waveform record ################################################
record (waveform, "$(user):test")
{
field (DTYP, "stream")
field (INP, "@test.proto array_in L0")
field (FTVL, "UCHAR")
field (NELM, "200")
field (PINI, "YES")
field (SCAN, "5 second")
}
error messages printed
############################################################################
2013/07/11 15:57:27.186 _main_ No converter registered for format '%�'
That was my fault. '\x25' is '%'. It was a bug in the StreamDevice
protocol parser that it thinks \x25 would be the start of a format
string. This is fixed in StreamDevice version 2.6.
2013/07/11 15:57:27.186 _main_ test.proto line 5: in format string:
"%\x80\x02\x1f�\x81\x01\x03\x82\x01\x03\x83\x01\x7f�\x16\x80\x01\x01\x81\x03\x05�\x00\x82\x0c\x03�\x00\x18?\x0f�\x10\x03\x01�\x90"
2013/07/11 15:57:27.186 _main_ test.proto line 9: in command 'out'
2013/07/11 15:57:27.186 _main_ test.proto line 8: in protocol 'array_in'
2013/07/11 15:57:27.186 _main_ while compiling protocol 'array_in' for
'rootHost:test'
2013/07/11 15:57:27.186 _main_ rootHost:test: Protocol parse error
2013/07/11 15:57:27.186 _main_ rootHost:test: Record initialization failed
2013/07/11 15:57:27.687 _main_ rootHost:test: Record not initialised
correctly
Can anybody give me some hints? thanks a lot for your help.
Best regards
Tomas Zhang 2013-07-10
------------------------------------------------------------------------
Best regards,
Dirk
- References:
- StreamDevice send/recevie bit array problem zhangning
- Navigate by Date:
- Prev:
RE: Simple wireless light controlled through EPICS? Emmanuel Mayssat
- Next:
Re: EPICS fsmRecord question Michael Davidsaver
- 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:
StreamDevice send/recevie bit array problem zhangning
- Next:
sequencer release 2.1.13 Benjamin Franksen
- 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