cyusb_linux Device Type

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

cross mob
lock attach
Attachments are accessible only for community members.
E_521156
Level 4
Level 4
100 sign-ins 50 replies posted 50 sign-ins

Hi,
I connect my FX3 card to USB port, it shows FX3 in device type. after programming .img file, it recognize my device type as FX2 in cyusb_linux. why? I attached the screenshot.

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

Hello,

Thank you for helping in debugging by sharing the source code snippet.

I found that vendor command is being handled in the firmware. So when r = cyusb_control_transfer(h, 0xC0, 0xA0, 0xE600, 0x00, &byte, 1, 1000); is called it will send a vendor command to the device.

In default firmware, this vendor command request is not handled and the device stalls that transfer.

Below is the USB trace when device enumerates as FX3 and vendor request is not handled

fx3_enumeration.PNG

As a vendor request was handled in the firmware you shared without parsing the bRequest ( you can refer to bRequest parsing done in i2cregmode example of the SDK). Due to improper handling of vendor command some data was sent to host using CyU3PUsbSendEP0Data instead of stall. This made the return value of  cyusb_control_transfer(h, 0xC0, 0xA0, 0xE600, 0x00, &byte, 1, 1000); as 1 i.e. FX2 was set as the device name.

The below trace shows that data is sent successfully ( as the vendor request is handled)

FX2_enumeration.PNG

You can check this at your end by commenting out the code where vendor request is handled and then program fx3

Please let me know if any queries in this

Regards,

Rashi

Regards,
Rashi

View solution in original post

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

Hello,

Please let me know whether the FX3 is programmed with some firmware .img file or in boot loader mode.

Also check that the device is bind to proper driver. Please refer to this KBA LINUX Drivers for USB Devices - KBA87010 and confirm that you are using latest SDK version

Regards,

Rashi

Regards,
Rashi
0 Likes

Hello,

I test 2-ways:
1- I made an .img file in Windows, load on EEPROM by control center in windows, remove jumper J4. and connect to my linux server.
2- I made an .img file in Windows, load it in RAM from Cyusb_linux.

in both ways, it shows FX2 in device type

I am using the last SDK version.
Thanks

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

Hello,

Please let me know how is it enumerated when no .img file is programmed. i.e. when the device is in  boot loader mode

Please send a snippet of the utility

Regards,

Rashi

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

it is in bootloader mode without any .img file

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

Hello,

In the snippet you shared, the device enumerates as FX3 device which is as expected

After programming the FX3 is it enumerating as FX2 device? Please send the whole snippet of utility after programming FX3 (i.e. when the device enumerates as FX2)

Please share the firmware you are using for programming FX3

Regards,

Rashi

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

Hi,
yes, as I mentioned in the first post, after programming it is enumerating as FX2.

I attached the firmware and snippets.
Thanks

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

Hello,

Thank you for the confirmation.

I will be checking the firmware at my end. Meanwhile can you just program the FX3 with some default firmware from the SDK and check how is it enumerating. You can check with default bulksrcsink example of the SDK

Regards,

Rashi

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

Hi,
I just check Bulksrcsink example, it also is enumerating as FX3. i attached the screenshots.

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

Hello,

As on programming FX3 with default firmware the enumeration is correct, it seems that there is some problem in the descriptors of your firmware.

Please share the dscr.c file used in the firmware. If possible the whole firmware.

Regards,

Rashi

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

I attached whole firmware. I don't think that it is related to dscr file, because i didn't change it ever.

I should mention that in the control center (windows) I see that  Product="FX3" in descriptor Info.
But with the same .img file, I see FX2 in Cyusb_linux. Actually I am not sure that these two fields are equivalent or not.

In  cyusb_linux_1.0.5\gui_src\main.cpp, there is a function that can be a clue, but unfortunately i couldn't interpret  cyusb_control_transfer.

static void detect_device(void)

{

int r;

unsigned char byte = 0;

r = cyusb_control_transfer(h, 0xC0, 0xA0, 0xE600, 0x00, &byte, 1, 1000);

if ( r == 1 ) {

mainwin->label_devtype->setText("FX2");

enable_vendor_extensions();

mainwin->tab_4->setEnabled(TRUE);

mainwin->tab_5->setEnabled(FALSE);

mainwin->tab2->setCurrentIndex(0);

}

else {

mainwin->label_devtype->setText("FX3");

disable_vendor_extensions();

mainwin->rb3_custom->setChecked(TRUE);

mainwin->tab_4->setEnabled(FALSE);

mainwin->tab_5->setEnabled(TRUE);

mainwin->tab2->setCurrentIndex(1);

}

}

Thanks

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

Hello,

Thank you for helping in debugging by sharing the source code snippet.

I found that vendor command is being handled in the firmware. So when r = cyusb_control_transfer(h, 0xC0, 0xA0, 0xE600, 0x00, &byte, 1, 1000); is called it will send a vendor command to the device.

In default firmware, this vendor command request is not handled and the device stalls that transfer.

Below is the USB trace when device enumerates as FX3 and vendor request is not handled

fx3_enumeration.PNG

As a vendor request was handled in the firmware you shared without parsing the bRequest ( you can refer to bRequest parsing done in i2cregmode example of the SDK). Due to improper handling of vendor command some data was sent to host using CyU3PUsbSendEP0Data instead of stall. This made the return value of  cyusb_control_transfer(h, 0xC0, 0xA0, 0xE600, 0x00, &byte, 1, 1000); as 1 i.e. FX2 was set as the device name.

The below trace shows that data is sent successfully ( as the vendor request is handled)

FX2_enumeration.PNG

You can check this at your end by commenting out the code where vendor request is handled and then program fx3

Please let me know if any queries in this

Regards,

Rashi

Regards,
Rashi
0 Likes