cancel
Showing results for 
Search instead for 
Did you mean: 

I have a problem with USB working properly - USB CDC (Virtual Com Port) with CubeMX HAL. After disconnecting the USB cable and connecting again operation system outputs a message "unknown device with code 29".

Alex Golubev
Associate II

Hello.

I have a problem with USB working properly - USB CDC (Virtual Com Port) with CubeMX HAL after disconnecting the USB cable and connecting again.

For the test I created a project similar to the one presented here - https://www.youtube.com/watch?v=AYICE0gU-Sg using STM32CubeIDE and STM32CubeMX.

The program writes data in the while (1) loop to the USB port after uploading to STM32.

while(1)
{
 CDC_Transmit_FS(buffer, sizeof(buffer));
 HAL_Delay(1000);
}

The data is written out, visible in Windows 7 (Tera Term).

When I disconnect the USB cable (OTG FS port) and reconnect, Windows sends the message "USB device not recognized".

Data is not received.

In order for the data to be transferred and the cable to be recognized, I must do a Reset on the board.

Hardware:

MCU: STM32H743VIT

Software: STM32CubeIDE v1.2

Firmware package: STM32Cube_FW_H7_V1.7.0

How to make the USB device work all the time correctly (after disconnecting the cable and reconnecting it), so that it is recognized by Windows and data is transferred?

1 REPLY 1
Pavel A.
Evangelist III

Debug the enumeration process of the USB device. Enable debug prints in USBD, redirect them to ITM (or UART with high baudrate to avoid timeouts).

Compare 1st time vs. reconnect (USB reset - assign address - requests for descriptors... )