cancel
Showing results for 
Search instead for 
Did you mean: 

VCP device doesn't receive from C# app

Antoine Wajntraub
Associate II
Posted on June 29, 2017 at 17:49

Hello the STM Community,

To quickly introduce my setup, I work on a custom board with a STM32f407 but I have the same issue with the STM32f4-discovery. I generate a simple project for this card, only to try the USB-OTG-FS library, only device mode, CDC device, and with vbus sensing disable.

I flash the board, I plug it to my Win10 computer, it's recognized, everything's fine.

I try to communicate with Tera Term, to test the communication PC -> Board. It works fine, I have the data in the buffer, and a breakpoint in the function CDC_Receive_FS is triggered to tell me that it goes that way, it's fine.

I try the same with a custom C♯ app (which is my final purpose), but this time it doesn't work. The breakpoint is not triggered, the buffer is not filled. The data are apparently not sent to the correct endpoint. I thought about different reasons :

- Could be my board, but since it's recognized, and I have a communication with Tera Term, it's unlikely

- Could be the windows driver, but same, it works fine with Tera Term, and I have the same behaviour with the STM driver, so quite unlikely as well.

- Could be the C♯ app, but the MSDN library that deals with serial ports is in the .NET framework. It doesn't leave much place to mistake with the choice of the endpoint, and before trying with this board, this app worked fine with a serial-USB chip. So my opinion would be that it's quite unlikely as well...

But now, I'm completely stuck. I couldn't think of any other reasons, but my board still doesn't receive the data I send with this C♯ msdn framework...

Do you have any idea about the reasons ? Did you already meet this issue ? Does someone already try to work with this STM library and a C♯ application ?

Thanks for your help !

Antoine

#vcp #stm32f4
1 ACCEPTED SOLUTION

Accepted Solutions
Antoine Wajntraub
Associate II
Posted on July 13, 2017 at 09:00

Hello,

Problem (and solution) found.

In usbd_cdc_if.c, in the function CDC_Control_FS(), my response for the case CDC_GET_LINE_CODING wasn't good enough. Weirdly, Tera Term doesn't care much and still manage to send the proper data to the proper endpoint. On the other hand, PuTTy cannot do it, neither can the C# library.

View solution in original post

2 REPLIES 2
ayarema
Associate II
Posted on June 29, 2017 at 19:16

Most likely its your C# settings for the Com port. Make sure they match what the device is configured to. Other than that without seeing your C# code its hard to help.

Antoine Wajntraub
Associate II
Posted on July 13, 2017 at 09:00

Hello,

Problem (and solution) found.

In usbd_cdc_if.c, in the function CDC_Control_FS(), my response for the case CDC_GET_LINE_CODING wasn't good enough. Weirdly, Tera Term doesn't care much and still manage to send the proper data to the proper endpoint. On the other hand, PuTTy cannot do it, neither can the C# library.