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.

TM4C USB Mass Storage Device - 2 devices

I am wondering if it is possible to have the TM4C microcontroller have 2 MSC devices - one for internal flash and one for an external SD card.  I looked at the TivaWare USB functions for initializing the device USBDCInit() and it asserts that index == 0, which seems to me like I cannot make more than 1 MSC device.

  • Hello Andy,

    I think it will be different endpoints on the MSC device calls.

    Regards
    Amit
  • I am still having issues with this problem, right now I am attempting to use the USB composite device feature but my computer is not detecting any USB device:

    main.c:

    USBDMSCCompositeInit(0, &g_sMSCDevice_sd, &g_psCompEntries[0]);
    USBDMSCCompositeInit(0, &g_sMSCDevice_flash, &g_psCompEntries[1]);
    
    USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE, g_pucDescriptorData);

    usb_msc_structs.c:

    tUSBDMSCDevice g_sMSCDevice_flash =
    {
        //
        // Vendor ID.
        //
        USB_VID_TI_1CBE,
    
        //
        // Product ID.
        //
        USB_PID_MSC,
    
        //
        // Vendor Information.
        //
        "Flash",
    
        //
        // Product Identification.
        //
        "Mass Storage  Fl",
    
        //
        // Revision.
        //
        "1.00",
        500,
        USB_CONF_ATTR_SELF_PWR,
        g_ppui8StringDescriptors,
        NUM_STRING_DESCRIPTORS,
        {
            USBDMSCStorageOpen,
            USBDMSCStorageClose,
            USBDMSCStorageRead,
            USBDMSCStorageWrite,
            USBDMSCStorageNumBlocks,
            USBDMSCStorageBlockSize
        },
        USBDMSCEventCallback
    };
    
    tUSBDMSCDevice g_sMSCDevice_sd =
    {
        //
        // Vendor ID.
        //
        USB_VID_TI_1CBE,
    
        //
        // Product ID.
        //
        USB_PID_MSC,
    
        //
        // Vendor Information.
        //
        "SD  ",
    
        //
        // Product Identification.
        //
        "Mass Storage  SD",
    
        //
        // Revision.
        //
        "1.00",
        500,
        USB_CONF_ATTR_SELF_PWR,
        g_ppui8StringDescriptors,
        NUM_STRING_DESCRIPTORS,
        {
            USBDMSCStorageOpenSD,
            USBDMSCStorageCloseSD,
            USBDMSCStorageReadSD,
            USBDMSCStorageWriteSD,
            USBDMSCStorageNumBlocksSD,
            USBDMSCStorageBlockSizeSD
        },
        USBDMSCEventCallback
    };
    
    tCompositeEntry g_psCompEntries[2];
    
    // Composite usb device
    tUSBDCompositeDevice g_sCompDevice =
    {
        USB_VID_TI_1CBE,
        USB_PID_MSC,
        250,
        USB_CONF_ATTR_SELF_PWR,
        0,
        g_ppui8StringDescriptors,
        NUM_STRING_DESCRIPTORS,
    
        2,
        g_psCompEntries
    };

  • Hello Andy

    What is the USB controller being configured as during the call of USBStackModeSet?

    For reference you can use the example under dk-tm4c129x-boostxl-senshub/airmouse/airmouse.c

    Regards
    Amit
  • Amit,
    It looks like one problem was that I needed to call USBStackModeSet() in main.c. This is fixed now, but I am still having issues with the composite device. What PID's should be used for the MSC devices and the composite device? Only 1 MSC device current comes up once initialized now.

    If I change the composite device PID to 0x0D, and each MSC device as 0x05, I can see the composite USB device and 2 Mass Storage devices on the device manager, but only the first device (inside g_psCompEntries[0]) comes up as a drive.  The other device says "failed to start"

  • Hello Andy

    You can request for a new PID using the following post link

    e2e.ti.com/.../396596

    Do note that when PID is changed you need to update the inf files to ensure that the Windows PC loads the correct driver information.

    The example also shows how the 2 devices can be called back from the USB controller.

    Regards
    Amit