Skip to main content
Visitor II
January 17, 2024
Question

Is there a "simple" example of how to write/read a USB drive using STM32CubeIDE?

  • January 17, 2024
  • 3 replies
  • 13674 views

Hi Folks,

I'd like to find an example of accessing a USB drive using the STM32CubeIDE. I'm currently using the Nucleo-H7A3Zi-Q board.

I believe I have setup the hardware correctly using the device configuration tool but I can't seem to find a simple or concise example on how to develop the code.

I have downloaded the STM32Cube_FW_H7_V1.11.0 code and examples but it still seems more complicated than it should. I've looked at STM32Cube_FW_H7_V1.11.0\Projects\NUCLEO-H7A3ZI-Q\Applications\USB_Host\MSC_Standalone\ but I don't understand how (or what) to import into my workspace.

For a start I just want to be able to write a "Hello World" into a file on the USB key.

Anybody have a good tutorial or example I can use?

Thanks,

Richard

    This topic has been closed for replies.

    3 replies

    Super User
    January 17, 2024

    There is not a simple example because USB is not simple. It will take some time to learn.

    Did you get the example running? Perhaps clone that and import your code into that project rather than the reverse.

    A good resource for USB is here:

    https://www.usbmadesimple.co.uk/

    Graduate II
    January 17, 2024

    Maybe you should have a look at example FatFs_USBDisk, it is much simpler and does what you want : write a text file.

    RCooke88Author
    Visitor II
    January 17, 2024

    Hi Oskar,

    The example code for my Nucleo-H7A3ZI-Q doesn't have a FatFs_USBDisk example. The STM32H743-EVAL directory has a subdirectory called FatFs_USBDisk_Standalone. Is this something that could work for my board?

    Thanks,

    Richard

    Super User
    January 17, 2024

    Hi Richard,

    How about : diy ?  I try to help you and then you not only copy something, but you get it running yourself.

    Wanna try ?

    Super User
    January 17, 2024

     I don't understand how (or what) to import into my workspace.

    @RCooke88 Divide this task to two sub-tasks: a. Build and run the example as is, understand how it works, then b. Find out what to import to your project.  It could be easier this way.

    If you decide to go with the FatFS library, consider update it to the latest version.