/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / ST32F107 USB host problems

Username:     
Password:     
             

Forum

# 1   2011-05-27 07:41:28 ST32F107 USB host problems

sauliakas
New member
Registered: 2007-10-15
Posts: 1

ST32F107 USB host problems

Hello,

I am trying to simplify and linearize USB hot functionality for specific task. USB Host example (http://www.st.com/internet/com/SOFTWARE … st_lib.zip -USBH_HID_KBrd_Mouse) in IAR works perfectly with STM32F107 MCU. I traced some commands and put them step by step. Somehow I receive no data from USB device.

Mine C code looks like this:

  uint8_t speed = HCD_GetCurrentSpeed(&USB_OTG_FS_dev); // dummy read
  USB_OTG_BSP_uDelay(5000);
  USBH_Open_Channel(&USB_OTG_FS_dev, 1, 0, 2, 0, 0x40);
  USB_OTG_BSP_uDelay(5000);
  USBH_Open_Channel(&USB_OTG_FS_dev, 0, 0, 2, 0, 0x40);         
  USB_OTG_BSP_uDelay(5000);
  USBH_Get_DevDesc(&USB_OTG_FS_dev, &dev_desc, 8) ;
  USB_OTG_BSP_uDelay(5000);
  USBH_CtlSendSetup(&USB_OTG_FS_dev, buff2, 0);
  USB_OTG_BSP_uDelay(5000);
  USBH_CtlReceiveData(&USB_OTG_FS_dev, buff, 8, 1);
  USB_OTG_BSP_uDelay(5000);
  HCD_GetCurrentFrame(&USB_OTG_FS_dev);
  USB_OTG_BSP_uDelay(5000);
  HCD_GetCurrentFrame(&USB_OTG_FS_dev);
  USB_OTG_BSP_uDelay(5000);
  HCD_GetCurrentFrame(&USB_OTG_FS_dev);
  USB_OTG_BSP_uDelay(5000);
  USBH_CtlSendData(&USB_OTG_FS_dev, buff, 0, 0);
  USB_OTG_BSP_uDelay(5000);
  USBH_Get_DevDesc(&USB_OTG_FS_dev, &dev_desc, 8);


I have inserted some debug information in (1)usbh_hcs.c (2)usbh_stdreq.c (3)usbh_ioreq.c (4)usb_regs.c (5)usb_core.c files. Here is debug output port from my code:

-1- USBH_Alloc_Channel (00)
-1- HC_GetFreeChannel
-1- USBH_Alloc_Channel (80)
-1- HC_GetFreeChannel
-4- USB_OTG_USBH_handle_port_ISR
-4- USB_OTG_USBH_handle_port_ISR
-4- USB_OTG_USBH_handle_port_ISR
-4- USB_OTG_USBH_handle_port_ISR
-1- USBH_Open_Channel (num=1, dev.adr=0, spd=2, ep.t=0, mps=40)
-1- USBH_Open_Channel (num=0, dev.adr=0, spd=2, ep.t=0, mps=40)
-3- CtlReq (8) 80 06 00 01 00 00 08  === 00 00 00 00 00 00 00 00  S=1
-3- CtlSendSetup[0] 80 06 00 01 00 00 08 00
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-3- CtlReceiveData[1] 00 00 00 00 00 00 00 00
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-3- CtlSendData[0]
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-3- CtlReq (8) 80 06 00 01 00 00 08  === 00 00 00 00 00 00 00 00  S=0




And there is debug from original example:
-1- USBH_Alloc_Channel (00)
-1- HC_GetFreeChannel
-1- USBH_Alloc_Channel (80)
-1- HC_GetFreeChannel
-4- USB_OTG_USBH_handle_port_ISR
-4- USB_OTG_USBH_handle_port_ISR
-4- USB_OTG_USBH_handle_port_ISR
-4- USB_OTG_USBH_handle_port_ISR
-1- USBH_Open_Channel (num=1, dev.adr=0, spd=2, ep.t=0, mps=40)
-1- USBH_Open_Channel (num=0, dev.adr=0, spd=2, ep.t=0, mps=40)
-3- CtlReq (8) 80 06 00 01 00 00 08  === 00 00 00 00 00 00 00 00  S=1
-3- CtlSendSetup[0] 80 06 00 01 00 00 08 00
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-3- CtlReceiveData[1] 00 00 00 00 00 00 00 00
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-3- CtlSendData[0]
-4- USB_OTG_USBH_handle_hc_ISR
-4- USB_OTG_USBH_handle_hc_ISR
-3- CtlReq (8) 80 06 00 01 00 00 08  === 12 01 10 01 00 00 00 08  S=0
<...>



Hardware USB logger shows that there is no difference in USB communication. See screenshots:
http://lukse.lt/failai/2011-05-27/usb_data_modif.png
http://lukse.lt/failai/2011-05-27/usb_data_original.png

Could somebody advise why I receive no data in my application? What else should I debug?

Offline

 

Board footer