cancel
Showing results for 
Search instead for 
Did you mean: 

USB (VCP) failure when using a hub

hh.bakker9
Associate II
Posted on June 11, 2012 at 01:22

Hi,

I've not been able to find any information on this issue so here goes...

I am using an STM32F10x micro with the USB Virtual Com Port (STM32F10x USB-FS-Device Driver V3.3.0 and earlier versions) library. I have worked successfully with the USB for many months using both terminal software like Putty and Hyperterminal as well as Visual Basic 6. However, when I work through a USB hub the data transfer breaks down after some (variable) minutes. Both ends think that everything is fine but no data is transfered.

Is anyone aware of issues with the library that might cause this?

(There have been suggestions that this might be related to a bug in the Windows 7 driver or to backwards compatibility issues between USB 2 and USB 1.1 as a friend has had similar issues with other micros and hubs.) 

Any suggestions or pointers you have would be greatfully received.

regards

Huub

#usb-hub-vcp
2 REPLIES 2
alok472
Associate II
Posted on June 11, 2012 at 12:11

Is your USB hub self powered or USB powered ?

Are you sure that the hub is able to provide enough current for your demo board ?

i have a usb powered hub (4 ports), i see issues using usb-mouse, ST-Link etc...on usb-hub.

Better to buy a self-powered hub (power provided by adaptor)

tsuneo
Senior
Posted on June 11, 2012 at 19:35

> Both ends think that everything is fine but no data is transfered.

USB2.0 hub speeds up response of bulk transfers. Usually, it's fine. But it sometimes causes timing problem on firmware, and data drop may occur.

Here is an excerpt from ST VCP example,

\STM32F\STM32_USB-FS-Device_Lib_V3.3.0\Project\Virtual_COM_Port\src\usb_endp.c

void EP3_OUT_Callback(void)

{

  uint16_t USB_Rx_Cnt;

 

  /* Get the received data buffer and update the counter */

  USB_Rx_Cnt = USB_SIL_Read(EP3_OUT, USB_Rx_Buffer);

 

  /* USB data will be immediately processed, this allow next USB traffic being

  NAKed till the end of the USART Xfer */

 

  USB_To_USART_Send_Data(USB_Rx_Buffer, USB_Rx_Cnt);

 

#ifndef STM32F10X_CL

  /* Enable the receive of data on EP3 */

  SetEPRxValid(ENDP3);

#endif /* STM32F10X_CL */

}

EP3_OUT_Callback() is called by the stack, when PC writes to the device over the VCP.

1) This routine reads out data from the endpoint (USB_SIL_Read)

2) It processes the data (USB_To_USART_Send_Data)

3) And then, the routine arms the endpoint again (SetEPRxValid)

If your firmware swaps the order of 2) and 3), data drop may occur. While your firmware processes the last data, the endpoint accepts next data from host. Your firmware isn't aware of new data.

Tsuneo