Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Dynamically Changing Descriptor

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Dynamically Changing Descriptor
Moderator:
RSKV

Post Reply
Follow this topic



Dynamically Changing Descriptor

wdolson posted on 09 Feb 2011 6:30 PM PST
Senior Member
17 Forum Posts

Discussing the issue of multiple devices with my customer.  They suggested that we could put jumpers or DIP switches on the board and change something in the descriptor to reflect the switch settings. 

I experimented trying to change the device descriptor in code at start up, but it didn't appear to show up in the descriptor received by the PC.  In main() after TD_Init(), I did the following:

*((BYTE *)DeviceDscr+16) = 0x55;

This should have changed the Serial Number.  I tried changing other offsets with no results on the PC side.  I also tried changing it in a couple of other places in the code.

I'm probably missing something obvious.

Bill




Re: Dynamically Changing Descriptor

Shub posted on 21 Feb 2011 04:05 AM PST
Cypress Employee
27 Forum Posts

Hi Bill,

I have made an example project for you which demonstrates how you can change the device descriptor dynamically.I have tested at my end using Keil compiler and its working fine.

I took the basic bulkloop example and did the following changes:
1. Added another device descriptor with name DeviceDscr1, and changed the vid and serial number in file dscr.a51.

2. In dscr.a51 also added DeviceDscr1 in the public definition(Line 32).
3. Declared DeviceDscr1 as extern in fx2.h(Line 297).
4. In fw.c I added this code
if( flag )
pDeviceDscr = (WORD)&DeviceDscr;
else
pDeviceDscr = (WORD)&DeviceDscr1;
so this will choose the descriptor according to the flag value.Instead you can add your logic to choose the descriptor and you can add more device descriptors similarly.

I have attached the project, Please let me know if you can see it working at your end.

Regards,
Shubham






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20