I raise this question during use freertos fat. The development environment using iar compiler and MCU is using the cortex-m4. I use the hal library and the contents of FreeRTOS FAT Config.h are as follows:
#define BUS_4BITS 1
#define SDIO_USES_DMA 1
I generated only one task, SDcard write, which write 400byte with 50hz the task is as follows:
void SDCARD_WRITE_Task(void * pvParameters)
{
uint32_t PreviousWakeTime = 0;
SDcard_Init();
SDcard_SetFileName("FDR","/FDR");
for(;;)
{
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_6,GPIO_PIN_SET); //pin high
PreviousWakeTime = osKernelSysTick();
SDcard_Write(ucFileName, SDCARD_Buffer, sizeof(SDCARD_Buffer));
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_6,GPIO_PIN_RESET); // pin low
vTaskDelayUntil(&PreviousWakeTime, 20/portTICK_PERIOD_MS );
}
}
PG6, the pin is high at start, will be low state at the end of the cycle to check the processing time SDcard Write the contents of the function is as follows:

SDCARD WRITE Task oscilloscope results confirmed cases unexpected time length occurred during the test, I set it up 50hz to write 400byte but, sometime it takes 200~250ms oftenly

even if I change the length of bytes the problem still occurred
Why does this problem happen?
is there any chance I can write 512bytes with 50hz?
or is there any limitation of bytes or frequency for SDcard writing?
Is this using the FreeRTOS+FAT? Or something that shipped with your development environment? In any case, it looks like the timing your are measuring is related to the driver that is performing the actual write to the SD card, so I would suggest taking timings inside the driver. Also, have you tried different SD cards - our experience is that the difference in performance between different manufacturers is very large, to the point where some cards are almost unusable while others are very fast when subjected to the same tests.