2013-07-20 02:30 AM
Hello all,
I
am a bit new to
ARM processors.
I want to read images from USB Flash drive
attached to STM32F4 Discovery.I used the USB
host library +FA
TFS.While debugging
I figured out that the device is not getting enumerated.i.e
,in the usbh_core.c from
HOST_DEV attached it goes to HOST_CTRL_XFER.
this is my main.c program:
int main(void) { init_GPIO(); USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_Callbacks);for(;;)
{
USBH_Process(&USB_OTG_Core, &USB_Host); }}The USBH state remains is shown b
elow:
{gState = HOST_CTRL_XFER, gStateBkp = HOST_ENUMERATION, EnumState = ENUM_IDLE, RequestState = CMD_WAIT, Control = {hc_num_in = 1 '\001', hc_num_out = 0 '\000', ep0size = 64 '@', buff = 0x20000634 '''', length = 8, errorcount = 0 '\000', timer = 0, status = CTRL_START, setup = { d8 = ''\200\006\000\001\000\000\b'', b = {bmRequestType = 128 '\200', bRequest = 6 '\006', wValue = {w = 256, bw = {msb = 0 '\000', lsb = 1 '\001'}}, wIndex = {w = 0, bw = {msb = 0 '\000', lsb = 0 '\000'}}, wLength = {w = 8, bw = {msb = 8 '\b', lsb = 0 '\000'}}}}, state = CTRL_SETUP_WAIT}, device_prop = {address = 0 '\000', speed = 1 '\001', Dev_Desc = {bLength = 0 '\000', bDescriptorType = 0 '\000', bcdUSB = 0, bDeviceClass = 0 '\000', bDeviceSubClass = 0 '\000', bDeviceProtocol = 0 '\000', bMaxPacketSize = 0 '\000', idVendor = 0, idProduct = 0, bcdDevice = 0, iManufacturer = 0 '\000', iProduct = 0 '\000', iSerialNumber = 0 '\000', bNumConfigurations = 0 '\000'}, Cfg_Desc = {bLength = 0 '\000', bDescriptorType = 0 '\000', wTotalLength = 0, bNumInterfaces = 0 '\000', bConfigurationValue = 0 '\000', iConfiguration = 0 '\000', bmAttributes = 0 '\000', bMaxPower = 0 '\000'}, Itf_Desc = {{bLength = 0 '\000', bDescriptorType = 0 '\000', bInterfaceNumber = 0 '\000', bAlternateSetting = 0 '\000', bNumEndpoints = 0 '\000', bInterfaceClass = 0 '\000', bInterfaceSubClass = 0 '\000', bInterfaceProtocol = 0 '\000', iInterface = 0 '\000'}, {bLength = 0 '\000', bDescriptorType = 0 '\000', bInterfaceNumber = 0 '\000', bAlternateSetting = 0 '\000', bNumEndpoints = 0 '\000', bInterfaceClass = 0 '\000', bInterfaceSubClass = 0 '\000', bInterfaceProtocol = 0 '\000', iInterface = 0 '\000'}}, Ep_Desc = {{{bLength = 0 '\000', bDescriptorType = 0 '\000', bEndpointAddress = 0 '\000', bmAttributes = 0 '\000', wMaxPacketSize = 0, bInterval = 0 '\000'}, {bLength = 0 '\000', bDescriptorType = 0 '\000', bEndpointAddress = 0 '\000', bmAttributes = 0 '\000', wMaxPacketSize = 0, bInterval = 0 '\000'}}, {{bLength = 0 '\000', bDescriptorType = 0 '\000', bEndpointAddress = 0 '\000', bmAttributes = 0 '\000', wMaxPacketSize = 0, bInterval = 0 '\000'}, { bLength = 0 '\000', bDescriptorType = 0 '\000', bEndpointAddress = 0 '\000', bmAttributes = 0 '\000', wMaxPacketSize = 0, bInterval = 0 '\000'}}}, HID_Desc = {bLength = 0 '\000', bDescriptorType = 0 '\000', bcdHID = 0, bCountryCode = 0 '\000', bNumDescriptors = 0 '\000', bReportDescriptorType = 0 '\000', wItemLength = 0}}, class_cb = 0x20000084, usr_cb = 0x2000003c} Theusb
h always re
mains at this.
Any leads on how to proceed form here shall be helpful.
#usb2013-12-13 05:05 AM
Hi,
Same here, had you any success on this problem? Martin2013-12-13 05:24 AM
See also STM32F4-Discovery_FW_V1.1.0\Project\FW_upgrade\src
2013-12-13 10:15 AM
Can you give me a little bit more input ;-)?
Martin2013-12-13 10:35 AM
Can you give me a little bit more input ;-)?
Perhaps if I knew what the problem was? The cited example is an out-of-the-box implementation of FAT-FS using a USB attached Flash Drive on the STM32F4-Discovery board. As such it is a good reference point for determine what is and what is not working, using a common code base everyone has access too.
2013-12-13 11:44 AM
Hi Clive,
I’am using the code from ST already. And it works on my Eval Boards on the FS and HS USB Port oft the ST32F407. But it don’t work on our own Board. When i plugin a memory stick in the HS Port, than the Device connected handler will be called and nothing more. The HS Interrupts are counting and the USB State Machine hangs in the same state with the same informations of the thread creator, so i hoped that this could be a common problem or mistake.I have now access to a Hardware USB Analyzer and i can’t see any data packets on the USB line.Unfortunately, we are using a USB3320 and the informations about this ULPI in combination with an STM32F4xx are a little bit confusing. Does it work or not?We are also using the 48MHz clock created by the ULPI and not by the STM32, does i have change anything in the code to sync the STM32 to this clock?And last, i will check alle signal lines from the STM32 to the ULPI tomorrow.Any hint about how to start to find this problem are welcome ;)Martin2013-12-13 12:38 PM
All the board's I've analyzed use the USB3300, for reasons that are becoming apparent to you now. ST could have done a lot better job documenting the interface, and providing example implementations with popular/available PHY parts.
Several people have claimed to have successfully used the 3320 [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F2F4%20problems%20with%20various%20ULPI%20USB%20PHYs&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1644]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FSTM32F2F4%20problems%20with%20various%20ULPI%20USB%20PHYs&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1644 With 24 or 26 MHz ULPI clocks the USB HCLK needs to be at least 30 MHz, not sure how 48 MHz plays. The clock range is 24-60 MHz, and I think it's all managed at the hw level. Perhaps you can post a portion of the schematic for the USB connectivity, it might help with the conversation and draw others in. The ULPI PHY's have been a recurring topic, and not really answered with a completeness/clarity I would like.2013-12-16 05:17 AM
Hi,
I have tried one other Eval Board, the embest DEVKIT1207. It uses the USB3320 and their Democode is simply the standard ST Dual Host Demo with one pin changed (NXT as far as i remember). And what should i say? The HS USB Port doesn't work on this Board with this Code. It shows the same behaivour as my board, it stucks in the enumeration phase. Is ist possible, that some of the other users who where sucessfull with an USB3320 on a STM32F2/F4 Board an uses the ST Library share some working code for this ULPI? Maybe we can come to a definitiv statement about the 3320 or to a recipe how it works? Martin2013-12-16 06:32 AM
Hi
I came across a the same issue. USB works fine on the eval board. Stops working properly on our product board. Check the clock setup for both the ARM core and the USB peripheral. The USB peripheral MUST be clocked correctly or the timing for the USB bus will be incorrect. It starts OK (inital messages are OK because they are lowish speed). Then when it tries to hand shake with device - one side cannot understand the other due to incorrect USB bus speed. Hope this helps.2013-12-16 07:11 AM
Hi,
As far as i know the only USB Clock is 48MHz for FS USB. My FS USB is working.HS USB Clock is always driven by the ULPI and i can measure a stable 60MHz signal there.Martin