AnsweredAssumed Answered

Sending out more than 64 bytes of with with USB Virtual COM demo

Question asked by Kevin Luty on Jul 21, 2016
Latest reply on Aug 18, 2016 by isaacavila

I've tried a couple approaches to sending out large chunks (up to 4k bytes) of data using the virtual COM port example (MK22FN512VLH12, KSDK 1.3.0) however none of them have worked.  I've found that you can send out 64 bytes, once, without a problem; however, sending out more than that, or calling USB_Class_CDC_Send_Data multiple times does not work as expected and I don't know why.  Take this code for example, in Virtual_Com_App():

 

if (g_send_size)

{

  uint8_t error;

  uint32_t size = g_send_size;

  g_send_size = 0;

  uint8_t stuff[64] = { 65, 65, 65, ..., 65, 0 };

  uint8_t j;

  for(j = 0; j < 5; j++)

  {

    error = USB_Class_CDC_Send_Data(applicationHandle, DIC_BULK_IN_ENDPOINT, stuff, 64);

  }

 

Calling USB_Class_CDC_Send_Data consecutively does not work.  If I remove the for loop, it works as expected.  Also, if I call USB_Class_CDC_Send_Data(applicationHandle, DIC_BULK_IN_ENDPOINT, stuff, 200); this does not work either, returns USB_ERR (0xFF).  I'm trying to figure out how I can write a chunk of data to the COM port without any or with minimal interaction from the PC side.  How can this be done using the USB Virtual COM demo?

 

Thanks,

Kevin

Outcomes