2008-09-15 02:19 PM
USB Virtual COM Port - flow control
2011-05-17 03:45 AM
I'm using the USB Virtual COM Port and noticed that there is no flow control from the PC to USB.
If you type things into HyperTerminal everything works fine. But if you send a text file (a few Kb) then it gets corrupted. If the buffer for characters exiting the USART is not empty, then it gets over written by the next USB frame. What is the correct way of rejecting/stopping frames if the STM32 buffer is full?2011-05-17 03:45 AM
I added this status check and my virtual com port now works fine with files in the comm program.
Code:
void USB_Tx_Byte( u8 *str )
{ while (_GetEPTxStatus(ENDP1)==EP_TX_VALID) {} UserToPMABufferCopy(str, ENDP1_TXADDR, 1); //intent; send ascii[] to usb packet-memory-area SetEPTxCount(ENDP1, 1); //intent; tell usb how many bytes to send SetEPTxValid(ENDP1); //intent; enable usb tx endpoint for transmission } For RX, don't issue this command until you handle all the bytes from the current transfer.Code:
SetEPRxValid(ENDP3); // allow another transfer
2011-05-17 03:45 AM
Thanks, I'll give that a try.
2011-05-17 03:45 AM
a while back I posted an stdio redirector via virtual COM that has flow control and fixes some data races.