USB 3.0 Programming in VB (simple question regarding calling functions)

Linas, Sat Dec 31 2016, 10:45AM

Hello,
For the fun i try to write and test all USB 3.0 functions from D3xx library.

So far get number of devices and was able to open and get handle. Now i want to toggle GPIO to see how much speed i can get between transfers. Because in my original program if i can't get faster than 1ms between transfers ( very short ones ) I will use FT232 in MPSSE mode that can be connected directly to ARM.

Problem i am facing is something wrong with my call or definition of function, can any one spot the problem ?

In programming manual:

FT_STATUS FT_EnableGPIO(FT_HANDLE ftHandle, UINT32 u32Mask, UINT32 u32Dir)

in VB i have to declare it:

Private Declare Function FT_EnableGPIO Lib "C:\FTD3XX.dll" Alias "FT_EnableGPIO" (ByVal pftHandle As ULong, ByValMask As ULong, ByValDir As ULong) As Integer

And i call it like this:

Private ftHandle As Integer = 0
Private ftStatus As Integer = 0
Dim Flags As UInt32 = &H10

ftStatus = FT_Create(Index, Flags, ftHandle)
Sleep(1000)
Flags = 2
ftStatus = FT_EnableGPIO(ftHandle, Flags, Flags)

Note that i get correct FTHandle, so this is not a problem, problem arises than i call FT_EnableGPIO, debugger says:


1483181075 1143 FT0 Error


Does any one know how to fix this ? Millions Thanks :)