This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294KCPDT: TIVA USB Descriptor Hardcoded Serial Number

Part Number: TM4C1294KCPDT

Customer using TM4C1294KC with revision 2.1.1.71 of the TIVA USB Library

 

They are noticing that the USB descriptor structure seems to be hardcoded with a string index of 3. This points to a hardcoded serial number string that they can’t change per unit. Because of this, they cannot pass the WHQL serial number test.

 

Is there a way for us to set the string index to 0?

  • Hello Lawrence,

    Can you please provide some more specific details? There are multiple USB descriptors. Can they identify which one and in which file? Also what USB mode are they using? Bulk? CDC? Composite?
  • Ralph,

    From the Customer:

    This question is related to device descriptor iSerialNumber, I don’t think it is related to the USB mode we are using, since this is at the device level, not configuration/interface/endpoint.

    It seems Tiva code automatically respond with string index 0x03 for iSerialNumber field of the descriptor, and the OS would then read the string stored at index 0x03 as serial number. From the code structure, there does not appear to be a way to give each product its own unique serial number through string index 0x03, so our product based on Tiva all reported same string for serial number.

    Since the serial number field is not useful, is there a way to change the device descriptor, so the string index for iSerialNumber is 0x0 instead of 0x3, meaning there is no device specific serial number?


    Regards,

    Lawrence
  • Hello Lawrence,

    Thank you for offering the detail about iSerialNumber, that helped me narrow down what they were describing much better.

    Contrary to their thoughts, it is related to the USB mode as each mode as it's own descriptor. For examples, the CDC device descriptor is found in usbdcdc.c under g_pui8CDCSerDeviceDescriptor. There you can see the hardcoding of 0x03 for the Product Serial Number. HID, MSC, Composite etc. all have this same setting for 0x03. I don't anticipate them having any issues with changing it to 0x00 based on what I am seeing. But they would need to change it for each mode they want to use in the Device Descriptor variable for that mode.

    For an example, using g_pui8CDCSerDeviceDescriptor again, this is how it looks inside of usbdcdc.c:

    //*****************************************************************************
    //
    // Device Descriptor.  This is stored in RAM to allow several fields to be
    // changed at runtime based on the client's requirements.
    //
    //*****************************************************************************
    uint8_t g_pui8CDCSerDeviceDescriptor[] =
    {
        18,                             // Size of this structure.
        USB_DTYPE_DEVICE,               // Type of this structure.
        USBShort(0x110),                // USB version 1.1 (if we say 2.0, hosts
                                        // assume high-speed - see USB 2.0 spec
                                        // 9.2.6.6)
        USB_CLASS_CDC,                  // USB Device Class (spec 5.1.1)
        0,                              // USB Device Sub-class (spec 5.1.1)
        USB_CDC_PROTOCOL_NONE,          // USB Device protocol (spec 5.1.1)
        64,                             // Maximum packet size for default pipe.
        USBShort(0),                    // Vendor ID (filled in during
                                        // USBDCDCInit).
        USBShort(0),                    // Product ID (filled in during
                                        // USBDCDCInit).
        USBShort(0x100),                // Device Version BCD.
        1,                              // Manufacturer string identifier.
        2,                              // Product string identifier.
        3,                              // Product serial number.
        1                               // Number of configurations.
    };

    So they'd want to change the line:

        3,                              // Product serial number.
    

    That is the iSerialNumber and this can be verified by looking into the device descriptor definition in usblib.h:

    //*****************************************************************************
    //
    //! This structure describes the USB device descriptor as defined in USB
    //! 2.0 specification section 9.6.1.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  All device descriptors are
        //! 18 bytes long.
        //
        uint8_t bLength;
    
        //
        //! The type of the descriptor.  For a device descriptor, this will be
        //! USB_DTYPE_DEVICE (1).
        //
        uint8_t bDescriptorType;
    
        //
        //! The USB Specification Release Number in BCD format.  For USB 2.0, this
        //! will be 0x0200.
        //
        uint16_t bcdUSB;
    
        //
        //! The device class code.
        //
        uint8_t bDeviceClass;
    
        //
        //! The device subclass code.  This value qualifies the value found in the
        //! bDeviceClass field.
        //
        uint8_t bDeviceSubClass;
    
        //
        //! The device protocol code.  This value is qualified by the values of
        //! bDeviceClass and bDeviceSubClass.
        //
        uint8_t bDeviceProtocol;
    
        //
        //! The maximum packet size for endpoint zero.  Valid values are 8, 16, 32
        //! and 64.
        //
        uint8_t bMaxPacketSize0;
    
        //
        //! The device Vendor ID (VID) as assigned by the USB-IF.
        //
        uint16_t idVendor;
    
        //
        //! The device Product ID (PID) as assigned by the manufacturer.
        //
        uint16_t idProduct;
    
        //
        //! The device release number in BCD format.
        //
        uint16_t bcdDevice;
    
        //
        //! The index of a string descriptor describing the manufacturer.
        //
        uint8_t iManufacturer;
    
        //
        //! The index of a string descriptor describing the product.
        //
        uint8_t iProduct;
    
        //
        //! The index of a string descriptor describing the device's serial
        //! number.
        //
        uint8_t iSerialNumber;
    
        //
        //! The number of possible configurations offered by the device.  This
        //! field indicates the number of distinct configuration descriptors that
        //! the device offers.
        //
        uint8_t bNumConfigurations;
    }
    PACKED tDeviceDescriptor;

    Hopefully this information helps them solve the issue.