Is it possible to use python to get True Full Duplex on a Serial port?

Hendrik van Rooyen hendrik at microcorp.co.za
Sat Aug 15 03:52:21 EDT 2009


On Friday 14 August 2009 16:19:04 Grant Edwards wrote:
> On 2009-08-14, Hendrik van Rooyen <hendrik at microcorp.co.za> wrote:
> > In the meantime I have had another idea which I have also not tried yet,
> > namely to do independent opens for reading and writing, to give me two
> > file instances instead of one, and to try with that.  I have no idea if
> > it would make any difference, or even work at all.
>
> That should work (and shouldn't make any difference)
>
> > My normal stuff works, but I do not like it as it is
> > essentially busy looping with short sleeps in between. In the
> > eBox, it uses most of the processor just to move a few bytes
> > of I/O in and out between the serial port and the TCP/IP, and
> > struggles to do that better than five times a second, while
> > the message time on the 115200 baud port is only about 2
> > milliseconds.
>
> What platform are you using?  I suppose it's possible that
> there's something broken in the serial driver for that
> particular hardware.

Your experience seems to be exactly the opposite to mine - you are saying it 
should "just work" and I am seeing half duplex functionality.

I have seen this on my development machine which is a dual processor of some 
gigs running SuSe Linux 10.3, as well as on the other end of a the scale - 
the eBox (a 400MHz 486 without floating point with 128 Mb of memory) running 
Slackware.

Maybe it is in the way I set the port up, because that is the common thing. 
What I do is this:

reterror = os.system('stty -F /dev/ttyS0 sane 115200 cread clocal raw -echo')

It does not seem to make a difference if I do this before or after opening the 
port.

Any comments from a Linux Guru?

- Hendrik






More information about the Python-list mailing list