AnsweredAssumed Answered

STM32F4 USB CDC problem

Question asked by Anonymous Anonymous on Jun 8, 2018
Latest reply on Jun 13, 2018 by Anonymous Anonymous

Hello everyone!

I`m trying to get CDC VCP working on STM2F407VET6 chip. I`ve created a project in STM32CubeMX (the latest version available), where I`ve set up clocks, enabled USB_FS_Device and USB CDC middleware. All the settings remained default, except for VBUS sensing, which was disabled.

After this, I`ve generated code for Atollic studio, compiled and run in without making any changes to code. When I plug my device into PC (Windows 10 Pro x64 with latest updates), device configures and enumerates correctly, no errors was reported, and COM4 port is assigned to device. However, if I try to open this port with any terminal software (like Putty or RealTerm), they are reporting connection error ("the parameter is incorrect" in RealTerm`s case). 

On the device side, in this moment hUsbDeviceFS.dev_state is equal to USBD_STATE_CONFIGURED, and if I try to call CDC_Transmit_FS, then it returns USBD_OK on first call and USBD_BUSY on all the next calls. However, I cannot recieve anything in terminal because of connection error.

I`ve already tried to increase heap and stack size, changing CDC buffers lengths and installing official STM CDC drivers. I`ve also defined

#define USBD_DEBUG_LEVEL     3

and rerouted printf to UART, but I`m getting 0 debug messages.


So, what I`m doing wrong, how to troubleshoot USB connection and why STM32Cube generated code gives such error?