cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F413 USB(CDC) cannot be recognized by computer if long time no plugging in

June Zhou
Associate II
Posted on June 21, 2018 at 16:19

Hello there,

Our new device use STM32F413ZG MCU,  and use STM32CubeMx to generate Keil uvision5 project. The device USB as serial port to transmit data.

In the STM32CubeMX, I chose USB_device is Communication Device Class(Virtual Port Com), USB_OTG_FS Mode is Device_Only.  And there is no VBUs.

Usually, we pulg usb cable between our device and computer, and then use Hypertrm to transfer data. 

But I met a problem: After turning on our device long period, for example 2 hour,   plugged USB cable between device and computer,  computer (Win10) cannot 

recognize

 our device USB,  the 'Device Manager' of computer showed error like 'USB Device Cannot Start Code 10'.  But If power on device in short period, for example half hour, plugged in USB cable, computer can recognize USB as serial port COM6, transferring data worked well..

 if USB cannot be recognized by computer, I found the malloc has failed inside USBD_CDC_Init()

.....

if(pdev->pClassData == NULL)

  {

   

ret = 1;  //  reached here

  }

else

{

..........

}

I do not know what reason cause this problem?  Someone has ideas how to fix it?

Looking

forward

 to solutions, Thanks a lot.

Note: I have touch screen, so use GUI that has many graphics, and eMMC card to save data that use Segger filesystem. So far, the Heap size = 10240( max size for our project) , and Stack size =40000.

 

Note: on my computer, I already set Power Options->USB settings->USB selective suspend setting: On battery : Disable; Plugged in: disable.

#stm32f413-usb(cdc)-cannot-be-recognized
0 REPLIES 0