Talking to a usb device (serial terminal)

Grant Edwards grante at visi.com
Mon Mar 3 17:10:19 EST 2008


On 2008-03-03, blaine <frikker at gmail.com> wrote:

> I do have a question though.  In the termios module, I am attempting
> to set the baud rate to 921600, which is what we use with
> 'cutecom' (because minicom does not have this as an option) and is
> what the supplier recommends.  When I try to set the rate using
> termios.tcsetattr(), I get an Argument Error.

What values are you using for ispeed and ospeed?  Those values
are special (and rather arbitrary) constant bit-patterns and
not simply integers like 9600 or 115200.

> I do not get this when I use an existing baud rate, such as
> termios.B9600.  Is there a way I can get around this? We would
> like to use it at full speed.

It looks like the fastest speed supported by python termios on
Linux is B460800 (uses a constant of 0x1004).  If you look in
/usr/include/..., baud rates do go up to 921600 (which uses a
constant of 0x1007).

Try using the appropriate constant from /usr/include/... (for
the target platform, of course).

-- 
Grant Edwards                   grante             Yow! Please come home with
                                  at               me ... I have Tylenol!!
                               visi.com            



More information about the Python-list mailing list