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.

Getting USB Flash Drive's unique serial number (TI-RTOS, FatFS)

Hi,

I'm currently using FatFS (through StellarisWare in the TI-RTOS package) to interact (read/write) with a USB Flash Drive.  I'm using a Stellaris LM3S chip.  I'm having trouble finding a way to access a unique serial number from a flash drive that will differentiate it from other USB drives.

I see a lot of documentation that refers to a "iSerialNumber" variable.  However, since I'm using USBMSCHFatFs.h/.c to initialize the USB driver, I seem to be disconnected from this driver.

Can anyone shed some light on this for me?  I'd just like to access a unique value that differentiates one flash drive from all other flash drives.

Thanks in advance.

  • Hi Mitchell,

    What version of TI-RTOS and CCS are you using ?

    Best,

    Ashish

  • Ashish -- I'm using TI-RTOS 1.1.0.25, and CCS 5.3.0.00090

  • To expand on what I'm looking at:

    I'm mounting a USB drive with the USBMSCHFatFs driver in TI-RTOS, and using FatFs to access directories and files on the drive.  Everything there is working great.

    However, I would like to be able to access the serial number given to the USB drive by the Manufacturer.  I'm close.

    • I modified a driver file (USBMSCHFatFs.c) so that I could access the instance of the mounted drive (type tUSBHMSCInstance from usblib\host\usbhmsc.c).
    • Having the instance allows me to follow the *pDevice pointer (of type tUSBHostDevice from usblib\host\usbhost.h) to access DeviceDescriptor (of type tDeviceDescriptor from usblib\usblib.h).
    • Inside DeviceDescriptor, I find iSerialNumber, which gives me the index of the serial number inside a "string descriptor" array.

    This is where I'm stuck.  I cannot find how to access these "string descriptors", or if they're even available at all.  The other data inside DeviceDescriptor, such as idVendor and idProduct seem to be correct, so I know I'm in the right place.

    Any help is greatly appreciated.

  • Mitchell,

    I think you one the right track here. the iSerialNumber that you're extracting from tDeviceDescriptor is an index, not the descriptor itself. With that index, you would have to get the descriptor from the USB device. The USBHCDStringDescriptorGet() usblib API may be what you're looking for.

  • Tom,

    I would love to use that function.  Unfortunately, I cannot find it anywhere in my TI-RTOS package.  Any chance you can point me to it (or tell me which file to include in order to pull it into my code)?

    Thanks,

    Mitch

  • Mitchell.

    My mistake, the USBHCDStringDescriptorGet() API hasn't been made public...yet. I've requested a Bug ID to track this issue (SDOCM00103073) but unfortunately, I can't say when this API will be made available.

    I don't have any other suggestions or workarounds on how you could get the serial number. I would suggest to post this question on the Stellaris ARM Mircrocontroller's forum.

  • Thanks Tom.  If you can think of any way I can patch this API into my current codeset, let me know.

    I'll go try my luck on the Stellaris ARM Microcontroller's forum.

  • Mitchell,

    a patch release of TI-RTOS 1.01.01.26 has a StellarisWare port that has been modified to get the MSC device's serial number. You'd want to check out the fatusbcopy example and uncomment the #define GETSERIALNUMBER.

    The link to TI-RTOS 1.01.01.26 should be up shortly but if you need it sooner, please contact your FAE.

  • I received the patched TI-RTOS from our FAE and have successfully used the new API to get the serial number.  I just followed how it was done in the fatusbcopy example, as you suggested above.  Thanks!