Pavel,
I think I know what's happening.
If the device sends \n\r and you define your terminator as \n, then the
\r is still in the queue.
Normally this does not harm because StreamDevice flushes all input
before sending a new output (command).
But sometimes, the computer is too fast. The \n may be still on the wire
when StreamDevice tries to flush. Thus it arrives after the flush and
appears as the first byte if the next input.
Thus setting your terminator properly (either in asyn or in
StreamDevice) should help.
Note that InputEos of asyn is limited to 2 bytes (1 byte for most GPIB
devices). StreamDevice supports arbitrarily long inTerminators.
When taking a new device into operation, I usually test it without any
terminator setting (letting the read timeout terminate the input). Then
I can see what type of terminator the device really sends (which may be
different to the documentation!) and use that as the inputTerminator.
Dirk
Mark Rivers wrote:
I don’t know about the output EOS, that depends what the scope expects.
But it looks like it is definitely sending you \n\r, so you should set
the InputEos to “\n\r”.
Mark
*From:* Pavel Masloff [mailto:[email protected]]
*Sent:* Wednesday, May 30, 2012 9:09 AM
*To:* Mark Rivers
*Cc:* Dirk Zimoch; EPICS Tech Talk
*Subject:* Re: [StreamDevice] parsing rapid inputs
Hi Mark,
asynOctetSetInputEos("${PORT1}", -1, "\n")
asynOctetSetOutputEos("${PORT1}", -1, "\n")
Should I set them both to "\n\r"?
On Wed, May 30, 2012 at 6:00 PM, Mark Rivers <[email protected]
<mailto:[email protected]>> wrote:
How have you set the input EOS on your asyn port? Have you overridden
this by explicitly defining a terminator in your stream protocol file?
If you define the terminator as “\n\r” for the asyn port and don’t
define it in your protocol file then I don’t think you should have this
problem, because the read won’t complete until it finds and consume the
\r (CR) character.
Mark
*From:* [email protected]
<mailto:[email protected]>
[mailto:[email protected]
<mailto:[email protected]>] *On Behalf Of *Pavel Masloff
*Sent:* Wednesday, May 30, 2012 3:15 AM
*To:* Dirk Zimoch; EPICS Tech Talk
*Subject:* [StreamDevice] parsing rapid inputs
Hello,
I have run into a problem lately. I have sort of a slow device - a
TDS2024 scope. So when I run my IOC, I expect StreamDevice to initialize
my PVs. So there are ~ 20 PVs I want to initialize. And every once in a
while I get the following error message in epics shell:
/2012/05/30 13:02:25.211 L2 TDS2024:probe_ch2: got "<0d>:CH2:PROBE 1"
where ":CH2:PROBE " was expected
/This <0d> character (or CR) is driving me mad. This is because it was
supposed to be the terminator of the previous input (here is the whole
string together with the one above):
/2012/05/30 13:02:25.124 /dev/ttyUSB0 read 13
:CH1:PROBE 1\n
2012/05/30 13:02:25.211 L2 TDS2024:probe_ch2: got "<0d>:CH2:PROBE 1"
where ":CH2:PROBE " was expected/
As you can see, there is an \r missing. So my <0d> comes as a part of
the input / ":CH2:PROBE 1" /- so I get /"<0d>:CH2:PROBE 1" /instead
which causes the error.
How can I fix this?
I have tried using the @mismatch handler, but it doesn't work within the
@init handler.
And you will never know which PV will not initialize next.
As an comparison, my TPS2024 and TPS2024B scopes are fast enough to
stumble upon this. No problem there.
--
Best regards,
Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia
Mobile: +7 (951) 672 22 19
Land line: +7 (812) 461 01 01
--
Best regards,
Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia
Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01
- References:
- [StreamDevice] parsing rapid inputs Pavel Masloff
- RE: [StreamDevice] parsing rapid inputs Mark Rivers
- Re: [StreamDevice] parsing rapid inputs Pavel Masloff
- RE: [StreamDevice] parsing rapid inputs Mark Rivers
- Navigate by Date:
- Prev:
Re: Proposed change in asyn - request for comments Eric Norum
- Next:
Re: Proposed change in asyn - request for comments Andrew Johnson
- 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: [StreamDevice] parsing rapid inputs Mark Rivers
- Next:
Re: [StreamDevice] parsing rapid inputs 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
|