|From:||Will Zhang <wilzzha@xxxxxxxxx>|
|Date:||Tue, 24 Aug 2010 18:21:40 +1000|
Take a look at this application note from FTDI, particularly part II.
FTDI recommends using hardware flow control/handshaking to prevent chip buffer overrun.
This FAQ has info on how CTS/RTS work on FTDI chips.
However though, I think there's a bug with libftdi's flow control setting function. Here's what I know:
My configuration involves an FT232R in UART mode connected to an FPGA. The FPGA has UART transmitter implemented in HDL with CTS input (which is connected to the RTS output on FT232R) as flow control option.
Ideally, if the FPGA is sending data non-stop but meanwhile the PC cannot keep up with it's pace (USB driver is not scheduled frequent enough to move data from chip buffer to the PC), the chip buffer will fill up quickly and the RTS line will go high (RTS# is active low) to indicate buffer full. Then the FPGA UART Tx should stop transmitting data in order to prevent buffer overrun on the FT232R.
The problem I've found is that many driver options did not set the flow control register in the FT232R chip correctly. I have experimented numerous driver options on the PC side, some worked, many didn't.
Here's a list:
These drivers are not working correctly, RTS line is constantly high, which is the behavior when flow control is set to NONE.
- FTDI's D2XX library (binary release only) on Linux and Mac OS X
- ftdi_sio VCP kernel module on Linux (This is the Linux VCP driver on FTDI's website)
- libftdi on Linux and Mac OS X
These drivers are working correctly, RTS is high when buffer is nearly full, low otherwise.
- FTDI's VCP kernel extension (binary release only) for Mac OS X
- FTDI's VCP driver (binary release only) for Windows
I haven't tested D2XX DLL driver on Windows.
Apparently, I'm not the first one to report this issue. This is an archived conversation that had described the same problem:
Note that for all these drivers, the CTS/RTS flow control works fine in the other direction, FPGA -> FT232R in my case.
Any suggestions? Should I report this to FTDI, Bill Ryder maybe?
2010/8/24 Szőke Sándor - Alex <mail@xxxxxxxxxxxxxx>