ftd2xx.dll error to get device information

7 views (last 30 days)
Danilo
Danilo on 10 Jul 2014
Hi, I'm trying to communicate matlab with FTDI 4232. I load the library ftd2xx.dll, open it by FT_Ope n (which is returning 0 for 'connected', 2 for 'not connected' and 3 for 'already connected') and then I just try to get some device information just to have sure that they were connected but with not success.
I tried to use FT_GetDeviceInfoDetail but none of my variable are changed by pointers used in function.
Here is this part of the code: (Have someone any advises?)
%% LOAD DLL [notfound,warnings]=loadlibrary('C:\Users\Danilo\Documents\TSW1400_MATLAB\DLL_Files\ftd2xx.dll', 'C:\Users\Danilo\Documents\TSW1400_MATLAB\DLL_Files\ftd2xx.h');
%% OPEN FTDI dw_handlevalue = int32(0); lpdw_handle = libpointer('int32Ptr', dw_handlevalue); status = calllib('ftd2xx', 'FT_Open', 0, lpdw_handle);
%% CREATE VARIABLES AND POINTERS dw_Index = int32(0);
dw_Flags = uint32(0); lpdw_Flags = libpointer('uint32Ptr', dw_Flags);
dw_Type = uint32(0); lpdw_Type = libpointer('uint32Ptr', dw_Type);
dw_ID = uint32(0); lpdw_ID = libpointer('uint32Ptr', dw_ID);
dw_Locld = uint32(0); %Device Location ID lpdw_Locld = libpointer('uint32Ptr', dw_Locld);
c_SerialNumber = char('0'); %pc_SerialNumber = libpointer('char', c_SerialNumber); pc_SerialNumber = libpointer('voidPtr');
c_Description = char('0'); %pc_Description = libpointer('char', c_Description); pc_Description = libpointer('cstring',c_Description);
%% dw_NumDevs = uint32(0); lpdw_NumDevs = libpointer('uint32Ptr', dw_NumDevs); ft_status = calllib('ftd2xx', 'FT_CreateDeviceInfoList', lpdw_NumDevs);
%% GET DEVICE DETAIL %
ft_status = calllib('ftd2xx','FT_GetDeviceInfoDetail', dw_Index, lpdw_Flags, lpdw_Type, lpdw_ID, lpdw_Locld, pc_SerialNumber, pc_Description, lpdw_handle);

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!