Stm32f7 – Disco virtual comport ( USB_OTG_HS)

Stm32f7 – Disco virtual comport ( USB_OTG_HS). In this post i will show how to configure to connect Stm32f7-Disco to PC though virtual comport (USB_HS).
 

1. Pin out setting

RCC->High speed clock->Crystal ceramic resonator
Up system clock to 216 Mhz
USB_OTG_HS->External Phy->Device only
USB_Device->Class for hs IP -> Communication device (Virtual Comport)

 

2.Source generation and edition

In Src/main.c add
—————————————————————————————————-

extern uint8_t CDC_Transmit_HS(uint8_t* Buf, uint16_t Len);
—————————————————————————————————-


int main(void)
{

  HAL_Init();

  SystemClock_Config();
  MX_GPIO_Init();
  MX_USB_DEVICE_Init(); 


  char testDataToSend[20];
  int count=0;

  while (1)
  {
    count++;
    sprintf(testDataToSend,”Hello world [%d]n”,count);
    CDC_Transmit_HS(testDataToSend, sizeof(testDataToSend));
     HAL_Delay(100);

  }
}

 

Video Stm32f7 – Disco virtual comport ( USB_OTG_HS)

Sponsored Links: