Thread Subject: Matlab and FTDI VCP drivers

Subject: Matlab and FTDI VCP drivers

From: Allen Hill

Date: 21 Mar, 2010 20:59:06

Message: 1 of 4

I'm trying to use the FTDI 245 USB chip with Matlab and VCP (virtual com port) drivers.
I'd like to just use simple serial I/O commands in Matlab.

Anyone with any experience doing this?

Subject: Matlab and FTDI VCP drivers

From: Allen Hill

Date: 22 Mar, 2010 14:16:05

Message: 2 of 4


More detail on my travels. I have the UM245R module that plugs into the USB port. When inserted it shows up on COM4 in the Control Panel.

I can use the Matlab serial command to open COM4, I'm just not sure how to open the acutal device using serial commands and then how to set up the device and send commands. Any examples that may help?
Thanks.

Subject: Matlab and FTDI VCP drivers

From: Allen Hill

Date: 22 Mar, 2010 19:53:02

Message: 3 of 4

Now it turns to travails. I can't find any reference to using the VCP and Matlab serial I/O directly with the FTDI. I did find an example for direct access to the FTDI, but can't seem to open the device (displays, 'open error'). Please see the snipet below. Any suggestions?

loadlibrary('ftd2xx.dll', 'ftd2xx.h');
h=libpointer('uint32Ptr', uint32(0));
disp('opening');
s=calllib('ftd2xx', 'FT_Open', 0, h);
if (s ~= 0)
disp('open error');
return;
end
disp('set baud rate');
s=calllib('ftd2xx', 'FT_SetBaudRate', h, 9600);
if (s ~= 0)
disp('set baud rate error');
return;
end

Subject: Matlab and FTDI VCP drivers

From: Rebecca

Date: 25 Mar, 2010 10:38:06

Message: 4 of 4

Hi Allen,

I'm doing the same kind of thing and having lots of trouble communicating too. The VCP commands I've tried are:

USB = serial('COM3');
fopen(USB);
fwrite(USB, 5, uint8); // defaults to uchar
fclose(USB);

Now this did work for me when I tested it before Christmas but I can't for the life of me get a response now... though the TXE and RXF lines do respond to the commands and stay low allowing data through I never see anything on the data bits.

The second lot of code you used with the libraries requires the driver files to be installed, but at the same time I can't quite get that working either, there's another thread that insinuated the header file that comes with the drivers isn't correct, but I had no response on that thread about an actual correct header file and I don't know enough to re-write one myself.

"Allen Hill" <allenanalog1@yahoo.com> wrote in message <ho7u35$nb3$1@fred.mathworks.com>...
>
> More detail on my travels. I have the UM245R module that plugs into the USB port. When inserted it shows up on COM4 in the Control Panel.
>
> I can use the Matlab serial command to open COM4, I'm just not sure how to open the acutal device using serial commands and then how to set up the device and send commands. Any examples that may help?
> Thanks.

Tags for this Thread

Everyone's Tags:

usb(2), ftdi(2), vcp(2), serial, dll, header

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
vcp Rebecca 25 Mar, 2010 06:39:27
header Rebecca 25 Mar, 2010 06:39:27
dll Rebecca 25 Mar, 2010 06:39:27
serial Rebecca 25 Mar, 2010 06:39:27
ftdi Rebecca 25 Mar, 2010 06:39:27
usb Rebecca 25 Mar, 2010 06:39:27
vcp Allen Hill 21 Mar, 2010 16:59:14
ftdi Allen Hill 21 Mar, 2010 16:59:14
usb Allen Hill 21 Mar, 2010 16:59:14
rssFeed for this Thread

Contact us at files@mathworks.com