cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H755 USB CDC Help

ICMosquera
Associate III

Hi everyone,

I’d like to ask for your expertise. I’m working with a custom board based on the STM32H755ZIT, configured in LDO mode. My issue is that when I connect the board to my PC via USB to use the Virtual COM Port (VCP), the computer does not detect the device.

I haven’t encountered this problem on other boards I’ve used, such as those with STM32L4 or STM32WB, where USB VCP works as expected.

Is there a particular difference in the USB VCP implementation between the STM32H7 series and the STM32L4/WB series that I should be aware of?

Here is the noteworthy configuration of my project in CubeMX

  1. RCC, HSE=Crystal/Ceramic Resonator
    • SupplySource = PWR_LDO_Supply (This is in line with my hardware design)
    • Power Regulator Voltage Scale = Scale 2
  2. USB_OTG_FS,Mode=Device_Only
  3. USB_DEVICE_M7, Class For FS IP = Communication Device Class (Virtual Port Com)

 

For the code:

usbd_cdc_if.c

/* USER CODE BEGIN PRIVATE_VARIABLES */
USBD_CDC_LineCodingTypeDef LineCoding = {
		  115200,                       /* baud rate */
		  0x00,                         /* stop bits - 1 */
		  0x00,                         /* parity - none */
		  0x08                          /* nb. of bits 8 */
};
/* USER CODE END PRIVATE_VARIABLES */

---

// icopied this code base on various example i encountered
static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length){
...
    case CDC_SET_LINE_CODING:
      LineCoding.bitrate = (uint32_t) (pbuf[0] | (pbuf[1] << 8) | (pbuf[2] << 16) | (pbuf[3] << 24));
      LineCoding.format = pbuf[4];
      LineCoding.paritytype = pbuf[5];
      LineCoding.datatype = pbuf[6];
    break;

    case CDC_GET_LINE_CODING:
      pbuf[0] = (uint8_t) (LineCoding.bitrate);
      pbuf[1] = (uint8_t) (LineCoding.bitrate >> 8);
      pbuf[2] = (uint8_t) (LineCoding.bitrate >> 16);
      pbuf[3] = (uint8_t) (LineCoding.bitrate >> 24);
      pbuf[4] = LineCoding.format;
      pbuf[5] = LineCoding.paritytype;
      pbuf[6] = LineCoding.datatype;
    break;
...

 

on main.c

/* USER CODE BEGIN Includes */
#include "usbd_cdc_if.h"
/* USER CODE END Includes */


int main(void){
...
  char xxx[10] =  "Hello\r\n";
  while (1){
    CDC_Transmit_FS((uint8_t *)xxx, 7);
    HAL_Delay(1000);
 }
...

 

While browsing the STM32 firmware package, I came across the CDC_Stand_Alone example. I’d like to implement USB VCP on my custom board with the STM32H755ZIT, but I’m unsure how to port this example into my existing project since the structure differs quite a lot.

Any help would be appreciated.

 

IAN

5 REPLIES 5
FBL
ST Employee

Hi @ICMosquera 

We have some architectural differences between the USB implementations on STM32WB / STM32L4 and STM32H7.

On STM32WB and STM32L4, the USB FS device implementation uses a USB FS controller, while on STM32H7 the USB OTG FS/HS controller is used.

Also, on H7, the USB clock is typically derived from a PLL generated clock. On L4, USB clock relies on the internal HSI48 oscillator.

Thanks for your feedback highlighting that the MX generated code structure is quite different from the example firmware provided. Well noted.

To narrow down the issue, could you please attach a minimal firmware project reproducing the problem?

 

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.




Best regards,
FBL

Hi FBL,

I’ve attached the bare‑minimum project file for reference. The power configuration is set to LDO Only with Scale 2. I enabled only the H7 core, and within it, just the USB.

After generating the code and loading it onto my board, my PC still fails to detect the device. Could you advise on what might be missing or misconfigured?

Regards,
Ian

 

HI FDL,

 

Any updates on this? any help would be much appreciated,

 

Thank you

FBL
ST Employee

Hi @ICMosquera 

Well I have tested your project, with my HW setup using HSE =25MHz and direct SMPS and seems working without issues. The only difference also I use different clock source PLL3Q for USB.

FBL_0-1780598358575.png

 

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.




Best regards,
FBL

Hi @FBL ,

 

Thank you for this. My hardware power configuration is set as follows:

HSE: 32 MHz
Power mode: LDO only

However, I noticed that I cannot select PLL3Q as the USB clock source unless I switch the system clock source from HSE to HSI.
Are there any hardware-related reasons why USB might not function correctly when using LDO-only mode or with a 32 MHz HSE?
I would greatly appreciate any insights you may have, as they could help me resolve this issue. At this point, I am also considering revising the hardware if I am unable to get USB working with the current setup.