cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F405RG VCP error ''This device cannot start(code 10)''

Eich
Associate III
Posted on July 25, 2013 at 11:26

Hi !

When running the VCP USB Stack (STM32_USB-Host-Device_Lib_V2.1.0) on my STM32F4 i got an error code on my Win7 x64 sytem. ''This device cannot start(code 10)'' I'm using the USB HS Port on PORTB in FS mode. Finally i found a solution for it. The source code of the file usbd_conf.h must be changed in the following way: Old:

/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
#ifdef USE_USB_OTG_HS
#define CDC_DATA_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */
#define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */

New

/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
#ifdef USE_USB_OTG_HS
#define CDC_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
#define CDC_CMD_PACKET_SZE 8 /* Control Endpoint Packet size */

This change is only necessary when using the HS USB in FS mode. Regards, Ed #stm32-stm32f4-vcp-otg_hs-usb
18 REPLIES 18
Nickname12657_O
Associate III
Posted on July 25, 2013 at 21:53

Hi Ed,

Much appreciated!  All thanks from STMicro.

Cheers,

STOne-32

2dimka
Associate II
Posted on December 28, 2014 at 20:48

Hi! I have a same problem with VCP. But i can't install driver for built-in virtual com port on ST-LinkV2 (Nucleo board).

I use latest version of ST firmware and drivers, and my OS is Windows XP x64 sp3.

Whether you can help me? thanks.

em3ly
Associate II
Posted on November 09, 2015 at 23:25

Hi, i had the same problem. Thanks for help me to  fix my problem. I'm using STM32CubeMx and STM32F4 Discovery. In the stm32CubeMx proyect I configure correctly the usb clock (48MHz) and  i'm using usb_otg_fs as device only. The solution  for ''This device cannot start(code 10)'' is almost the same that in your case.

 In the source code of ''usbd_cdc.h''  must be changed 

#define CDC_DATA_HS_MAX_PACKET_SIZE                512  /* Endpoint IN & OUT Packet size */

 to

#define CDC_DATA_HS_MAX_PACKET_SIZE                 64  /* Endpoint IN & OUT Packet size */

I hope  it help somebody

Posted on November 13, 2015 at 12:05

you don't indicate what version of cube or libraries you are using.  I believe if you update to a recent version (1.8.0 or later) of the F4 libraries this problem has been fixed for over a year.  You shouldn't have to do any changes to the usbd_cdc.h file

enjoy

tsuneo
Senior
Posted on December 29, 2014 at 06:31

> But i can't install driver for built-in virtual com port on ST-LinkV2 (Nucleo board).

Install the latest PC driver for ST-LINK/V2-1, first.

STSW-LINK008   ST-LINK/V2-1 USB driver on Windows Vista, 7 and 8

http://www.st.com/web/en/catalog/tools/FM147/SC1887/PF260218

STSW-LINK009   ST-LINK/V2-1 USB driver on Windows XP (including WinUSB coinstallers)

http://www.st.com/web/en/catalog/tools/FM147/SC1887/PF260219

OR

you may need to update ST-LINK/V2-1 firmware on your Nucleo board.

STSW-LINK007   ST-LINK/V2-1 firmware upgrade

http://www.st.com/web/en/catalog/tools/FM147/SC1887/PF260217

Tsuneo

sycinfinity
Associate
Posted on May 11, 2016 at 04:37

Thank you for your commend. 

I spend all day to solve this problem. and I change CDC_DATA_HS_MAX_PACKET_SIZE 512 => 64,

my VCP driver work well.

Yes, it helped, thank you for sharing:)

But I am wondering why ? I don't even use HS... what did changed by this definition?

typedef struct
{
  uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE / 4U];      /* Force 32bits alignment */
  uint8_t  CmdOpCode;
  uint8_t  CmdLength;
  uint8_t  *RxBuffer;
  uint8_t  *TxBuffer;
  uint32_t RxLength;
  uint32_t TxLength;
 
  __IO uint32_t TxState;
  __IO uint32_t RxState;
}
USBD_CDC_HandleTypeDef;

It seems regardless whether you are using FS or HS, CDC_DATA_HS_MAX_PACKET_SIZE is used to define this type, I am just an electronics intern so don't have much experience at the moment but it seems to be issue, as when I replace it with what is below, it seems to also work, if anyone is able to explain to me why, it would be helpful

typedef struct
{
  uint32_t data[64U];      /* REPLACEMENT */
  uint8_t  CmdOpCode;
  uint8_t  CmdLength;
  uint8_t  *RxBuffer;
  uint8_t  *TxBuffer;
  uint32_t RxLength;
  uint32_t TxLength;
 
  __IO uint32_t TxState;
  __IO uint32_t RxState;
}
USBD_CDC_HandleTypeDef;

Sami.Oweis
Associate

Thank you Eichel.

I was inspired by ur solution and was able to resolve my issue with a different library version.

Here is for anyone is still have the same issue.

https://community.st.com/s/question/0D50X0000AX88PpSQJ/stm32f4x-stmicroelectronics-virtual-com-port-is-properly-installed-but-cant-start-error-this-device-cannot-start-code-10-win7-64fixed