cancel
Showing results for 
Search instead for 
Did you mean: 

USB with Cube.

kvresto
Senior
Posted on January 29, 2016 at 08:14

Hi.

I have been playing with Cube for the Nucleo F1 series, and I'm interested in getting a USB app running. I know a little about HID, and I can create a HID cube project for SW4STM32 and it enumerates as a HID.

The problem is when I create a cube project but this time for a CDC device, I find it wont complete the enumeration, and instead  Device Manager shows the dreaded exclamation icon, and interestingly this icon is next to a not yet working Com Port (x), in this case 12. The driver properties within device Manager give the error:

This device cannot start (Code 100

A device which does not exist was specified.

Does this mean that ST have not completed the descriptor tables?

It seems to be ok for a plain old HID device, has anyone come up with this before?

Cheers

kvresto

5 REPLIES 5
mark239955_stm1
Associate II
Posted on January 29, 2016 at 23:10

ST's CDC device firmware works perfectly well on the STM32F405 and STM32F072, so I don't see why it wouldn't work on an F1.  Try fiddling with the build configuration, in the context of the hardware implementation (turn on/off Vbus, for example).

I should add that when I say the CDC device firmware ''works'', I mean that out of the box all it does is enumerate as a virtual COM port under Windows.  You have to write your own firmware that interacts with ST's API to allow you to ship data between the MCU and PC.

kvresto
Senior
Posted on January 30, 2016 at 00:06

Thanks Mark. I have put an order in for a STM32F072 discovery. My board is an older Olimex p103, I don't actually own any other STM32 dev board, although I 'll keep playing with it, based on your comments, its got to be my project set up in some way.

Cheers

kvresto
Senior
Posted on January 31, 2016 at 00:43

My STM32F072B discovery arrived and I repeated exactly what I have already done previously. I created a USB CDC device project in cube, selected the STM32F072B discovery within board selector and when the project opened up, I then enabled USB Device FS, and selected the Virtual Com Port from the USB_DEVICE selection. Downloaded, and still no joy, it wont enumerate correctly. I have included a pic of device manager. Is there some other setting I'm missing? When I do the same for a HID device, I have no problem it enumerates correctly as a HID???????

cheers

kvresto

________________

Attachments :

cdc-device.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0au&d=%2Fa%2F0X0000000bat%2FZdIqZQCohiQNrG5NXFtXolcoBNJypluF4dyOX3lzGlw&asPdf=false
tsuneo
Senior
Posted on January 31, 2016 at 04:45

Hi kvresto,

On your Windows PC, there is trouble on the registry around the STM32 VCP device, which disturbs unified recognition of the pair of CDC interfaces (Control / Data interfaces). And then, each interface is registered as separate instance on the registry. 1) Clean up the VCP instances in trouble on your PC using USBDeview utility,

http://www.nirsoft.net/utils/usb_devices_view.html

- Run this utility - Scroll the list to left, show up '' Vendor ID'' column - Click on '' Vendor ID'' label --> the list is sorted by VID/PID - Find VID/PID = 0483/5740 (in hexadecimal, 1155/22336 in decimal, shown on the source code) - (shift-)click on the all lines of this VID/PID to select them - right click on selected lines and choose '' Uninstall the selected devices'' 2) To make sure your device as CDC one, fix the bDeviceClass field of the Device descriptor

usbd_desc.c line: 119

/* USB Standard Device Descriptor */
__ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END =
{
0x12, /*bLength */
USB_DESC_TYPE_DEVICE, /*bDescriptorType*/
#if (USBD_LPM_ENABLED == 1)
0x01, /*bcdUSB */ /* changed to USB version 2.01
in order to support LPM L1 suspend
resume test of USBCV3.0*/
#else 
0x00, /* bcdUSB */
#endif
0x02,
// 0x00, /*bDeviceClass*/
0x02, /*bDeviceClass*/ // <-----------

3) Plug in revised CDC device to the PC, and wait for automatic driver download from Windows Update, OR you may pre-install ST VCP driver, distributed on this page,

http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1533/PF257938

You'll need to run DPINST utility in the folder explicitly, to make the driver (INF) pre-installed. C:\Program Files\STMicroelectronics\Software\Virtual comport driver\Win7\dpinst_xexe or dpinst_amdexe Tsuneo
kvresto
Senior
Posted on January 31, 2016 at 23:06

Hi Tsuneo.

That's the trick, it worked. Thanks for your expert advice. I preinstalled the ST driver which  I didn't do previously, and enumeration went through perfectly.

cheers

kvresto