cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F107 Virtual Com example - echo needed

morpeh89
Associate II
Posted on December 27, 2012 at 09:59

Hi!

I have a problem with usage of ST-example for Virtual Com port. I have STM32F107 on my board. Example is downloaded correctly and all seems workable. The thing is that my board is not standard evaluation board and it doesn't use USART. So, I decided to change example code to make it work without USART - only with USB.

I'd lile to make Echo-program: device should return back all bytes, received from PC.

In the code I see sevearl places, where data is sended or received from USB:

1. EP1_IN_Callback (void)

2. EP3_OUT_Callback(void)

3. Handle_USBAsynchXfer (void)

Two moments need clarification:

1. in EP3_OUT_Callback(void) i retranslate data, received from USB on EP3 to USB on EP1 instead of USART. Is it correct way?

... 

  USB_Rx_Cnt = USB_SIL_Read(EP3_OUT, USB_Rx_Buffer);

  USB_SIL_Write(EP1_IN, USB_Rx_Buffer, USB_Rx_Cnt);

  SetEPTxValid(ENDP1);

 ...

2. The problem I encounter here, is that program crashes any time after usage of USB_SIL_Write, cycling in the HardFault_Handler function. What can be reason of it?

It would be great if anyone gives me any advices concerning this points.

Thanks in advance!
0 REPLIES 0