Skip to main content
Visitor II
July 25, 2013
Question

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

  • July 25, 2013
  • 11 replies
  • 7689 views
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
    This topic has been closed for replies.

    11 replies

    Visitor II
    February 28, 2024

    In my case it was lack of report descriptor, after generating code with cube do not forget to add report descriptor in user code 0 section, something like this:

     

    /** Usb HID report descriptor. */
    __ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END =
    {
     /* USER CODE BEGIN 0 */
     	0x05, 0x8c, /* USAGE_PAGE (ST Page) */ 
    	0x09, 0x01, /* USAGE (Demo Kit) */ 
    	0xa1, 0x01, /* COLLECTION (Application) */ 
    	/* 6 */
    	
    	/* Led 1 */ 
    // 0x85, 0x01, /* REPORT_ID (1)		 */
    	0x09, 0x01, /* USAGE (LED 1)	 */
    	0x15, 0x00, /* LOGICAL_MINIMUM (0) */ 
    	0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ 
    	0x75, 0x08, /* REPORT_SIZE (8) */ 
    	0x95, USBD_CUSTOMHID_OUTREPORT_BUF_SIZE, //CUSTOM_HID_EPIN_SIZE, /* REPORT_COUNT (1) */ 
    	0x91, 0x02, /* OUTPUT (Data,Var,Abs,Vol) */
    
    	0x09, 0x05, /* USAGE (Push Button) */ 
    	0x15, 0x00, /* LOGICAL_MINIMUM (0) */ 
    	0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ 
    	0x75, 0x08, /* REPORT_SIZE (1) */ 
    	0x95, USBD_CUSTOMHID_OUTREPORT_BUF_SIZE,//CUSTOM_HID_EPOUT_SIZE, /* REPORT_COUNT (1) */ 
    	0x81, 0x02, /* INPUT (Data,Var,Abs,Vol) */ 
     /* USER CODE END 0 */
     0xC0 /* END_COLLECTION	 */
    };