AnsweredAssumed Answered

printf() in USB CDC

Question asked by Tuo Wang on Feb 25, 2015
Latest reply on Mar 25, 2015 by soledad

Hi,

 

I am writing MQX 4.1 application code for Kinetis MCU MK64FN1M0VLL12 on a custom board. I have a software task that uses USB CDC driver to communicate with a computer through USB Interface. My question is, how to send data to the PC through USB interface by using printf(). I noticed there is a thread in the forum that asked the same question.

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

 

Based on the correct answer in the thread, I tried to add this line of code but it didn't work:

CDC_HANDLE   g_usb_handle;

g_usb_handle = USB_Class_CDC_Init(...);

/* Add below code */

_io_set_handle(IO_STDOUT, g_usb_handle);

printf("\r\nTEST");


By calling _io_set_handle I still cannot see the string TEST printed on the TeraTerm Terminal in the PC.


Can anyone please advise what might be the reason for this?


Thanks very much!

Tuo

Outcomes