Skip to main content
gafsos
Associate III
July 20, 2012
Question

Use Printf for USB

  • July 20, 2012
  • 2 replies
  • 842 views
Posted on July 20, 2012 at 15:02

Hello, I need an example on STM32 of how  to use printf to format and output data via USB

CDC communication (VCP demo) .

Does any one had do it before ?

Thanks
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    July 20, 2012
    Posted on July 20, 2012 at 16:39

    If you are managing the buffers try using sprintf().

    Keil has a simple method of retargeting the standard output, but it operates at a character level which is woefully inefficient.
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Andrew Neil
    Super User
    July 20, 2012
    Posted on July 21, 2012 at 00:12

    ''I need an example on STM32 of how  to use printf to format and output data via USB''

     

    Your toolset documentation will tell you how to provide support for printf to output to arbitrary devices - printf neither knows nor cares what the physical interface is.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.