AnsweredAssumed Answered

virtual serial on USB problem STM32F103

Question asked by arigliani.marco on Nov 12, 2016
Latest reply on Nov 22, 2016 by ForumSTM32.ForumSTM3
ciao ..!!

I use STM32F103C8Tx, my IDE is Atollic and configure the project with STM32CubeMX
I wanted to try to use the virtual serial present in Cube but I have some problem.

I enabled the USB Device and added the class Virtual Com Port
first of all in the Main.c I include:
#include "usbd_cdc_if.h"

in "While (1)" i use the function of the class for send every second a "hello"

uint8_t msg[] = "hello";
 
while (1)
{
     CDC_Transmit_FS(msg,5);
     HAL_Delay(1000);

}


Ok ... This code seems really simple but the debugger always stops in the function:

void HardFault_Handler(void)
{
      while (1)
     {
     }
}

I also tried to make some modifications to the "usbd_cdc_if.c" file but without any solution
I hope someone can help me and explain a solution to this problem
Thank you and good day, Marco

Outcomes