cancel
Showing results for 
Search instead for 
Did you mean: 

help me ... usb host not work

askari.nima
Associate II
Posted on December 11, 2013 at 12:11

i made a board with stm32f107re

and use example in st.com for usb host .

but not work when connect usb flash disk in my board.

i want make a board for read a file from usb flash disk and copy to sd card.

please help me !!

#think! #too-vague #debugging #think! #think! #stm32f107-usb-host
8 REPLIES 8
Posted on December 11, 2013 at 18:07

Assume we know nothing about your board design and choices, or what specific software you have built and it's version, configuration, or settings.

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

i use STM32_USB-Host-Device_Lib_V2.1.0 example and select  STM3210C-EVAL in project.

in my board use pin D+ and D- to connect usb flash disk.

i see in my debuger  in usb MSC init function . stop in 2-3 step in detect flash disk .

Andrew Neil
Evangelist
Posted on December 12, 2013 at 08:00

''i see in my debuger  in usb MSC init function . stop in 2-3 step in detect flash disk''

Again, we don't have any access to any of your source code, schematics, or anything else - so that gives us virtually nothing to go on.

You, however, do  have all that stuff - so you  need to be digging into it and thinking what might cause this:

Only you  can see at what point, exactly, it's getting stuck - so you  need to think about how it could get there, and what could be preventing it from moving on...

Remember - the most important tool for debugging is the one between your ears!

Here are some Debugging tips:

http://www.8052.com/faqs/120313

http://www.eetimes.com/discussion/break-point/4027526/Developing-a-good-bedside-manner?pageNumber=0

askari.nima
Associate II
Posted on December 12, 2013 at 16:27

 while (1)

  {

    /* Host Task handler */

    USBH_Process(&USB_OTG_Core, &USB_Host);

    

        if(USB_Host.EnumState == ENUM_DEV_CONFIGURED)

        {

            if(first == 0)

            {

                f_mount(0,&myfat);                        // .. run it

                f_open(&dd,'''',FA_OPEN_ALWAYS);    // 

                first =1;              /////  <<<<<< don't reach here

            }

        }

    if (i++ == 0x10000)

    {

            

      STM_EVAL_LEDToggle(LED1);

      STM_EVAL_LEDToggle(LED2);

      STM_EVAL_LEDToggle(LED3);

      STM_EVAL_LEDToggle(LED4);

      i = 0;

    }      

  }
Andrew Neil
Evangelist
Posted on December 12, 2013 at 17:03

So where does it stop?

What have you  done to think about what may be stopping it?

Don't

f_mount()

or

f_open()

return error codes?

askari.nima
Associate II
Posted on December 13, 2013 at 11:54

f_open  don't return value . because hang in this function . don't reach next line.

and led on my flash drive don't turn on in this example.
Andrew Neil
Evangelist
Posted on December 13, 2013 at 16:03

You're still not thinking, are you?

''f_open  don't return value . because hang in this function.''

So what have you done to find where, exactly, it hangs?

''led on my flash drive don't turn on in this example.''

So think about that - what might it tell you?

Is it likely that

 

f_mount()

will work properly if 

f_open()

encountered a problem...?

Posted on December 13, 2013 at 18:09

Think about the size of the stack, and the routines in diskio.c that are performing the reads, and if those are completing.

If you break with the debugger, where is it stuck? Output some diagnostic messages via a serial port, or SWV channel.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..