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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,709 次查看
terencet
Contributor III

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.

0 项奖励
回复
1 解答
1,385 次查看
terencet
Contributor III

Turns out it wasn't a software error but was due to the positioning of the boards in the tower.

https://community.freescale.com/message/350162#350162

The question linked above had a similar problem and the solution was to move the boards closer together (before they were at the top and bottom of the tower) in the top two slots.

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,386 次查看
terencet
Contributor III

Turns out it wasn't a software error but was due to the positioning of the boards in the tower.

https://community.freescale.com/message/350162#350162

The question linked above had a similar problem and the solution was to move the boards closer together (before they were at the top and bottom of the tower) in the top two slots.

0 项奖励
回复