cancel
Showing results for 
Search instead for 
Did you mean: 

Read/Write file into eMMC using Fatfs on STM32H750B-dk board

Prajyot1
Associate III

Hello,
I am working on a project using the STM32H750B-DK board with an eMMC storage device, interfaced via the SDMMC1 peripheral and the FatFs library for file operations. However, I am unable to read or write files to the eMMC.

I have implemented the drivers and example code from `~\STM32Cube_FW_H7_V1.12.1\Projects\STM32H745I-DISCO\Applications\FatFs\FatFs_Shared_Device` and `~\STM32Cube_FW_H7_V1.12.1\Drivers\BSP\STM32H750B-DK`, but we are still unable to create files or perform read/write operations on the eMMC (4GB).

I am sharing my project zip file. Any guidance on adjustments or in configuration can be a big help.
Thank You.

4 REPLIES 4
Andrew Neil
Super User

What tests/investigations/debugging have you done to find where/why it's failing ?

Does it build cleanly - ie, with no errors and no warnings?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@Andrew Neil 
Yes , we have build the project without errors.

i have customize diskio.c for eMMC
Action: Modified diskio.c to interface with the STM32H750B-DK’s SDMMC peripheral using the HAL MMC driver.
In diskio.c , implemented the required functions (disk_initialize, disk_status, disk_read, disk_write, disk_ioctl) to call HAL functions from stm32h7xx_hal_mmc.c.

while  debugging:

fres = f_mkfs("", FM_ANY, 0, workBuffer, sizeof(workBuffer));
 if (fres != FR_OK) {
    printf("f_mkfs failed: %d\n", fres);
    }

 i got fres = FR_DISK_ERR.



@Prajyot1 wrote:

 i got fres = FR_DISK_ERR.


So have you looked-up what that error code means?

Have you stepped into f_mks() to see where & why it fails?

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

yes, i stepped int f_mks()  , got to know that
if (disk_write(pdrv, buf, b_vol, 1) != RES_OK) return FR_DISK_ERR; /* Write it to the VBR sector */
returning FR_DISK_ERR. function in diskio.c are not properly initialize causing failure. In that i need help..