Skip to main content
KSriv.1
Associate
February 26, 2021
Solved

STM32F446RE USB CDC device problem

  • February 26, 2021
  • 2 replies
  • 2914 views

Hi, I'm trying to follow this tutorial :- https://youtu.be/Hk--a4K497M -- demonstrating how to transmit simple string to PC via usb virtual com port. Unfortunately, I'm getting no output on my serial port.

During debugging, I found that CDC_Transmit_FS() always returns USBD_BUSY since hcdc->TxState never goes to zero. Also, hcdc->RxBuffer and hcdc->TxBuffer throw an error stating cannot access memory at a certain address.

0693W000007ZdGGQA0.pngThings I have tried :-

1) increase heap and stack size to 800 and 1200 respectively.

2) change USB_HS_MAX_PACKET_SIZE and CDC_DATA_HS_MAX_PACKET_SIZE to 256.

3) Adding more delay before CDC_Transmit_FS().

PS: I'm able to send and receive data via USB using MBed online compiler's library (Serial (USBTX, USBRX)).

OS: Windows 10, Serial port monitor : CoolTerm , Toolchain: STM32CubeIDE.

This topic has been closed for replies.
Best answer by Paul1

Have a look at attached. We use the VCP/CDC for diagnostics. This is a print of our internal wiki notes about it...

  • STM32_VCP_CDC.docx
  • It also has links to other forum posts on the subject.

Basic issue:

  • Some windows programs require the ST to return the port settings of a UART (echo back the baudrate etc.)
  • So modify the ST code to echo back the windows settings, or use a program that doesn't check them (teraterm)

Paul

2 replies

Paul1
Paul1Answer
Senior III
February 26, 2021

Have a look at attached. We use the VCP/CDC for diagnostics. This is a print of our internal wiki notes about it...

  • STM32_VCP_CDC.docx
  • It also has links to other forum posts on the subject.

Basic issue:

  • Some windows programs require the ST to return the port settings of a UART (echo back the baudrate etc.)
  • So modify the ST code to echo back the windows settings, or use a program that doesn't check them (teraterm)

Paul

KSriv.1
KSriv.1Author
Associate
February 27, 2021

Hi, thanks for replying !

I tried teraterm, USB CDC transmission is still not working (still stuck in usbd_busy loop) however USART via USART2 is now working !