libftdi Archives

Subject: Re: libftdi-1.0: More patches

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 2 Sep 2011 16:49:00 +0200
>>>>> "Thomas" == Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> writes:

...
    Thomas> Also you can focus on single tests only with this:
    Thomas> "./test_libftdi --run_test=Baudrate/Type232HFixedBaudrates"

    Thomas> The output of the unit test is not that pretty as I put the
    Thomas> actually testing in a generic function. Usually that's a no no,
    Thomas> but I didn't want to duplicate the code for every chip
    Thomas> type. Maybe a macro can come to the rescue here.

The one basic is the description in the datasheet:
Baud Rate Generators - The Baud Rate Generators provides a x16 or a
x10 clock input to the UART's from a 120MHz reference clock and
consists of a 14 bit pre-scaler and 4 register bits which provide fine
tuning of the baud rate (used to divide by a number plus a fraction). This
determines the Baud Rate of the UART which is programmable from 183 baud to
12 Mbaud. See FTDI application note AN_120 on the FTDI website for more
details.

The other basic is how this bits get stuffed in the USB request. I didn't
find any documentation about it. AN_120 is not explicit. Have you more
information? 

I wrote the code with a strong look at the corresponding calculations in
/usr/src/linux/drivers/usb/serial/ftdi_sio.c and a test with the scope. For
the cases I tested, I saw somehow sensible results. However with the RS232
pattern you can't easily measure exact frequency with the scope.

What are your doubts? A slight misscalcuation and bad rounding in my code or 
values really far off the set value. The last case I can easily test with
the scope. Perhaps tell the setting that you expect a bigg error. It is
quite easy to test now with examples/serial.

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread