AnsweredAssumed Answered

Sending strings using USB_Class_CDC_Send_Data

Question asked by Kevin Luty on Jul 26, 2016
Latest reply on Aug 18, 2016 by Iva Susnova

I'm using the USB CDC VCOM code found in KSDK 1.3.0 and I'm attempting to write a string to my terminal.  The call is simple:

 

USB_Class_CDC_Send_Data(applicationHandle, DIC_BULK_IN_ENDPOINT, "Hello, World!", 13);

 

I've also tried casting (uint8_t*)"Hello, World!".  Both methods print some non ASCII characters:

Capture.PNG

 

So I played around with it and did this:

    uint8_t *buffer;

    buffer = malloc(size);

    memcpy(buffer, "Hello, World!", 13);

     USB_Class_CDC_Send_Data(applicationHandle, DIC_BULK_IN_ENDPOINT, buffer, 13);

and it prints:

Capture.PNG

 

I don't believe I should have to copy the buffer in order to print the message, so what am I doing wrong; or what is the SDK doing that's preventing me from simply printing out a specified byte sequence.

Outcomes