libftdi Archives

Subject: BUG: CBUS Bitbang Mode Breaks the ftdi_set_baudrate function

From: Logan Gunthorpe <logang@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 30 Mar 2010 10:23:55 -0600
Hi,

I've found a bug which has been introduced into libftdi 0.17. The bug did not exist in 0.16.

I'm using a FT232R as a serial port with the CBUS in bit bang mode.

The problem is after configuring the CBUS with ftdi_set_bitmode, I can no longer set the baudrate correctly.

I believe the bug is on the second last line of the ftdi_set_bitmode function. In 0.17 it is:

ftdi->bitbang_enabled = (mode == BITMODE_RESET) ? 0 : 1;

In 0.16 it is:

ftdi->bitbang_enabled = (mode == BITMODE_BITBANG || mode == BITMODE_SYNCBB)?1:0;

The ftdi->bitbang_enabled flag appears to cause the baudrate set to be multiplied by 4. Therefore, in 0.16 when the mode is BITMODE_CBUS the flag is not set and setting the baudrate functions correctly. In 0.17 the flag gets set and the baudrate can no longer be changed without dividing it by 4 first.

I'm not sure about the other bit bang modes, but perhaps this change should be revisited.

Thanks,

Logan

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