2017-11-29 04:56 AM
Hi, I'm trying to make a little project just to send an echo of what is received over USB. I have been able to do it, but there s something I couldn't do yet.
My code in the USB callback function is as shown below:
The problem is really simple to describe: when CDC_Receive_HS is called, it only transmits ONE message, and I just can't figure out what is wrong. The code above only sends ''Echo:'' to the terminal on PC. When I only send the data received (CDC_Transmit_HS(Buf, *Len)) it only sends it, even if I try to send it again immediately after.
Thanks in advance
V�tor Pereira
#usb-hs-vcp #use-stm32f769-discovery-board2017-11-29 05:16 AM
See this thread:
https://community.st.com/0D50X00009XkXTsSAN
Ant
2017-11-29 05:37 AM
The USB transmit API is not buffered/queued, if you call CDC_Transmit_HS() you should wait for the transfer to be complete, before attempting to send anything again.
2017-11-30 03:51 AM
Thank you for the answers. I actually had used this ''
put the data into a buffer'' approach, and was trying to make a simpler code, but seems like it's not possible to do it the way I did, since the trasmission only occur after exiting the CDC_Receive_HS function.
I'm having another issue, though. My code is now as follows:
in CDC_Receive_HS, buf=Buf, e len=Len.
The problem is that without the 1 ms delay, it doesn't work. Even when *len has its value changed, the program doesn't enter the if statement. I first thought it was because it hadn't exited CDC_Receive_HS function, but even after a while the transmissions are still not executed. No idea why, I'm working on it.
Thanks again
VÃtor Pereira