2022-02-27 09:41 AM
I'm trying to use an STM32H745I-DISCO to log values from a sensor, append the values on a .txt file on the onboard eMMC, and have the text file accessible when plugging in the board over usb (so using the board as a usb device). In other words, I want to use the internal eMMC as an SD card available over mass storeage. This all should happen using only the H7 core. I have screenshots of all the cubemx configurations attached. I'm running the code from this tutorial https://www.youtube.com/watch?v=I9KDN1o6924 to get the FatFS filesystem working. It errors out at a call to SD_PowerOn. I think the issue is in the FATFs configuration in CubeMX under platform settings, but none of the options match the tutorial. I looked at the FatFs_Shared_Device example, but it looks like a totally different middleware.
2022-02-27 11:19 AM
SD Card and eMMC are sufficiently different in their behaviour and expectations that they are not interchangeable.
My approach here would be to take an USB MSC Device example (H747I-DISCO), and merge in the eMMC support, replacing the SD Card usage.
2022-02-27 12:13 PM
Ok. Thanks for the tip. This may be better for a separate thread in the forum, but I am looking at the FatFS_Shared_Device example in the CubeIDE with the goal of merging it with a USB mass storage example. This example is for the specific board, and should just write to the eMMC. It errors out on the first call to f_mkfs, which is line 147 of the example -- the serial communication works fine. Is there another example or any tips on how to debug? It's somewhat concerning that the example doesn't work.
2022-02-27 07:03 PM
Did these with my HAL H7 eMMC port in Keil, not using CubeMX boiler plate code generator.
https://github.com/cturvey/RandomNinjaChef/tree/main/STM32H745I_DISCO_eMMC
The MSC Device perhaps needs some more work, but should illustrate proof-of-concept
2022-02-28 08:03 AM
Thanks for the build! I ran it, and I get the "Here#1" and "Here#2" debug messages over serial. Would the issue with the FatFS_Shared_Device example be with the example or my build environment in that case? Also, would you have any suggestions on starting points for getting the eMMC device working? Looks like there's only one documented example of its useage (the FatFS example).
2022-02-28 09:25 AM
Should be additional messages if the device enumerates via the USB-FS Micro-AB connector.
Might be some powering jumper, or power-on-reset robustness issues.
As I recall the Example\BSP and Example\MMC exist too, but as I recall I had to spend a lot of time with the H7's generally for eMMC, and especially the DDR modes, with code going back before v1.5.0 and perhaps V1.2.0 using the SD-to-MMC adapter cards