AnsweredAssumed Answered

ST-LINK VCP with flow control?

Question asked by jaekel.torsten on Sep 14, 2017
Latest reply on Sep 15, 2017 by jaekel.torsten

The newer version of ST-LINK (intended for mbed) supports on several boards, e.g. STM32F4 DISCO1, the UART as USB VCP (ST-LINK chip acts as the USB UART bridge, e.g. Tx/Rx going to UART1 on the MCU).

It works fine, as long you type characters in an interactive mode (user types on UART terminal, not too fast   ;-)   ).
If I send a file, e.g. TeraTerm -> Send File ... or I generate UART messages (commands) from a script (e.g. Python) then characters are lost (looks like just 2 characters per USB packet towards MCU).

Obvious for me due to USB Bulk Transfer of UART characters, USB packet sizes, USB timing (e.g. just every 1 ms an USB packet). It is independent of the baud rate (1,228,800 works fine for me in interactive mode). It is more related to the USB, how CDC, VCP works (based on USB packets transmitting the characters).


==> It looks to me, this ST-LINK VCP does not support any flow control (HW flow control not possible because RTS, CDC etc. are not wired, just Rx and Tx).
If I want to send a file via TeraTerm or I generate larger UART messages (BTW: on both sides: even if MCU wants to send large text to terminal -> it results in losing characters, unless the USB timing and packet size is taken into account: send traffic in "bursts" aligned to the USB packet size and timing.


==> Please, anybody from the STM team: is it possible to provide a ST-LINK VCP (ST-LINK firmware update) which supports also Flow Control (XON/OFF)?
==> How to handle large UART messages not generated by a user manually typing, e.g. Send File from UART terminal?
(BTW: also the direction MCU to terminal has similar issues - please have a larger buffer in the ST-LINK VCP firmware and flow control for both directions)


The only solution: add a delay of at least 1 ms (for Python UART I had to set >5 ms) after EACH characters sent - it fixes the issue but it makes the transfer speed so slow (independent of UART baudrate, resulting in every single character is now one USB packet).


Thank you for any improvement on this very helpful ST-LINK VCP UART in the future (supporting flow control).