2019-02-25 03:20 AM
I'm trying USB_CDC FS (Full Speed) on STM32F072C8 Controller. I'm able to Transmit data larger than 64 bytes to PC, but not able to receive data more than 64 bytes.
I'm using CDC_Receive_FS function for receiving and buffer size is 1000.
If i send 100 bytes from PC to STM32 , i receive only 64 bytes.
Does anybody have an example code on this....?
2019-02-25 08:05 AM
2019-02-25 08:28 AM
Thank you Mon2.....
but is there any way that i can implement it in the code generated by STMCubeMX....?
2019-02-25 09:14 AM
Please review the following webpage and test again using the 64 byte recommendation for the EP definition:
https://damogranlabs.com/2018/02/stm32-usb-cdc/
A complete project file is posted on the landing page.
Please post your update after testing.
2019-02-25 10:11 PM
Actually i'm using the same configuration as showed in this site, but it is not working..
2019-02-26 05:40 AM
Hi. Please review the following thread,
https://stackoverflow.com/questions/33549084/stm32cubemx-usb-cdc-vcp
and special notes:
Please post your update after this review. If you have done all of these required steps, please post your project / code with details of how you are testing. Include the terminal program being used or whatever to send data to this USB CDC device.
If I understand correctly, this widget is able to transmit 100 bytes in a burst but unable to receive > 64 bytes in a burst? Sounds like a buffer and/or flow control issue with the UART side but from my basic knowledge, USB CDC does not offer flow control lines (by default). However they could be implemented. Have seen some finished USB UARTs (CDC type) that offer flow control lines (RTS/CTS). Believe this is from Silabs or Exar (Maxlinear).
Your code should be ok to work with the STM32F072 Discovery kit?
BTW - Have you attempted to test the idea using MBED? (only to verify the concept and tool setup)
But post the project to see where this goes in the review..
2019-02-26 11:01 PM
Hi, I tried reducing the MAX_Packet_Size from 64 to 32. Now i receive only 32 bytes.
I'm just trying to achieve USB VCP communication to implement it in my project.
I'm using the code straight away generated by STMCubeMX with no modifications, Initially i hard coded some message of 400 bytes to Transmit using CDC_Transmit_FS() function it was working. Now i'm just trying to Transmit what ever i Receive from CDC_Receive_FS().
RealTerm tool is being used to send and receive data.
Please have a look on below images...
Case 1
After reset i sent "Hello" to Device and it printed some Null characters after Hello.
Case 2
Sent "This is a test message "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" containing more than 64 Bytes" and it printed only 64 bytes with some Null characters after message.
Case 3
Again i sent "Hello" text but this time it printed Hello with part of previous message.
"BTW - Have you attempted to test the idea using MBED? (only to verify the concept and tool setup)" - I'm new to ARM controllers so i'm unaware of MBED concept.
I've attached my Test Project please review and let me now if i'm doing anything wrong or missing something.
Thank You.....