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
2019-03-26 02:19 AM
Hi all,
using windows10,
I want to handle STM32F407 Disco via VCP. In the first case, i tried to configure UART but when i connect my USB TTL converter to my PC: it informs me that VCP error ''This device cannot start(code 10)''.
I thought that the probem is related to my USB converter
Then i tried to configure CDC USB:
USB_OTG_FS on mode Device only
activate USB_Device middelware in CDC mode
check the CubeMX file attached for more details
but the problem still exist!===> VCP error ''This device cannot start(code 10)''.
and here is the define in "usbd_desc.c" file
#define USBD_VID 1155
#define USBD_LANGID_STRING 1033
#define USBD_MANUFACTURER_STRING "STMicroelectronics"
#define USBD_PID_FS 22336
#define USBD_PRODUCT_STRING_FS "STM32 Virtual ComPort"
#define USBD_SERIALNUMBER_STRING_FS "00000000001A"
#define USBD_CONFIGURATION_STRING_FS "CDC Config"
#define USBD_INTERFACE_STRING_FS "CDC Interface"
=====> Please how can i handle to fix this issue! if there is a wrong value generated by CubeMX! or a change that should i do in my environement (PID, VID....)
this is a real problem for me that block my project0
Please any solution or workaround for this
many thanks
2019-07-26 01:56 AM
Having the same problem under Win 10 with a STM32L476 and Firmware 1.14.0 !
(USB-Sniffer: device answers correctly after DESCRIPTOR Request DEVICE from host. After DESCRIPTOR Request CONFIGURATION the device returns the correct information, but the device status is USBD_STATUS_STALL_PID (0xc0000004 -> 'error 10 device cannot start') and no further communication)
Any help ?
2019-09-03 09:39 AM
Hi, I have the same problem with the STM32L496 and firmware 1.14.0, also Win 10. Actually the device managed to enumerate successfully once and I was able to view incoming data with putty. I have no idea, why that happened.. Most of the time, the configuration descriptor is invalid (USBD_STATUS_STALL_PID (0xc0000004)). Were you able to fix this?
2019-09-04 02:44 AM
Actually, a quick fix for me is to remove the call to USBD_LL_StallEP in the function USBD_LL_DataOutStage (file: usbd_core.c), so the relevant code section looks like this:
if (pdev->ep0_state == USBD_EP0_STATUS_OUT)
}
/*
* STATUS PHASE completed, update ep0_state to idle
*/
pdev->ep0_state = USBD_EP0_IDLE;
//USBD_LL_StallEP(pdev, 0U);
}
Not very elegant, but at least enumeration works now. Transmitting and receiving is also possible, let's see if the removal will cause me any trouble in the future.
2019-09-09 11:00 AM
Commenting out the code in usbd_core.c worked for me. Here are my environment settings for those that might come across this issue in the future:
Windows 10
STM32CubeIDE workspace 1.0.2
STM32h743ZI2 with STM32_fw_h7_v1.5.0
Let me know if there's anything I should include to make it more specific, I went back to change the size of the HS packet back to 512U and it still worked for me. As well as not changing to the data[64U] as some other people have suggested.
I also went back to put the heap stack down to the default 0x200 instead of giving more heap size.
#define CDC_DATA_HS_MAX_PACKET_SIZE 512U
typedef struct
{
uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE / 4U]; /* Force 32bits alignment */
//..
}
USBD_CDC_HandleTypeDef;
One thing I have to remember is that when I use the embedded STM32CubeMX in the IDE to config pins and settings is that the generated code will overwrite the uncommented code, so I have to do a re-uncomment on USBD_LL_StallEP(pdev,0U);
EDIT: some grammar
2019-12-03 04:44 AM
I would recommend that you copy the USB driver files from the Middleware folder to a new, custom folder and deactivate the Middleware in CubeMX. Include the specific header files yourself and you got yourself a working project with USB HS which still supports CubeMX code generation.
2020-02-04 11:40 AM
Hey, just a quick follow up, I tested my solution thoroughly and after making sure it has no negative effects on the usb transmission I finally submitted a bug report to github: https://github.com/STMicroelectronics/STM32CubeH7/issues/22
tl;dr the bug is known and will be fixed in the new upcoming USB device lib.
2020-06-14 03:51 AM
Just run into a similar issue with STM32F405xx.
Thanks a lot for the folks here for the hint.
For me the issue is the same as Eich mentioned: Changing CDC_DATA_HS_MAX_PACKET_SIZE from 512U to 64U solve the problem.
I took a look at the issue and found that:
If you do not like the solution to change the CDC_DATA_HS_MAX_PACKET_SIZE from 512 to 64 (like me...), you can enlarge the heap size by modifying the link directive file.
In my case, I am using IAR, I changed heap to 8KBytes:
define symbol __ICFEDIT_size_heap__ = 0x2000;
2024-02-27 10:47 PM
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 */
};