cancel
Showing results for 
Search instead for 
Did you mean: 

virtual serial on USB problem STM32F103

marcoarigliani
Associate
Posted on November 12, 2016 at 02:40

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

#cube-stm32f4-usb-virtual-com

1 REPLY 1
slimen
Senior
Posted on November 22, 2016 at 12:58

Hello,

Refer to user manual

http://www.st.com/content/ccc/resource/technical/document/user_manual/cf/38/e5/b5/dd/1d/4c/09/DM00108129.pdf/files/DM00108129.pdf/jcr:content/translations/en.DM00108129.pdf

on how to use the STM32Cube USb device library, 

You can find under the STM32CubeF1 package a set of applications about USB device which can help you as an implementation example:

STM32Cube_FW_F1_V1.3.0\Projects\STM3210C_EVAL\Applications\USB_Device

Hope this helps you.

Regards