Is it possible to use python to get True Full Duplex on a Serial port?
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Fri Aug 14 09:58:37 EDT 2009
On 01:38 pm, hendrik at microcorp.co.za wrote:
>On Friday 14 August 2009 12:54:32 Diez B. Roggisch wrote:
>>
>>How about using pyserial? With that, I never had any problems
>>accessing
>>the the serial ports, and AFAIK no duplex-problems as well. And I
>>seriously doubt that these are a python-related problem - python only
>>has a very thin, direct layer above the posix-calls, and doesn't do
>>anything that would explain your observed behavior. The GIL is not the
>>issue here either - it won't interfer with blocking IO.
>
>I will have a look at pyserial - have never used it before.
>
>I agree that it is probably not a Python issue, and that the GIL is
>irelevant - I was hoping that someone had already travelled the road
>and
>could give me a signpost.
>
>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.
>
>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.
One strategy you might employ to get rid of the busy looping is to use
Twisted and its serial port support. This also addresses the full-
duplex issue you've raised.
Jean-Paul
More information about the Python-list
mailing list