Multi FX3 Usb deivce

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Zenith
Level 3
Level 3
5 questions asked 100 sign-ins 25 replies posted

I have two FX3 Usb3 devices. and I am developing by referring to the Api manuals and source provided in the SDK.

But it doesn't work as expected.
Here's a brief summary of my routine:

  1. m_USBDevice = new CCyUSBDevice(this->m_hWnd, CYUSBDRV_GUID, true);
  2. m_DeviceCount = m_USBDevice->DeviceCount();
  3. m_USBDevice->Open(0) ;
  4. Pt1_1 = (CCyBulkEndPoint*)m_USBDevice->EndPoints[1];
  5.  {...}
  6. m_USBDevice->Open(1) ;
  7. Pt1_1 = (CCyBulkEndPoint*)m_USBDevice->EndPoints[1];
  8. .......

In this case, control of Pt2_1 for device0 is possible, but the operation for “Pt1_1” does not work properly.

What should I do when I want to control two or more devices at the same time?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please find the attached console application which works at my end (snippet attached)

Password: cyapi

Regards,
Rashi

View solution in original post

0 Likes
21 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

From the description, I understand that you cannot access the second device connected to the host. Is my understanding correct?

If yes, please confirm if both the devices are detected by USBDevice->DeviceCount(); 

After opening the device 1 please check if the device is opened successfully using IsOpen( ) 

or you can also try the below code snippet

if (USBDevice->DeviceCount() && !USBDevice->Open(1)) {
 // If Open() failed, retry Open() after resetting the device
 USBDevice->Reset();
 USBDevice->Open(1);
 }

 

Regards,
Rashi
0 Likes
Zenith
Level 3
Level 3
5 questions asked 100 sign-ins 25 replies posted

There was incorrect information. I'm sorry..

  1. m_USBDevice = new CCyUSBDevice(this->m_hWnd, CYUSBDRV_GUID, true);
  2. m_DeviceCount = m_USBDevice->DeviceCount();
  3. m_USBDevice->Open(0) ;
  4. Pt0_1 = (CCyBulkEndPoint*)m_USBDevice->EndPoints[1];
  5.  {...}
  6. m_USBDevice->Open(1) ;
  7. Pt1_1 = (CCyBulkEndPoint*)m_USBDevice->EndPoints[1];

In this case, control of "Pt1_1(device-1)" for  is possible, but the operation for “Pt0_1(device-0)” does not work properly.

USBDevice->DeviceCount returned two correct values.
Both the USBDevice->Open(0) and USBDevice->Open(1) functions returned true.
USBDevice->IsOpen() also returned true.
There are no errors in the related function.

 

 

 

 

 

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please let me know how many endpoints are there for device 0 and can the control endpoint be accessed?

Regards,
Rashi
0 Likes

Hello.

Input:3 /   Output3

The  ControlEndPoint of device-0 also doesn't work.

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please try to reset the device and check if the control endpoint is accessible.

If that doesn't work, please share the host application for us to check

Regards,
Rashi
0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

The host application source is not accessible.

Please attach as .zip with your post

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello.

File attached

thanks.

 

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Thank you for the details

Please confirm if both the devices are binded to the cyubs3 (v1.2.3.20 ) driver.

Also, please let me know if the issue is seen when the host app is run on different PC

Regards,
Rashi
0 Likes

I tested it with v1.2.3.20 version and several other PCs, but it still malfunctions.
I tested it with 3 devices as well.
open(0) : X
open(1) : X
open(3) : O
Only the last board works normally. The previous boards still do not work.

Have you ever tested two or more boards using C++?
If C++ is not supported, do I have to implement it in C#?

0 Likes
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please find the attached reference console application (C#). I am able to access two devices at my end.

Please test this and let me know if it works

Regards,
Rashi
0 Likes

Hello.

Thank you for your  support.

 

As a result of my analysis, it seems that multi-device control is possible using C#.

When " USBDeviceList usbDevices = new SBDeviceList(CyConst.DEVICES_CYUSB)" is called,
The two device information is correctly mapped in usbDevices parameter.

However, I want to use C++.
In C++, it should be open(i) as many as the number of devices.
It seems that the information of the device opened first is lost.


I want to know if C++ is possible.

(Otherwise, "*.tlb" files are required to use C# dlls in C++.

Can you provide "*.tlb"?)

 

 

0 Likes
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

More than 1 device can be opened by CYAPI as well.

Please find the attached example host application and the results

password: cyapi

 

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello.

Please check the attached file.

Simple code and comments were added.
Please check this part.

0 Likes
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please find the attached console application which works fine for me.

Please note that the ept1/2->ReqCode = 0x80  should be handled by the firmware. 

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hello.

A description of the test results for C++ and C# is attached.
please check

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

The problem described in the document seems to be strange. This is because from the Wireshark traces it seems that the data transfer is done to the BULK endpoint of device 5 but transfer to the bulk endpoint is not initiated by the host app.

Please try to initialize the buffer to zero before calling XferData. Also, please comment out the call for printing ept1/ ept2

You can also refer to Streamer application (C++) in FX3 SDK (C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\cpp\streamer) which allows the transfer to multiple devices

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.


Hello

Please, Check the attached file.

0 Likes
lock attach
Attachments are accessible only for community members.
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please find the attached console application which works at my end (snippet attached)

Password: cyapi

Regards,
Rashi
0 Likes

 

Hello.

I checked.
It works fine on my side too.
Thank you very much for your support.

CCyUSBDevice* USBDevice = new CCyUSBDevice(NULL);
CCyUSBDevice* USBDevice1 = new CCyUSBDevice(NULL);

Is this the correct way to use it?

 

 

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Apologies for late response

Yes, it can be used in the way it is done in the shared host application.

Regards,
Rashi
0 Likes