Mar 3, 2010

USB

Bugs in USB OTG library?

I am testing for the motor drive board using STM32F105RCT using USB, the following problems have occurred.

(Test situation)
  Via EP1IN, the data  is continuously sent from a board to PC.
 And via EP2OUT, it sent a character at a time to a board from PC , the next error will sometimes occur.

(State of an error)
The EP1IN packet exceeding 64 bytes occurs, and it becomes impossible to send data to PC from a board after it.
An EP2OUT packet is then sent to a board normally from PC.
At STM32F, it is "usb_istr.c. : Since  IN Endpoint interrupt(diepint.b.emptyintr == TRUE)" has occurred continuously,
 it is in the state where a main loop cannot be performed.

Although USB communication was completed very simply using the stMicro offer library in STM32F103 series,
 is there still any bug in the library for USB_OTG_FS?

(Test environment)
 CPU              : STM32F105RCT6
 Compiler        : GCC4.4.2USB
 USB library     : stMicro   STM32_USB-FS-Device_Lib_V3.1.0  included in um0424
 Test Program :   Changed a part of Virtual_COM_Port according to the board.


Application: Maxon ECFlat45 Motor Drive Board





USB packet log by USB-Streamscope




Changed part : um0424\STM32_USB-FS-Device_Lib_V3.1.0\Project\Virtual_COM_Port\src\main.c

int main(void)
{
  char s[]="*********************************\r\n";
  int len,i,n,lp;
  volatile int j,k;
 
  Set_System();
  Set_USBClock();
  USB_Interrupts_Config();
  SCI5_Config(115200);
  USB_Init();
  while (bDeviceState != CONFIGURED) ;

  len = strlen(s);
  lp = 0;
  for(j=0;;j++)
  {
//    sioputs("test\r\n");
      /* Write the data to the USB endpoint */
    //n = VIRTUAL_COM_PORT_DATA_SIZE-count_in;
    if( 10 < j ){
      //sioputs("len=");
      //sioputint(len);
      //sioputs("\r\n");
      j=0;
      __disable_irq();
      if( count_in == 0  )
      {
          for(i=0; i<len; i++){
            buffer_in[i] = s[i];
        }
        count_in = len;
          USB_SIL_Write(EP1_IN, buffer_in, count_in);
          //count_in += n;
      }
      __enable_irq();
      //sioputs("end usb_sil_write\r\n");
    }
    if ((count_out != 0) && (bDeviceState == CONFIGURED))
    {
      //USB_To_USART_Send_Data(&buffer_out[0], count_out);
      sioconout(buffer_out[0]);
      count_out = 0;
    }
  }
}


No comments: