Configuring the USB serial number in EZ-USB (AN21xx/FX/FX1/FX2/FX2LP)

Question: How do we configure the USB serial number in the CY7C68013A?

 

Answer:

If you want to add a serial number to your descriptor file then you will need to assign a string index for the serial number field in the descriptor. Then you have to modify the string descriptor with that index into a serial number as shown below:

Consider the descriptor below in the dscr.a51 (in the framework code provided for keil uVision environment this is the file that stores the descriptors) file as the device descriptor.

DeviceDscr:
db DSCR_DEVICE_LEN ;; Descriptor length
db DSCR_DEVICE ;; Decriptor type
dw 0002H ;; Specification Version (BCD)
db 00H ;; Device class
db 00H ;; Device sub-class
db 00H ;; Device sub-sub-class
db 64 ;; Maximum packet size
dw 4705H ;; Vendor ID
dw 0210H ;; Product ID (Sample Device)
dw 0000H ;; Product version ID
db 1 ;; Manufacturer string index
db 2 ;; Product string index
db 3 ;; Serial number string index
db 1 ;; Number of configurations

Following is the string descriptor if the serial number is 12345
StringDscr3:
db StringDscr3End-StringDscr3 ;; Descriptor length
db DSCR_STRING
db '1',00
db '2',00
db '3',00
db '4',00
db '5',00
StringDscr3End: