FTDI Community

General Category => Discussion - Software => Topic started by: knut on December 20, 2021, 12:04:48 PM

Title: FTDI D2XX - How to send control transfer message?
Post by: knut on December 20, 2021, 12:04:48 PM

I am using the FTD2XX library to communicate with a device, from a Windows PC.

I have been able to successfully connect to the device, and to receive a data stream from it.

However, I need to send control messages (URB_CONTROL) to the device.
I have tried to find out how to do this by reading the documentation, but I haven't found anything.
How can I do this?

Title: Re: FTDI D2XX - How to send control transfer message?
Post by: FTDI Community on December 20, 2021, 04:43:54 PM
Hi
I need to check with colleagues but i believe that URB would be accessing the device without/rather than the FTDI driver. 
Have you looked at the D2xx programmers guide to see if there is a relevant function within D2xx?
https://ftdichip.com/wp-content/uploads/2020/08/D2XX_Programmers_GuideFT_000071.pdf (https://ftdichip.com/wp-content/uploads/2020/08/D2XX_Programmers_GuideFT_000071.pdf)

Regards
FTDI Community
Title: Re: FTDI D2XX - How to send control transfer message?
Post by: knut on January 03, 2022, 08:16:21 AM
Thank you for the quick answer. My response is slow due to the holidays.

After some more research, it looks like the messages correspond to certain operations (Reset, Set latency time, etc...).
I will have to read the D2xx programmers guide carefully again and see if I can find corresponding functions for each of the operations.
I'll post again if I resolve the issue.

Bonus question:
Is it possible to combine use of the D2xx and libusb? (i.e. is it possible to get a libusb-style handle to the device which has been connected to using FT_Open?)

Title: Re: FTDI D2XX - How to send control transfer message?
Post by: knut on January 06, 2022, 12:33:23 PM
Update: It works now. :)


In case anyone finds this thread and is curious, there are the commands I ended up using in the initialization (after opening the device):

FT_ResetDevice(ftHandle)
FT_SetLatencyTimer(ftHandle, 16)
FT_W32_GetCommModemStatus (ftHandle, &modemStatus)
FT_SetDataCharacteristics(ftHandle, FT_BITS_8, FT_STOP_BITS_1, FT_PARITY_NONE)
FT_SetFlowControl(ftHandle, FT_FLOW_NONE, 0, 0)
FT_SetDtr(ftHandle)
FT_SetChars(ftHandle, 0, 0, 0, 0)


(Of course, there is also some code around these, including checking return values, etc. These are just the FT_ function calls.)