Hello all.
Quick question (hopefully)...
Just need to ask the easiest/best way to set the USB Serial Number in the descriptors for the USB Serial component?
Thanks,
Brendan
Defining USB Serial No. Descriptor for USB Serial Component
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Defining USB Serial No. Descriptor for USB Serial Component
Hi Brendan,
Assuming you are using an 8-bit PIC you need to edit the following file.
Paste this address into your File explorer, without the quotes.
"C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\USB"
Then open this file in a text editor.
usb_serial_descriptors.c
This is the line you are looking for, approx line 270 in the file.
//Language code string descriptor
const struct{uint8_t bLength;uint8_t bDscType;uint16_t string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409}};
I've highlighted the part to change.
Here is some information regarding the serial number....
Serial number string descriptor. If a serial number string is implemented, it should be unique for every single device coming off the production assembly line. Plugging two devices with the same serial number into a computer simultaneously will cause problems (in extreme cases BSOD).
Note: Common OSes put restrictions on the possible values that are allowed.
For best OS compatibility, the serial number string should only consist of UNICODE encoded numbers 0 through 9 and capital letters A through F.
ROM struct{BYTE bLength;BYTE bDscType;WORD string[10];}sd003={sizeof(sd003),USB_DESCRIPTOR_STRING,{'0','1','2','3','4','5','6','7','8','9'}};
Assuming you are using an 8-bit PIC you need to edit the following file.
Paste this address into your File explorer, without the quotes.
"C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\USB"
Then open this file in a text editor.
usb_serial_descriptors.c
This is the line you are looking for, approx line 270 in the file.
//Language code string descriptor
const struct{uint8_t bLength;uint8_t bDscType;uint16_t string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409}};
I've highlighted the part to change.
Here is some information regarding the serial number....
Serial number string descriptor. If a serial number string is implemented, it should be unique for every single device coming off the production assembly line. Plugging two devices with the same serial number into a computer simultaneously will cause problems (in extreme cases BSOD).
Note: Common OSes put restrictions on the possible values that are allowed.
For best OS compatibility, the serial number string should only consist of UNICODE encoded numbers 0 through 9 and capital letters A through F.
ROM struct{BYTE bLength;BYTE bDscType;WORD string[10];}sd003={sizeof(sd003),USB_DESCRIPTOR_STRING,{'0','1','2','3','4','5','6','7','8','9'}};
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 243
- Joined: Tue Nov 27, 2012 12:53 pm
- Location: Cambridge, UK
- Has thanked: 140 times
- Been thanked: 118 times
- Contact:
Re: Defining USB Serial No. Descriptor for USB Serial Component
Hi Ben.
My sincere thanks for your time to kindly provide this information, and a huge help - Thank you!
From the instructions provided, it's clear I should have been a little more specific by saying that I'm coding for both 8-bit and 16-bit PICs requiring unique serials (mostly 16-bit these days), so anticipating the exact same procedure for
usb_serial_descriptors.c
in...
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC16BIT\USB
Thank you again
Brendan
My sincere thanks for your time to kindly provide this information, and a huge help - Thank you!
From the instructions provided, it's clear I should have been a little more specific by saying that I'm coding for both 8-bit and 16-bit PICs requiring unique serials (mostly 16-bit these days), so anticipating the exact same procedure for
usb_serial_descriptors.c
in...
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC16BIT\USB
Thank you again
Brendan
LinkedIn Profile...
http://www.linkedin.com/in/brendantownsend
http://www.linkedin.com/in/brendantownsend