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.

USB Composite device, MSC and CDC

Other Parts Discussed in Thread: AM3359

Hi guys,

I'm trying to programm a USB composite device, MSC and CDC (virtual serial port). I started with the usb_dev_comp_ser_ser, figured this would be the easiest way. I copied the ramdisk.c and usbdmscglue.c files from the usb_dev_msc example and added the structs for the msc device in the usb_structs.c:

tMSCInstance g_sMSCInstance;

const tUSBDMSCDevice g_sMSCDevice =
{
   USB_VID_STELLARIS,
   USB_PID_MSC,
   "TI ",
   "Mass Storage ",
   "1.00",
   500,
   USB_CONF_ATTR_SELF_PWR,
   0,
   0,
   {
      USBDMSCStorageOpen,
      USBDMSCStorageClose,
      USBDMSCStorageRead,
      USBDMSCStorageWrite,
      USBDMSCStorageNumBlocks
   },
   USBDMSCEventCallback,
   &g_sMSCInstance
};

Basically just copied it from usb_dev_msc and removed the device descriptors. Then I added the device to the list in the composite device:

#define NUM_DEVICES  3

#define DESCRIPTOR_DATA_SIZE    (COMPOSITE_DCDC_SIZE + COMPOSITE_DCDC_SIZE + COMPOSITE_DMSC_SIZE)

tCompositeEntry g_psCompDevices[NUM_DEVICES]=
{

   {
   &g_sCDCSerDeviceInfo,
   0
   },

   {
   &g_sCDCSerDeviceInfo,
   0
   },

   {
   &g_sMSCDeviceInfo,
   0
   }

};

And then in the main() rutene I added the initialisation:

g_psCompDevices[0].pvInstance = USBDCDCCompositeInit(0, (tUSBDCDCDevice *)&g_sCDCDevice1);
g_psCompDevices[1].pvInstance = USBDCDCCompositeInit(0, (tUSBDCDCDevice *)&g_sCDCDevice2);
g_psCompDevices[2].pvInstance = USBDMSCCompositeInit(0, (tUSBDMSCDevice *)&g_sMSCDevice);


USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE, g_pucDescriptorData);

Well, I thought this would work, but it doesn't. The device doesn't enumerate and the board just freezes. The usb_dev_comp_ser_ser and usb_dev_msc work individually, but together something just hangs. Any idea what I'm doing wrong?

Thanks and best regards,

George

  • Hi George,

    You have not posted enough information for us to help. Could you please mention where ( in code) you are getting struck?

  • Hi Vineeth,

    Sorry I'm so late; had to do an emergency TMS320F28087 project first (awesome MCU by the way). I've done some playing around with USB structs and I've managed to get the composite cdc and msc device working, but, there are heavy delays when connecting the device. Allow me to describe:

    After starting the program on the AM3359:

    - it takes about 2 minutes for windows to pup-up the "You must format the drive before you can use it." dialog. After formatting the msc works perfectly.

    - after the msc device shows up, it takes about 3 more minutes for the terminal to recognise the COM port (COM19 in my case).

    - Connecting to the COM takes about 3 more minutes. After that the virtual com port works great.

    Due to this delays, the device is more or less useless. However, if I run the MSC and CDC exampes individually, there are no such delays.

    The above behavior makes me thinking that this is a windows problem, rather then usblibs. By the way, I'm using Windows 8, 64-bit. I'll give it a try on linux, to see if I get the same behavior. 

    Let me just explain why I need a msc and cdc composite device. The msc part is great for thansfering files to SD card and the cdc is great for a serial console or debuging purposes. Having these two on a single USB0 port is great, since this let's USB1 free for use with a USB stick (for customer software updating).

    Thanks for any help you can give me,

    George

  • Hi George. 

    I am currently trying to implement the same Composite device behavior (Serial CDC and MSC).

    Are you able to post more information regarding the USB structs , and any other steps to get this working.

    Were you able to overcome the delays with the device enumeration on the PC ?


    Any help would be greatly appreciated.

    Thanks.