cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC+MSC Composite Device VID/PID

qwer.asdf
Senior
Posted on February 02, 2015 at 13:03

I'm trying to create a USB CDC+MSC composite device using STM32F4 so that it gets automatically recognized by both STM32 CDC driver and as a standard MSC device. Does ST provide a VID/PID pair for such a device? I mean, ST uses 0483/5740 for CDC examples and 0483/5720 for MSC examples. So, what should I set for a composite CDC+MSC device? Thank you.

#usb-cdc-msc
18 REPLIES 18
Posted on February 02, 2015 at 16:05

Modify the .INF file?

Look at the ST-LINK composite device for the Nucleo/mBed

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
qwer.asdf
Senior
Posted on February 02, 2015 at 17:08

Where is the INF file? ST's VCP driver comes in one EXE installer.

I just tried using Nucleo's VID/PID pair, but ST-Link's driver wasn't able to recognize my device's CDC-VCP. I need a VID/PID so the ST's standard VCP driver can recognize it, just like in case of 0483/5740.

klih
Associate II
Posted on February 05, 2015 at 16:14

Any hints on how to modify the .inf file? I happen to have the same problem.

I managed to create the composite device. Now when I connect the usb device my MSC gets recognized but ofc not the VCP. So then I install the ST VCP driver. Once done my Mass Storage disappears and the VCP starts working. 

I have now idea what I need to add to the .inf file to make both working at the same time.

klih
Associate II
Posted on February 05, 2015 at 17:09

Or do I have to include an IAD (Interface Association Descriptor)? I'm sorry, I'm very new to this topic.

qwer.asdf
Senior
Posted on February 06, 2015 at 16:44

I'm attaching a sample inf file for F055/1337 VID/PID.

Yes, you need IAD. I'm attaching also my (not-)working copy of the CDC-MSC composite device (based on ST's examples of CDC-HID and HID-MSC composite devices). The system recognizes both CDC and MSC devices and MSC is working. You can also connect to CDC using a serial terminal program, but when you start communication with CDC the device and the PC program hang. I can't find out why...

It's FS speed only, though easy to port for HS.

________________

Attachments :

composite-example.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hz13&d=%2Fa%2F0X0000000bL6%2F_d3RgccpHp0coewcE_jmvIlje6rzLy2gXqrsc8afnjM&asPdf=false

driver.inf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyei&d=%2Fa%2F0X0000000bL3%2FJ3DRkXxA23G6puSKl5H0Cb5rJUcIt6v0OtsicZHAKoY&asPdf=false
Posted on February 06, 2015 at 18:41

I think you have the wrong concept for a VID and PID.

The VID is a number that is sold by the USB Implementers Forum to someone that is developing a USB device. The VID is intended to uniquely identify the vendor of the device, therefore Vendor ID (VID). 

The PID is a number allocated by the vendor from their block of numbers, like a SKU, therefore Product ID (PID).

The VID and PID do not imply any particular functionality, except by the people that developed the device.

By having a unique VID/PID pair, your device can be differentiated from other devices on a bus. If two devices have the same VID/PID then a serial number can be used to differentiate between them (like USB memory sticks), but the VID/PID is used by the OS to choose which driver to invoke. Therefore, two devices that have the same VID/PID had better use the same driver.

ST uses a VID/PID pair in their examples and, if you look it up on the interballs, the VID (0483) belongs to ST. The PID was allocated from ST's block.

So, when you ask which VID/PID you should use; you should get ahold of the USB Implementers Forum and buy yourself a block of PIDs. They will assign you a VID and a block of 2**16 PIDs and you can give yourself any one that you wish. 

I seem to remember that our block cost about $5K USD.

If that is too much money, you may want to look around on the tubes, various people have purchased blocks and are selling off single VID/PID pairs.

In general, camping on a VID/PID that does not belong to you is dangerous from a product recall and liability standpoint. The owner of the VID could have a good legal standing that you are using their property without their consent (see Microchips agreement with regards to using their VID/PID that is used in their example code). Your call.

qwer.asdf
Senior
Posted on February 09, 2015 at 11:18

Thank you, yes I've already found that out and that's why I used the unofficial FOSS (free software) VID (0xF055) and just some PID (0x1337) in my example (attached in my previous post). Now if just someone could look at it and find out why the CDC part is not working well I would be very grateful.

Posted on February 24, 2015 at 10:41

Hiqwer.asdf,

Could you provide a little more information about the STM32 HW based and the STM32 FW package you are using. In all cases, we can't run simultaneously the MSC and VCP demos without doing some workaround due to this hardware limitation Since RS232_TX (PC10) and RS232_RX (PC11) are shared respectively with SDIO_D2 and SDIO_D3. If, you are using SPL, to run correctly the composite I made some changes on SD_LowLevel_Init () function in the stm324xg_eval.c file by keeping only SDIO_0 (SDIO_D1/D2/D3 are skipped) with SDIO_D2 and SDIO_D3.

void SD_LowLevel_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*!< Disable SDIO Clock */
SDIO_ClockCmd(DISABLE);
/*!< Set Power State to OFF */
SDIO_SetPowerState(SDIO_PowerState_OFF);
/*!< DeInitializes the SDIO peripheral */
SDIO_DeInit();
/* Disable the SDIO APB2 Clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SDIO, DISABLE);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource8, GPIO_AF_MCO);
// GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_MCO);
// GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_MCO);
// GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_MCO);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource12, GPIO_AF_MCO);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource2, GPIO_AF_MCO);
/* Configure PC.08, PC.09, PC.10, PC.11 pins: D0, D1, D2, D3 pins */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 /*| GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11*/;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Configure PD.02 CMD line */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* Configure PC.12 pin: CLK pin */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_Init(GPIOC, &GPIO_InitStructure);
}

then , I made a change on SD_Init () function in the stm324xg_eval_sdio_sd.c fileline 448:

errorstatus = SD_EnableWideBusOperation(SDIO_BusWide_1b);

Regards, Heisenberg.
qwer.asdf
Senior
Posted on February 24, 2015 at 13:21

Hello Mr. Heisenberg, thank you for your reply. I don't have a evaluation board so I'm using STM32F4Discovery with custom SD card ''shield'' connected to the board with short wires, and it is working in 4-bit mode. So, if I understand correctly in my case these PINs aren't conflicting with each other. And yes, I am using SPL, my project files were

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/DispForm.aspx?ID=2632&RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/USB%20CDC%2bMSC%20Composite%20Device%20VIDPID

in one of my previuos posts in case you missed it. The composite CDC-MSC wrapper is in usb_lib\cdc_msc_wrapper\usbd_cdc_msc_wrapper.[c,h]. I didn't change the CDC and MSC class libraries except that I made some static functions non-static to access them from the CDC-MSC wrapper class. The sdio.c and sd.c files are based on ST's eval. board examples of SD card usage. Is there any other information I can provide? Thank you for looking into this!