From: Allen Hill on
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?
From: Allen Hill on

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.
From: Allen Hill on
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
From: Rebecca on
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(a)yahoo.com> wrote in message <ho7u35$nb3$1(a)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.