cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7 eMMC FATFS writes data speed only 585KB/S

ddavi.8
Associate II

Hi ST communities,

My hardware is MCU STM32F756, eMMC mtfc2gmdea-0m 4bit 24MHZ CLK.

FATFS: R0.12C.

STM32F7_Cube_FW_Ver:STM32Cube_FW_F7_V1.15.0.

Why does eMMC now write data at only 585KB/S.

FATFS_WR_SIZE 8192, every time to writes 1024Bytes.

uint8_t wtext[FATFS_WR_SIZE];

void FATFS_Test(uint32_t count)

{  

  FRESULT res;                                         /* FatFs function common result code */

  uint32_t byteswritten;                        /* File write/read counts */ //bytesread

  uint32_t wt,baktime;

  uint16_t i;

  for(i=0;i<FATFS_WR_SIZE;i+=8)

  {

   wtext[i]='T';

   wtext[i+1]='e';

   wtext[i+2]='s';

   wtext[i+3]='t';

   wtext[i+4]='!';

   wtext[i+5]='!';

   wtext[i+6]='!';

   wtext[i+7]=' ';

  }

  wt=0;

  baktime = wrtime;

  UsbPrintf("baktime=%d,count=%d\r\n",baktime,count);

  if(f_open(&MyFile, "STM32.TXT", FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)

  {

    /* 'STM32.TXT' file Open for write Error */

    //         Error_Handler();

  }

  else

  {

    /*##-5- Write data to the text file ################################*/

    for(ii=0;ii<count;ii++)

    {

      res = f_write(&MyFile, wtext, FATFS_WR_SIZE, (void *)&byteswritten);

      if(res)break;

      if(wt!=wrtime)

      {

       wt=wrtime;

      }

    }

    

    if(res==0)

    {

     wt=count*FATFS_WR_SIZE/1024/(wrtime-baktime);

     UsbPrintf("FATFS eMMC speed:%dKB/s fileSize:%dKB  wrtime=%d\r\n",wt,count*FATFS_WR_SIZE/1024,wrtime);

    }

    if((byteswritten == 0) || (res != FR_OK))

    {

     /* 'STM32.TXT' file Write or EOF Error */

     // Error_Handler();

    }

    else

    {

      /*##-6- Close the open text file #################################*/

      f_close(&MyFile);

    }

  }

}

2 REPLIES 2

>>Why does eMMC now write data at only 585KB/S.

You're clocking the interface too slowly, or not handling multiple block writes properly?

You're not measuring time effectively/properly?

I would time across f_open/f_close to get a real idea of how it was performing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

>>You're clocking the interface too slowly, or not handling multiple block writes properly?

I'm referring to the example of cubemx SD card. I changed it to MMC, but the clock still USES 24MHZ. I saw on the official website that the clock can exceed 24MHZ.Attached is the eMMC driver, please help to see if there is any wrong setting.