Hi. I have a similar problem. Have you been able to fix your Problem? Regards, Alex
I remember seeing the same problem. But I do remember that something inexplicable happened and it started to work.
I assumed it was some library linking magic (that is still inexplicable).
I know this is ambiguous and might not help much, nor am I a MATLAB expert. Can you try placing the .NET function in the Control Panel and link it to CyUSB.net?
If possible add the Matlab project here?
I meant link to Cyusb.dll.
Has anyone figured this out yet? I am currently stuck at the same step. I put CyUSB.dll in the same directory as my matlab .m file:
CyUSBdll = NET.addAssembly('C:\......\CyUSB.dll');
disp('CyUSB.dll already loaded');
% Create a list of USB devices
usbDevices = CyUSB.USBDeviceList(CyUSB.CyConst.DEVICES_CYUSB);
% USB Device Count
num_usbDevices = usbDevices.Count; % <=== returned 1 when the device is plugged in, 0 when it's not.
usbDevice = usbDevices.Item(0) % <===== matlab crashes here.
did you manage to figure it out ? I need to develop a similar application
Does anyone here has idea about how to interface Matlab to cyusb driver? I am working on building communication between Matlab and CY7C68013, but haven't got any good idea...
cyusb_lib = NET.addAssembly('d:\Matlab\FX3\CyUSB.dll') %Load the dll from wherever it is on your computer
devList = CyUSB.USBDeviceList(CyUSB.CyConst.DEVICES_CYUSB); % Fill a USBdeviceList object with all the details of the devices using the cypress driver
%you probably need to create callback functions for usb events (I called mine FX3_attach and FX3_detach). I haven’t made them useful yet but mine just looked like
function ret = FX3_detach(sender, args )
'detach callback called'
args.FriendlyName % prints the name of the device that was detached
then you can attach the listener using:
hAttached = addlistener(devList,'DeviceAttached', @FX3_attach);
hDetached = addlistener(devList,'DeviceRemoved', @FX3_detach);
% You can test the callbacks by pressing the reconnect button on the Cypress Control Centre
%loop through all the devices to find the one you want
for i=0: (devList.Count -1)
if ( devList.Item(i).FriendlyName == ‘Cypress FX3 USB BootLoader Device’); % or whatever you set the name to, could alternatively check Item(i).ProductID == 243
myDev = handle(devList.Item(i));
myEndpts = handle(myDev.Endpoints); % seems to be much easier if you create a handle to the endpoints as only the first of each type is automatically listed. while with a handle you can select any of them
myEndpts.Length %tells you how many you have
% myEndpts(1) should be the control endpoint
%for my code endpoints 3 and 4 are setup as bulk out and bulk in. they are also set to loopback data. So to send in data
%to receive data you need to set up a byte array first
rxBuffer = NET.createArray('System.Byte', length(data)); % fine as long as the length of the buffer is >= length of data returned
I have problem,
Why when I write in matlab devList.Item(0), matlab works no longer?
Without this feature you can not continue to work.
Does anyone have a solution for this?
I thank you in advance.
1 of 1 people found this helpful
Thank you very much ilw.
JoBlack you have to download new CyUSB.dll. It is the one for FX3 (FX2LP is suported). It can be found here http://www.cypress.com/?rID=57990. Under UsbSuite driver....
Hi, I have the same problem (devList.Item(0)) in Matlab and download latest version of CyUSB.dll under Cypress Suite USB 3.4.7 . The result is same. Also i see the c# sample code in CyUSB.NET.pdf. It uses an access method using VID/PID. I can't find this method in Matlab. It mat Prevent crashing. Do you have any idea? Are you tested CyUSB.dll in Matlab?
I had the same problem trying to talk to a Terasic DE2-115 board. I can confirm that using the CyUSB.dll from the latest version of the EZ-USB FX3 SDK fixes the problem. Thank you!