Is there a "simple" example of how to write/read a USB drive using STM32CubeIDE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-16 5:11 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-16 7:47 PM
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/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 12:28 AM
Maybe you should have a look at example FatFs_USBDisk, it is much simpler and does what you want : write a text file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 8:43 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 9:46 AM
> 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 12:12 PM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 12:13 PM
AScha,
I'll give it a try. What should I do?
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 12:26 PM - edited ‎2024-01-17 12:27 PM
ok,
in IDE -> file-> new STM32 project -> (board selector) give your board H7A3..nucleo -> select it : -> next -> give a name (only ascii, no space, like:) H7A3-test. finish. (init alll... -> yes )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 12:43 PM
in ioc editor ...after a minute or so... debug : trace swo
usb to host only
usb host to msc
+ here platform setting...
then fatfs to usb disk
if you want : long file names (i do..)
and exfat (for big > 32GB sticks)
ok...save file, generate code . (the gear symbol..)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-17 12:54 PM
OK. I followed your instructions and have a saved project with code now.
