cancel
Showing results for 
Search instead for 
Did you mean: 

reading form USB flash drive

bhosekarshilpa
Associate II
Posted on July 20, 2013 at 11:30

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}

The

usb

h always re

mains at this.

Any leads on how to proceed form here shall be helpful.

#usb
15 REPLIES 15
mail2
Associate II
Posted on December 13, 2013 at 14:05

Hi,

Same here, had you any success on this problem?

Martin

Posted on December 13, 2013 at 14:24

See also STM32F4-Discovery_FW_V1.1.0\Project\FW_upgrade\src

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mail2
Associate II
Posted on December 13, 2013 at 19:15

Can you give me a little bit more input ;-)?

Martin

Posted on December 13, 2013 at 19:35

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mail2
Associate II
Posted on December 13, 2013 at 20:44

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 😉

Martin

Posted on December 13, 2013 at 21:38

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

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a//my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4DISCOVERY%20%20USB%20HS%20with%20SMS%20USB3320%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0F...

[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&currentviews=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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mail2
Associate II
Posted on December 16, 2013 at 14:17

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?

Martin

chen
Associate II
Posted on December 16, 2013 at 15:32

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.

mail2
Associate II
Posted on December 16, 2013 at 16:11

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