cancel
Showing results for 
Search instead for 
Did you mean: 

ST-LINK VCP with flow control?

Posted on September 14, 2017 at 23:01

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).

4 REPLIES 4
Posted on September 15, 2017 at 01:58

X-MODEM-1K from ClearTerminal works fine, hundreds of KB at hundreds of Kbaud, zero CRC errors or sync/retry issues..

Are you using Windows 10?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Uwe Bonnes
Principal II
Posted on September 15, 2017 at 10:57

Torsten,

do some tests:

- Keep the target on the nucleo board in reset.

- Jumper CN3 to connect TX and RX

- Do your test

If the test succeeds, your target is to blame.

If it fails, check your test setup with another USB/Serial converter with TX/RX shorted too.

If this test fails, your setup is to blame. If that test succeeds, maybe the STLink is to blame

Posted on September 15, 2017 at 16:18

 ,

 ,

>,>,If that test succeeds, maybe the STLink is to blame

The ST-LINK demonstrably works at 921600, sending data in bulk from the PC

https://community.st.com/0D70X000006SybpSAC

 ,
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on September 15, 2017 at 16:59

ST-LINK VCP to UART1 on a STM32F4xx DISCO1 board - WORKS!

Just: no flow-control. And X-MODEM protocol implementation does not help: I want to send UART commands from a Python script and via pyserial there is not any X-MODEM layer. So, a native XON/XOFF flow control would be needed or more details about the VCP implementation, e.g. USB End Point packet sizes, so that Python script can make sure not to 'override' USB transfer (e.g. every 1 ms just X bytes sent and received).