i using STMF779I-EVAL board and try to implement USB Mass Storage + SD Card . But the read/write speed i am getting when write/read from Window PC is too slow.
Read : 1MB/s; Write : 200KB/s
Even I already used DMA mechanism to speed up the SDMMC driver .
This is my implementation for read/write
int8_t STORAGE_Write_HS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
uint32_t timeout = 0;
if(HAL_OK != HAL_SD_WriteBlocks_DMA(&hsd1, buf, blk_addr, (uint32_t) blk_len))
printf("Error : STORAGE_Write_HS failed Err: %u, blk_addr : %u ; blk_len : %u\n", hsd1.ErrorCode, blk_addr, blk_len);
// Callback HAL_SD_TxCpltCallback increare writestatus to check writing status
while (writestatus == 0)
writestatus = 0;
/* Wait until SD card is ready to use for new operation */
while (HAL_SD_GetCardState(&hsd1) != HAL_SD_CARD_TRANSFER)
/* USER CODE END 14 */
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
if(hsd->Instance == SDMMC1)
writestatus = 1;
I think that the HAL_SD_GetCardState(0 to long time to change state to HAL_SD_CARD_TRANSFER.
Could you let me know what is the root cause and is there any way to improve the speed ?
Thank you very much.