Skip to main content
Associate III
August 27, 2026
Question

USB with STM32C071RBT6

  • August 27, 2026
  • 12 replies
  • 100 views

I want progrma the STM32C071RBT6 for to get a virtual COM port.

I’m using NUCLEO-C071RB board and this are the settings with Cube MX:

 

 

 

 

 

I add some instructions into the main like this:

int main(void)
{

/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration--------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */
SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_CRC_Init();
MX_USB_PCD_Init();
MX_USBX_Device_Init();
_ux_dcd_stm32_initialize(0, (ULONG)&hpcd_USB_DRD_FS);


if (HAL_PCD_Start(&hpcd_USB_DRD_FS) != HAL_OK)
{
Error_Handler();
}

/* USER CODE BEGIN 2 */

/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
_ux_device_stack_tasks_run();
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}

Now if i connect the USB cable to the PC, Windows recognizes the device and add a COM port. No issue for the operative system, the device works fine, but if i try to open that COM port with Putty or Real Term I immediately get a error.

Can anyone help me for understand what happen?

12 replies

ST Technical Moderator
August 27, 2026

Hello ​@AndrewFFFF 

Let me thank you for posting.

I recommend that you take a look at the example provided through the firmware under this path:

C:\Users\_\STM32Cube\Repository\STM32Cube_FW_C0_V1.4.1\Projects\NUCLEO-C071RB\Applications\USBX\Ux_Host_CDC_ACM

Thanks.

Mahmoud

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Associate III
September 2, 2026

Hello Mahmoud

I tried STM32Cube_FW_C0_V1.4.1\Projects\NUCLEO-C071RB\Applications\USBX\Ux_Device_HID_Standalone, because i think is good for my application but dosen’t work:

Double click on .project, build/run:

I hear the Windows sound when i connect the USB cable to computer, but no new COM appears, and there is no error message like “USB not recognized”.

I open the .ioc project and i found this warning:

 

ST Technical Moderator
September 7, 2026

Hello ​@AndrewFFFF 

Further to your comment, you need to set the Found Solutions as USB.

Thanks.

Mahmoud

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Andrew Neil
Super User
September 2, 2026

if i try to open that COM port with Putty or Real Term I immediately get a error

What error, exactly, do you get? And where?

 

I hear the Windows sound when i connect the USB cable to computer, but no new COM appears, and there is no error message like “USB not recognized”.

What does Device Manager show?

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate III
September 2, 2026

Hi Andrew

I wrote about 2 project

My first project showed in my first message.

What error, exactly, do you get? And where?

"The device is not ready/connected", but it seems to be a message from Windows, not RealTerm, because the language is different (RealTerm is in English, but the operating system is not).

 

Following Mahmoud's advice, I opened a pre-installed standalone project STM32Cube_FW_C0_V1.4.1\Projects\NUCLEO-C071RB\Applications\USBX\Ux_Device_HID_Standalone:

What does Device Manager show?

Nothing. I only hear the sound and see some refresh (inside Device Manager), but nothing else—no error and no COM port.

 

Andrew Neil
Super User
September 2, 2026

Have you tried basics like changing USB cable, changing USB port on the PC, disconnecting all other USB, etc ?

Are you trying to connect via a Hub or docking station?

 

What does Device Manager show?

Nothing. I only hear the sound and see some refresh (inside Device Manager), but nothing else—no error and no COM port.

 

Does anything appear under ‘Universal Serial Bus devices’ ?

 

Try searching for Windows USB event tracing; eg,

Overview of USB event tracing for Windows

Where can I find logs on recent USB insertion in the Event Viewer?

 

And a forum search; eg,

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
September 2, 2026

Feels like Ux_Device_CDC_ACM would be a more appropriate project. HID will not give you a com port, but rather a HID device. No doubt it shows up Device Manager somewhere if you heard the connect sound.

The HAL USB support has been historically lacking. For RealTerm, ensure the STM32 code handles and changes the com port settings (baud rate, parity, etc) and reports them back correctly.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate III
September 3, 2026

Thank you guys for the answers.

I copy here the USB event for STM32Cube_FW_C0_V1.4.1\Projects\NUCLEO-C071RB\Applications\USBX\Ux_Device_HID_Standalone:

The USB cable works properly. I usually connect it via a HUB, but the issue persists when connected directly to the computer.

Andrew Neil
Super User
September 3, 2026

I copy here the USB event for STM32Cube_FW_C0_V1.4.1\Projects\NUCLEO-C071RB\Applications\USBX\Ux_Device_HID_Standalone:

The USB cable works properly. I usually connect it via a HUB, but the issue persists when connected directly to the computer.

 

So that’s still the HID project - it will not give you a COM port.

It does seem to be correctly enumerating as an HID device ?

What does Device Manager show ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
ST Technical Moderator
September 3, 2026

Hello ​@AndrewFFFF 
Here is a ready-made project that configures the STM32C071 as a USB CDC ACM device in standalone mode. It repeatedly sends "hello world" to the serial monitor. It can be used as a reference to debug another project and identify the root cause.
I will attach it in this reply
 

BR
Gyessine
 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.