STM32F407 uses USB as a virtual serial port and a yellow exclamation mark appears

Publisher:温馨小屋Latest update time:2018-06-02 Source: eefocusKeywords:STM32F407  USB Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Recently, I used the USB_OTG_FS of STM32F407VET6 as a virtual serial port for work. 
I used STM32 CubeMX to generate the virtual serial port code of STM32F103C8T6 before, and it was very convenient to use. So I used MX to produce the project for F407 this time, but I encountered many problems and was troubled for two days. 
Let me talk about my process first.

The address of the post was that the heap space allocated by STM32CubeMX was too small: 
Heap space 
change 0x200 to 0x600 (isn't it generally the case that the heap space is larger than the stack space?), regenerate the project, compile, download, and plug in the USB: 
Exclamation mark disappears 

Fantastic! The yellow exclamation mark finally disappeared (ignore the COM7, that was a minor problem with the driver). Compile after adding some code:


/* StartDefaultTask function */

void StartDefaultTask(void const * argument)

{

  /* init code for USB_DEVICE */

  MX_USB_DEVICE_Init();


  /* USER CODE BEGIN 5 */

  /* Infinite loop */

  for(;;)

  {

    CDC_Transmit_FS((uint8_t *)"No Fuck!\n",sizeof("No Fuck!\n"));

    osDelay(500);

  }

  /* USER CODE END 5 */ 

}

Nothing to say 
Finally it can be used normally, and this USB virtual serial port can come to an end.

Keywords:STM32F407  USB Reference address:STM32F407 uses USB as a virtual serial port and a yellow exclamation mark appears

Previous article:STM32 hardware I2C and AT24C16
Next article:STM32-USB virtual serial port-learning notes

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号