How to change USB Vendor ID and Product ID programmatically?

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

cross mob
didi_4657011
Level 1
Level 1
10 sign-ins 5 sign-ins First reply posted

Hello,

I want to release board with vendor ID purchased from USB.org.

Each board must have the same USB Vendor ID but different Product ID.

I don’t want to change manually the Product ID and rebuild the project for each board separately.

My board based on psoc5LP CY8C5868LTI-LP038. It conations fast speed USB (USBFS).

I think of writing the Product ID into the EEPROM and then set the value to usb Product ID…

I it possible to change USB Vendor ID and Product ID programmatically (not via dialog)?

If the answer is yes , how can it be done?

Best regards,

Dima

0 Likes
1 Solution
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Yes, that's possible.

The Product ID is part of the descriptor. It is located in USBFS_descr.c file generated by the USBFS component. If you want to modify the descriptor, you can set the macro USER_SUPPLIED_DESCRIPTORS and define your own descriptor, including the Product ID.

View solution in original post

0 Likes
2 Replies
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Yes, that's possible.

The Product ID is part of the descriptor. It is located in USBFS_descr.c file generated by the USBFS component. If you want to modify the descriptor, you can set the macro USER_SUPPLIED_DESCRIPTORS and define your own descriptor, including the Product ID.

0 Likes
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Dima,

May I ask why you want to set 'unique' PIDs?

Setting a unique PID has its own challenges.

  • Making sure at manufacturing time each unit has a unique number.
  • There are only 65536 combination of PIDs to assign.   Once you use up ALL the PIDs you effectively need to purchase another VID.
  • The USB configuration .inf file is usually dependent on the VID and PID.  Therefore a unique .inf may be needed to configure each uniquely numbered PID.

There may be other methods to use to create and manage a 'uniqueness' in your products.  The most common method is to assign a 'unique' serial number.

In the USB definition, there is a query for the USB device serial number.  This is so that products built in the thousands if not millions can have the same VID and PID and the product can be differentiated on the same system by way of the unique serial number.

Serial numbers can be assigned:

  • Manually.  Laborious can prone to mistakes.
  • The manufacturing process assigns a build number that is unique.  This usually include:
    • build date
    • build time
    • build manufacturing line
    • other relevant HW variations.
  • Use the PSoC's uniquely assigned Silicon ID.  It is a 64-bit number.   This is the method commonly used by USB devices. 
    The PSoC UART (COM:) serial driver uses the Silicon ID to differentiate and enumerate each COM device configured with its' Silicon ID.  Using the same VID and PID, the system uses the SAME driver but assigns a new (next in sequence) COM port when it finds a USB.   
    One of my systems has the COM enumeration up to COM115 because I have created about 113 PSoC serial comm devices with the same VID and PID.   At any time, I can at anytime place a number of my PSoC serial devices on this same computer and through the COM number assignment communicate to each one at the same time.

Hopefully this has helped you.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes