Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Aug 2005 11:36:38 +0200
From:      Bernd Walter <ticso@cicely12.cicely.de>
To:        User Tomdean <tomdean@speakeasy.org>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: Interfacing FT245BM With Ucom
Message-ID:  <20050826093638.GU37930@cicely12.cicely.de>
In-Reply-To: <200508200344.j7K3irmQ021004@asus.tddhome>
References:  <200508200344.j7K3irmQ021004@asus.tddhome>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 19, 2005 at 08:44:53PM -0700, User Tomdean wrote:
> I am running FreeBSD 5.4, GENERIC.
> 
> I have a UMP2 module based on the FTDI FT8U245BM chip, a USB to
> parallel chip.  The module in intended to interface processors like
> the AVR or 68HC1x to the USB.  I am using the FTDI ATmega16, clocked
> at 16 mHz.
> 
> My project will have 3 or 3 bytes put into the USB every 6.0 to 7.8
> uSec or every 11.2 to 12.8 uSec, depending on the degradation of
> precision due to over-clocking the ATMega16 ADC.
> 
> Most of the data flow is into FreeBSD.  So, I need about 0.75 mBytes
> thruput.  Maybe a few bytes per second out of FreeBSD.
> 
> The UMP2 is recognized as a ucom device,
> 
> vendor  0x0403
> product 0x6001
> release 0x0200
> 
> If I 'kldload uftdi', I get uftdi.ko and ucom.ko loaded.  Then,
> powering up the UMP2 results in the device being connected.  From
> dmesg:
> 
> ucom0: FTDI USB HS Serial Converter, rev 1.10/2.00, addr 2
> 
> I can connect to the device with tip.  But, I cannot disconnect!  '~.'
> displays [EOT] but tip does not exit.  I can disconnect as root!  The
> device is 
> 
> crw-rw----  1 uucp     dialer    232, 128 Aug 18 04:43 ucom0
> 
> When tip is hung,
> # ps
> ...
> 1001 17030   553   0   6  0  1272   728 ttywai IE+ p1 0:00.00 /usr/bin/tip ucom
> 1001 17031 17030   0 -84  0     0     0 -      Z+  p1 0:00.00 <defunct>
> ...

There shouldn't be any differences about which user opens the device,
but you may want to retest with 6.0.
PHK did a massivly update on tty-layer, lots of ucom shortcomings have
been identified.

> I have to cycle power on the UMP2 to get tip to exit!  And, cycle
> power on the UMP2 to get it recognized again!.  Sometimes, it takes
> several minutes before one of the drivers gets in sync with the
> hardware.
> 
> BTW, the behavior of tip has changed from a UNIX-style 0x0a to a
> WINDOZE style 0x0d,0x0a to get UNIX display behavior!
> 
> I plan to try tip with ucom0 with an echo process in the AVR to just
> return any char received by the UMP2.
> 
> Can I get the 0.75 mByte thruput with uftdi driver, accessed thru
> ucom?

Yes - as long a nothing else is using the same USB channel you can
expect rates of up to 1MByte/s.

But you shouldn't expect transmission of injected bytes in less than a
few msec, as tranporting bytes mean starting a new request, which then
get scheduled on the next USB frame - a USB frame is started every 1ms.
In case of the FTDI-chip it is buffered by default for full 10ms unless
the receive buffer of the FTDI gets full.

I asume it is the AVR sending just a few bytes, otherwise you may see
reduced bandwidth because of this.
Ideally you should inject a few hundret bytes at once for transmission
from userland to the USB hardware - don't know how good the tty-code
can cache this problem by buffering.
Your userland application should also read with large requests whenever
possible.

-- 
B.Walter                   BWCT                http://www.bwct.de
bernd@bwct.de                                  info@bwct.de




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050826093638.GU37930>