2013-07-25 02:26 AM
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
2013-07-25 12:53 PM
Hi Ed,
Much appreciated! All thanks from STMicro. Cheers, STOne-322014-12-28 11:48 AM
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.2015-11-09 02:25 PM
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 somebody2015-11-13 03:05 AM
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
enjoy2015-12-28 09:31 PM
> 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 8http://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 upgradehttp://www.st.com/web/en/catalog/tools/FM147/SC1887/PF260217
Tsuneo2016-05-10 07:37 PM
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.2019-01-29 05:21 AM
Yes, it helped, thank you for sharing:)
But I am wondering why ? I don't even use HS... what did changed by this definition?
2019-03-07 07:19 AM
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;
2019-03-21 10:19 AM
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.