Skip to main content
David Pekin
Senior
January 30, 2018
Solved

stlink virtual comm port example?

  • January 30, 2018
  • 7 replies
  • 2412 views
Posted on January 30, 2018 at 23:27

Hello. 

I was searching to find some example code showing the usage of the STLink Virtual comm port.  I couldn't find anything in the example projects (or was incompetent in my searching)...  I'd like to route printfs() to it for debugging. 

I'm also wondering if we could use it as a standard serial communication channel.  We're going to add RS-422 drivers and use a UART for the final product but I'd like to get a head start and was hoping to use the STLink to allow serial access prior to getting the H/W built.  

I've seen various threads on the forum of people having trouble w/ the STLink comm.  Does anyone have a simple example that works?   

Thanks!

    This topic has been closed for replies.
    Best answer by David Pekin
    Posted on January 31, 2018 at 17:38

    Thanks all!

    7 replies

    Jorge Calatayud Maeso
    Associate
    January 30, 2018
    Posted on January 31, 2018 at 00:08

    Hi there, instead of using printfs i used uart transmitting, and getting the output from a COM port console.

    Check this PDF:

    https://drive.google.com/file/d/1Gb-a5WhrIFLIq3gKQSvVGM6xQdZJ9GSa/view?usp=sharing

     
    Tesla DeLorean
    Guru
    January 31, 2018
    Posted on January 31, 2018 at 03:13

    The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6so&d=%2Fa%2F0X0000000bxD%2FpXdVlpEl472EQwk3Ug5h5rclQAFrqGGgvIif7b3CGtQ&asPdf=false
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    January 31, 2018
    Posted on January 31, 2018 at 03:25

    The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6ZJ&d=%2Fa%2F0X0000000bqs%2FKNADS3TtbXuLMvtC5q1rBN_Hpuo.Y6JpcbubwbZNnlM&asPdf=false
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    henry.dick
    Associate II
    January 31, 2018
    Posted on January 31, 2018 at 04:05

    you asked two questions:

    1) how to communicate via vcp: you can simply use uart over whatever pins that go to the stlink, typically uart0 on most ST boards. here is a link to get you started: 

    https://dannyelectronics.wordpress.com/2016/05/01/uart-debugging-over-st-link-v2-1/

     

    2) how to use printf over uart: lots of tutorial on that, essentially you need to write a routine that transmit char over uart.

    hope it helps.

    Tesla DeLorean
    Guru
    January 31, 2018
    Posted on January 31, 2018 at 04:22

    Code posted but stuck in moderation.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Brian Kling
    Senior
    January 31, 2018
    Posted on January 31, 2018 at 09:18

    Is live now!

    David Pekin
    David PekinAuthorBest answer
    Senior
    January 31, 2018
    Posted on January 31, 2018 at 17:38

    Thanks all!