2019-05-03 07:59 AM
Hello,
I test the CDC with my STM32F407VgTx in an up-to-date environment:
Windows 10 / STM32CubeMx v5.20 / SW4STM32 / System WorkBench for STM32/ST-LINK V2
The VCP v 1.50 driver for windows 10 has been installed normally and declared active.
The source of the CDC program used is:
\ STM32Cube_FW_F4_V1.24.0 \ STM32Cube_FW_F4_V1.24.0 \ Middleware \ ST \ STM32_USB_Device_Library \ Class \ CDC
When running the program, when init the USB, I get Windows Error 43.
Unknown USB Device (descriptor request failure).
Can you help me solve this problem?
In advance thank you
Robert
2019-05-03 09:15 AM
Hello,
Try this FAQ: USB device not recognized: to increase the heap size, or configure the USB library to use static allocation.
Hope this helps you.
Regards,
Imen
2019-05-05 01:08 AM
Hello,
Thank you for the quick reply.
The proposed solutions have not corrected the problem.
I also tried on Windows 7: same problem ...
Regards,
Robert
2019-05-05 10:41 AM
Try to enable debug prints in the USB library (or set breakpoints) and see what's going. Do you receive requests to read descriptors?
-- pa
2019-05-07 07:34 AM
I also have a problem with the usb library (same versions of both cubeMX and the hal library).
The symptom is a harfault happening a few seconds after starting the code in the debugger. Increasing the heap size doesn't change anything.
What is bothering me is that a code that used to work fine with version 1.23 of the library does not work anymore.
Reverting stm32f4xx_ll_usb.c, stm32f4xx_hal_pcd.c, stm32f4xx_hal_pcd_ex.c and their associated .h files to version 1.23 solves the problem.
Does anybody else has this probem ?
Christian
2019-05-07 10:47 AM
Hi
I use the last version 1.24 and works ok.
inside usbd_cdc_if.c the allocation of TX and RX buffer is on Stack and is 2048+2048= 0x00001000
So the Stack must be above 0x1400 (0x400 is the default stack alloc.)
As for the Heap allocation, follow the guide from ST.
Are you use 25 MHZ crystal for HSE?
2019-05-07 12:13 PM
> inside usbd_cdc_if.c the allocation of TX and RX buffer is on Stack
Are you sure?
-- pa
2019-05-07 12:54 PM
Hi
Yes , this is a higher layer buffer allocated by user.
I put a Photo for this in the previous post. Very easy to check.
This buffer is different than in the first answer posted.
I know it seems irrelevant with this case but the uint8_t UserTxBufferFS[APP_TX_DATA_SIZE]; is on stack and as global, allocated first.
So Stack continues growing down and conflicts with upper heap space.
2019-05-07 11:12 PM
Hello,
Thanks to Pavel and Vangelis for their help
That's where I am:
I still have the driver problem initially described.
I increased the size of the stack beyond 1400..3000 without result.
I use 26MHz crystal and I have modified Clock Init
The anomaly fires when MX_USB_DEVICE_Init () is executed
and the following functions (see CONNECT.PNG)
at the execution of USBx_DEVICE-> DCTL & = ~ USB_OTG_DCTL_SDIS the program manager
"Device Descriptor Request Failed" Appears
I added Trace tools in the console (see DBG_Trace.c / DBG_Trace.h)
but I do not know how to debug the Driver and trap requests for descriptors proposed by Pavel.
2019-05-07 11:14 PM