AnsweredAssumed Answered

USB CDC on TWR-K60F120M and TWR-SER2 Board won't send certain values.

Question asked by terencet on Oct 9, 2013
Latest reply on Oct 9, 2013 by terencet

I have been trying to get my TWR-K60F120M to work as a virtual com device with my windows xp machine.

After having some trouble getting things working bare metal I switched to using MQX 4 and have got it running and sending messages to Hyper Terminal.

I have modified the example program to simply send out a count from 0 to 0xFF which works fine if I'm just sending one byte but when I try to send a longer message (a uint_32) it stops on certain values these values change depending on the length of the message to be sent.

 

Has anyone encountered similar problems or might know what the cause could be?

 

here is how I altered the code in the main TestApp_Init loop.

 

while (TRUE)

{

     USB_CDC_Periodic_Task();  

       

     if((start_app == TRUE) && (start_transactions == TRUE) && (g_send_finished == TRUE))

     {

          lError = USB_Class_CDC_Send_Data(g_app_handle, DIC_BULK_IN_ENDPOINT, (unsigned char *)(&lTestData), sizeof(lTestData));

          if (!lError && !(sizeof(lTestData) % DIC_BULK_IN_ENDP_PACKET_SIZE))

          {

               lError = USB_Class_CDC_Send_Data(g_app_handle, DIC_BULK_IN_ENDPOINT, NULL, 0);

          }

 

          g_send_finished = FALSE;

 

          if(lTestData == 0xFF)

          {

               lTestData = 0;

          }

          else

          {

               lTestData++;

          }

     }

}

 

g_send_finished is set when USB_Notif_Callback is called with USB_APP_SEND_COMPLETE.

Outcomes