Skip to main content
Nredd.1
Associate III
February 26, 2022
Question

STM32F401RE multiple virtual com port issue?

HI,

I am using a stm32f401RE chip on my board, a single virtual com port is working fine, but if it is possible to run twice virtual COMS? and what are the processing steps?

Regards,

Naren

This topic has been closed for replies.

4 replies

TDK
February 26, 2022

Creating a composite USB device is possible, but requires some work and is not supported by CubeMX directly. There are some examples out there:

https://github.com/GaryLee/stm32f103_dual_vcp

"If you feel a post has answered your question, please click ""Accept as Solution""."
Nredd.1
Nredd.1Author
Associate III
February 26, 2022

Thanks, TDK

I am tried as per the above link, two com ports are detected, but data is not sending

0693W00000KafC5QAJ.png 

uint8_t *data = "****technologies \n";

while(1)

{

  CDC_Transmit_FS(data, strlen(data));

 HAL_Delay (1);

}

Regards,

naren

TDK
February 26, 2022

> CDC_Transmit_FS(data, strlen(data));

The code in the provided link requires 3 arguments for CDC_Transmit_FS and you are only providing 2. Are you sure you're using the code in the link?

Not saying it'll work out of the box, but should get you some of the way there. It will still require some experience on your part.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Nredd.1
Nredd.1Author
Associate III
March 10, 2022

HI,

We acquired the data from both virtual com ports, We are trying to transmit the data to both ports, but the single port is only working?

CDC_Transmit_FS((uint8_t *)uart_ctx->buf.data[buf_idx], uart_ctx->buf.len[buf_idx], 2 * i) 

//CDC_Transmit_FS("data",strlen("data"),1);

//HAL_Delay(100);

//CDC_Transmit_FS("data",strlen("data"),2);

//HAL_Delay(100);

Regards,

Naren