2013-09-25 11:09 AM
Hi all,
Currently I'm working on an application that will call CDC_Send_DATA() periodically. However, if I call it too often, some packets will be missing somewhere in the middle. Does anyone know the reason? Thanks a lot!Say, in the following example, it doesn't print out ABCDEFGHI when key is pressed, but only ''DI'', ''EI'', ''FI''... etc.int main(void){ Set_System(); Set_USBClock(); USB_Interrupts_Config(); USB_Init(); while (1) { if (bDeviceState == CONFIGURED) { CDC_Receive_DATA(); /*Check to see if we have data yet */ if (Receive_length != 0) { if (packet_sent == 1) { CDC_Send_DATA ((unsigned char*)''A'',1); CDC_Send_DATA ((unsigned char*)''B'',1); CDC_Send_DATA ((unsigned char*)''C'',1); CDC_Send_DATA ((unsigned char*)''D'',1); CDC_Send_DATA ((unsigned char*)''E'',1); CDC_Send_DATA ((unsigned char*)''F'',1); CDC_Send_DATA ((unsigned char*)''G'',1); CDC_Send_DATA ((unsigned char*)''H'',1); CDC_Send_DATA ((unsigned char*)''I'',1); } Receive_length = 0; } } }}2013-09-25 11:29 AM
The problem is solved if I add a delay function between each function call.
But if anyone could somehow explain why, I'd be appreciated! :D