Re: Serial port error statistics - any comparable data?

2008-03-30 Thread Bjoern Schliessmann
Diez B. Roggisch wrote:

 if you have the chance, try  attach a machine with legacy rs232
 port, and see if the errors still remain.

Additionally, what kind of buffers does your device have? I'm using
pyserial to control a very sensitive device with nuttily
implemented buffering strategy. It has a fast and a slow buffer
which are filled in order, and no signalling to the outside sender
on how full they are. If the fast buffer fills the slow buffer
kicks in and requires less transmission rate. That may be how
characters could be lost with you.

Regards,


Björn

-- 
BOFH excuse #119:

evil hackers from Serbia.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Serial port error statistics - any comparable data?

2008-03-30 Thread Hendrik van Rooyen
Diez B. Roggisch wrote:


RS232 is unfortunately as bad as a protocol as it can get. I've used
it for communication with a microcontroller for just a few bytes every
second. And it failed miserably, so I needed to implement a protocol on
top of it.

We normally do this anyway, except for stuff like menus that are intended
for interactive use as setup - doing without on machine to machine comms
feels a bit too cowboy...


The machine spec is totally irrelevant - what is interesting is the
serial hardware you use. Are you by any chance using a
serial2usb-converter? I had nothing but troubles with these.


I have also heard rumours about this, and you have just hardened
my admittedly irrational attitude towards them.  I have never used 
one in anger.

if you have the chance, try  attach a machine with legacy rs232 port,
and see if the errors still remain.

Diez

Alas - the port in question is the native legacy motherboard port.
If it were windows, it would be COM1...

I had hoped that somebody would have done some similar work, 
so that we could compare notes on the error frequency.  It does not
seem likely though - If I was not testing the performance of the 
Lantronix xport device, I would not have kept stats either - it is kind
of tedious to sit and watch the fox scroll up the screen for days on end..

