libftdi Archives

Subject: Re: Encoding of baudrate divisor and subdivisor

From: Jim Paris <jim@xxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 23 Oct 2009 13:43:54 -0400
Bas van Dijk wrote:
> Hello,
> 
> I'm trying to understand how the baudrate divisor and subdivisor are
> encoded in the value and index fields of a 'SIO_SET_BAUDRATE_REQUEST'
> control request.
> 
> I looked at the 'ftdi_convert_baudrate' function which does the actual
> encoding but failed to understand how the encoding really works.
> 
> What I basically want to know is given a divisor for example: 3 and
> subdivisor: 0.125 (1/8) how these values are encoded in the value and
> index fields.

x = 32-bit temporary register
The divisor is stored directly in x[13..0]
The subdivisor is encoded into x[16..14] using the mapping in AN232B-05
value[15..0] is from x[15..0]
index[15..0] is from x[31..16]
except on ft2232c, where:
  index[15..8] is from x[23..16]
  index[7..0] is the interface number

Check the libftdi source and ftdi_sio.c Linux driver for examples

-jim

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

Current Thread