AnsweredAssumed Answered

STM32 USB library - CDC_Send_DATA()

Question asked by shan on Sep 25, 2013
Latest reply on Sep 25, 2013 by shan
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;
      }
    }
  }


Outcomes