It just surprised me to find that the errors were made in the PC's receive.
I proved this by short circuiting the xport's receive and transmit at the
RS-232 level and gave up after some ten million error free lines.  (Most 
of an afternoon, overnight, and most of the next morning  ;-(  )

thanks Diez.


Then Castironpi wrote:

Transmit observed minus expected to cluster. 

The cluster in all the cases observed is the loss of exactly one character,
somewhere from around more or less the middle of the string:

The quick brown fox jumps over the lazy dog 0123456789

Why do you make the assertion that the errors would cluster?

What kind of tables does the input device build?

Whatever the kernel and the cpython implementation does to receive
the string from a port unblocked with fcntl - and the throw away python
script that does the echoing builds the string up with a read(1).

And before I get flamed for wasting resources - The read(1) is necessary 
to be able to run a protocol, later.

- Hendrik


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Serial port error statistics - any comparable data?

2008-03-30 Thread Hendrik van Rooyen
On Sunday 30 March 2008 12:19:58 Bjoern Schliessmann wrote:
 Diez B. Roggisch wrote:
  if you have the chance, try  attach a machine with legacy rs232
  port, and see if the errors still remain.

 Additionally, what kind of buffers does your device have? I'm using
 pyserial to control a very sensitive device with nuttily
 implemented buffering strategy. It has a fast and a slow buffer
 which are filled in order, and no signalling to the outside sender
 on how full they are. If the fast buffer fills the slow buffer
 kicks in and requires less transmission rate. That may be how
 characters could be lost with you.

 Regards,


 Bjoern

That is a horrible device - have they not heard of RTS / CTS?
or even XON / XOFF ?  It is a wonder that you got that working
without turning into an axe murderer.  I don't think I could have.

I have not been exactly forthcoming about the setup - the device
in question sits on the LAN, so I connect to it via a TCP socket 
connection (in either client or server mode - seems to make no
difference) . On the other side of the device, there is a serial port,
and another PC is connected to the RS-232 side.  This is the PC 
that runs a simple echo script that makes the occasional error,
on its receive - I can see this because the transmission is
paused when I see an error, and the two strings are identical
on the two machines.

As I mentioned in my reply to Diez and Castironpi - its not the device
that is making the errors, as proved by a simple loopback.

Another interesting statistic is that the number of lines 
in flight  on the round trip machine1  xport  
 machine2  xport  machine 1 due to buffering varies 
between  about 4 and about 26.

So much for using it for real time control...

- Hendrik


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Serial port error statistics - any comparable data?

2008-03-30 Thread Dan Stromberg
On Sat, 29 Mar 2008 13:14:46 +0200, Hendrik van Rooyen wrote:

 Hi,
 
 I have been doing some tests on a device that we are thinking of
 incorporating into a product, and I have seen that reception on a serial
 port at 115200 baud over about six metres of RS-232 cable makes
 mistakes, to the order of 125 lines with errors in them out of
 approximately 18.4 million lines of 65 or so chars - about one errored
 line in 147000, or one error character in 95 million.
 
 The PC that is making the errors is a 64 bit dual core AMD machine
 running at 2 Gig, and I am running stock standard Open Suse 10.3 with
 the supplied Python 2.5.
 
 What kind of bothers me is the nature of the errors - I seem to get only
 missing characters, as if an interrupt was missed.  There are no munged
 characters as one would expect if the errors were bit related.
 
 Has anyone else seen anything like this, and am I worrying needlessly?
 
 I realise that my production protocols will easily handle this almost
 non existent level of error - but if this were in microcontroller code
 that I had written myself, I would suspect that I was spending too long
 in some critical section of code.
 
 - Hendrik

Have you verified that you have flow control enabled?

ISTR hearing there is one kind of software flow control and two kinds of 
hardware flow control.

I'm not serial expert, but ISTR that if your cable supports it, you 
should use RTS/CTS hardware flow control, and if it doesn't, use software 
flow control.


-- 
http://mail.python.org/mailman/listinfo/python-list


Serial port error statistics - any comparable data?

2008-03-29 Thread Hendrik van Rooyen
Hi,

I have been doing some tests on a device that
we are thinking of incorporating into a product, 
and I have seen that reception on a serial port
at 115200 baud over about six metres of RS-232
cable makes mistakes, to the order of 125 lines
with errors in them out of approximately 18.4
million lines of 65 or so chars - about one errored
line in 147000, or one error character in 95 million.

The PC that is making the errors is a 64 bit dual
core AMD machine running at 2 Gig, and I am 
running stock standard Open Suse 10.3 with 
the supplied Python 2.5.

What kind of bothers me is the nature of the errors -
I seem to get only missing characters, as if an 
interrupt was missed.  There are no munged characters
as one would expect if the errors were bit related.

Has anyone else seen anything like this, and am I worrying
needlessly?

I realise that my production protocols will easily handle
this almost non existent level of error - but if this were in
microcontroller code that I had written myself, I would
suspect that I was spending too long in some critical
section of code.

- Hendrik



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Serial port error statistics - any comparable data?

2008-03-29 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb:
 Hi,
 
 I have been doing some tests on a device that
 we are thinking of incorporating into a product, 
 and I have seen that reception on a serial port
 at 115200 baud over about six metres of RS-232
 cable makes mistakes, to the order of 125 lines
 with errors in them out of approximately 18.4
 million lines of 65 or so chars - about one errored
 line in 147000, or one error character in 95 million.
 
 The PC that is making the errors is a 64 bit dual
 core AMD machine running at 2 Gig, and I am 
 running stock standard Open Suse 10.3 with 
 the supplied Python 2.5.
 
 What kind of bothers me is the nature of the errors -
 I seem to get only missing characters, as if an 
 interrupt was missed.  There are no munged characters
 as one would expect if the errors were bit related.
 
 Has anyone else seen anything like this, and am I worrying
 needlessly?
 
 I realise that my production protocols will easily handle
 this almost non existent level of error - but if this were in
 microcontroller code that I had written myself, I would
 suspect that I was spending too long in some critical
 section of code.

RS232 is unfortunately as bad as a protocol as it can get. I've used 
it for communication with a microcontroller for just a few bytes every 
second. And it failed miserably, so I needed to implement a protocol on 
top of it.

The machine spec is totally irrelevant - what is interesting is the 
serial hardware you use. Are you by any chance using a 
serial2usb-converter? I had nothing but troubles with these.

if you have the chance, try  attach a machine with legacy rs232 port, 
and see if the errors still remain.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Serial port error statistics - any comparable data?

2008-03-29 Thread castironpi
On Mar 29, 4:26 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote:
 Hendrik van Rooyen schrieb:





  Hi,

  I have been doing some tests on a device that
  we are thinking of incorporating into a product,
  and I have seen that reception on a serial port
  at 115200 baud over about six metres of RS-232
  cable makes mistakes, to the order of 125 lines
  with errors in them out of approximately 18.4
  million lines of 65 or so chars - about one errored
  line in 147000, or one error character in 95 million.

  The PC that is making the errors is a 64 bit dual
  core AMD machine running at 2 Gig, and I am
  running stock standard Open Suse 10.3 with
  the supplied Python 2.5.

  What kind of bothers me is the nature of the errors -
  I seem to get only missing characters, as if an
  interrupt was missed.  There are no munged characters
  as one would expect if the errors were bit related.

  Has anyone else seen anything like this, and am I worrying
  needlessly?

  I realise that my production protocols will easily handle
  this almost non existent level of error - but if this were in
  microcontroller code that I had written myself, I would
  suspect that I was spending too long in some critical
  section of code.

 RS232 is unfortunately as bad as a protocol as it can get. I've used
 it for communication with a microcontroller for just a few bytes every
 second. And it failed miserably, so I needed to implement a protocol on
 top of it.

 The machine spec is totally irrelevant - what is interesting is the
 serial hardware you use. Are you by any chance using a
 serial2usb-converter? I had nothing but troubles with these.

 if you have the chance, try  attach a machine with legacy rs232 port,
 and see if the errors still remain.

Transmit observed minus expected to cluster.  What kind of tables does
the input device build?
-- 
http://mail.python.org/mailman/listinfo/python-list