AnsweredAssumed Answered

TWRSER - Redirecting printf() to USB CDC (virtual com)

Question asked by Wolfgang Pinkhardt on Aug 13, 2011
Latest reply on Apr 2, 2015 by Jerome Pitt

I'm using a tower kit with K60 MCU and configured the hw to use the USB port on TWR-SER to power the system and use as IO for MQX's 3.7.0 USB CDC example. Everything works fine with the demo code. I'd now like to redirect all printf()/stdio communication to the USB_CDC (virtual com) instead of UART (ttyf:smileyhappy: .


Checking mqx\source\bsp\twrk60n512\twrk60n512.h, the default entry BSP_DEFAULT_IO_CHANNEL defined as "ttyf:" would be my first choice to modify and redirect stdio but I have not found a valid entry to redirect to USB CDC.


Do I have to write a new BSP driver (AN3902) in order to redirect printf() to USB instead of UART or am I trying to reinvent the wheel and there is a simple solution that I overlooked? I'd prefer to keep as much portable and compatible with MQX libraries to avoid having to adapt  my code with every minor MQX library release.