STM32 USB library - CDC_Send_DATA()
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-09-25 11:09 AM
Posted on September 25, 2013 at 20:09
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; } } }}
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2013-09-25 11:29 AM
Posted on September 25, 2013 at 20:29
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