Re: Getting nonstandard serial baud rates w/FTDI
- From: Bernd Walter <ticso@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Oct 2007 03:01:33 +0200
On Thu, Oct 25, 2007 at 10:11:36AM +1000, Antony Mawer wrote:
On 25/10/2007 8:59 AM, Bernd Walter wrote:
On Wed, Oct 24, 2007 at 09:53:06AM -0700, Brooks Talley wrote:...
Hi, everyone. I'm pulling my hair out in great chunks.
I need to get Python 2.5, using pyserial 2.2, to open a FTDI-based usb to
serial port at 250000 baud. The FTDI chip definitely supports this rate.
The port mounts at /dev/cuaU0.
The problem is that
/usr/local/lib/python2.5/site-packages/serial/serialposix.py fails on
this line:
ispeed = ospeed = getattr(TERMIOS,'B%s' % (self._baudrate))
Any ideas on how to get this to work? It doesn't seem like it should be
this difficult!
You need to add support in the uftdi driver itself.
There is an enum containing ftdi_8u232am_* fields and a switch/case in
the driver.
The hex value divides the 48MHz clock and leaves a factor 8.
So 0x0018 should be the right value for 250000bps.
There is an OpenBSD patch to calculate the rates dynamically:
http://archive.openbsd.nu/?ml=openbsd-tech&a=2006-06&m=2083975
Something similar (but in better style IMHO) is commited to OpenBSD,
which we should merge into our source.
There looks to me to be an issue with an assignment operation (=) rather
than equality test (==) in the following section of the patch:
+ /* Special cases for 2M and 3M. */
+ if ((speed >= UI(3000000 * 0.97)) && (speed = UI(2000000 * 0.97)) \
&& (speed <= UI(2000000 * 1.03))) { result = 1; goto done; }
I would imagine the "(speed = UI(2000000 * 0.97))" should be == rather
than = for this to make sense...?
Use the OpenBSD code instead - it is tested and generaly looks better.
You can easily get their diffs via cvs.
Rev 1.11 of uftdireg.h and 1.29 of uftdi.c
--
B.Walter http://www.bwct.de http://www.fizon.de
bernd@xxxxxxx info@xxxxxxx support@xxxxxxxx
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- Re: Getting nonstandard serial baud rates w/FTDI
- From: Brooks Talley
- Re: Getting nonstandard serial baud rates w/FTDI
- References:
- Getting nonstandard serial baud rates w/FTDI
- From: Brooks Talley
- Re: Getting nonstandard serial baud rates w/FTDI
- From: Bernd Walter
- Re: Getting nonstandard serial baud rates w/FTDI
- From: Antony Mawer
- Getting nonstandard serial baud rates w/FTDI
- Prev by Date: Re: Getting nonstandard serial baud rates w/FTDI
- Next by Date: Re: Serial speed for boot device selection prompt
- Previous by thread: Re: Getting nonstandard serial baud rates w/FTDI
- Next by thread: Re: Getting nonstandard serial baud rates w/FTDI
- Index(es):
Relevant Pages
- OpenBSD & Serial LCD
... i am a little experienced in OpenBSD, but I am not able to use my LCD ... It
is connected to a serial port on my i386, ... But under OpenBSD it does not do anything.
... The LCD does not have modem control signals, ... (comp.unix.bsd.openbsd.misc) - Re: OpenBSD & Serial LCD
... > i am a little experienced in OpenBSD, but I am not able to use my LCD ...
> So my conlusion is that I need to manipulate the serial port is a certain ... >
(probably it is still using modem control signals) ... (comp.unix.bsd.openbsd.misc) - Re: OpenBSD & Serial LCD: Solution
... Today I installed OpenBSD 3.5, and now I have the same devices as under ...
> i am a little experienced in OpenBSD, but I am not able to use my LCD ... > So
my conlusion is that I need to manipulate the serial port is a certain ... > (probably
it is still using modem control signals) ... (comp.unix.bsd.openbsd.misc)