2022-12-18 09:45 PM
2022-12-18 09:56 PM
If i write 3 packet of 512 bytes then it takes more than 20 milisec. Yo can see the f_write function which i am usng.
if(f_open(&SDFile, "DATA.TXT", FA_OPEN_EXISTING |FA_WRITE | FA_OPEN_APPEND) != FR_OK)
{
Error_Handler();
}
else
{
res = f_write(&SDFile, &sd_write_buff_New[0], 512, &byteswritten);
res = f_write(&SDFile, &sd_write_buff_New[512], 512, &byteswritten);
res = f_write(&SDFile, &sd_write_buff_New[1024], 512, &byteswritten);
if((byteswritten > 0) && (res == FR_OK))
if(f_open(&SDFile, "DATA.TXT", FA_OPEN_EXISTING |FA_WRITE | FA_OPEN_APPEND) != FR_OK)
{
Error_Handler();
}
else
{
res = f_write(&SDFile, &sd_write_buff_New[0], 512, &byteswritten);
res = f_write(&SDFile, &sd_write_buff_New[512], 512, &byteswritten);
res = f_write(&SDFile, &sd_write_buff_New[1024], 512, &byteswritten);
if((byteswritten > 0) && (res == FR_OK))
{
// if(Led_flag == 1)
// {
// HAL_GPIO_WritePin(Led_Red_GPIO_Port, Led_Red_Pin, GPIO_PIN_RESET);
// Led_flag = 0;
// }
// else if (Led_flag == 0)
// {
// HAL_GPIO_WritePin(Led_Red_GPIO_Port, Led_Red_Pin, GPIO_PIN_SET);
// Led_flag = 1;
// }
datawritecnt++;
if(datawritecnt >= FILE_WRITE_COUNT) //1382400 , 10000 means 55 minutes, 1000000 means 91 hour 40 mean 10sec data 7200 mean 30 minutes
{
datawritecnt = 0;
}
// SendFlag = 1;
#if SD_WRITE_DEBUG
{
char buf[10];
sprintf(buf,"%d\n\r",datawritecnt);
SendString(buf);
}
#endif
}
f_close(&SDFile);
}
{
}
}
f_close(&SDFile);
}
What is the reason of taking high writing time?? I want to write 4096 bytes in less than 1 mili second. It is possible??
2022-12-19 02:14 AM
Slow cards, large erase block size, and small writes?
Write more data less frequently.
Suggest timing 32KB aligned f_write()
Should be able to sustain couple of MBps.
4 MBps might be a challenge, and I don't have L4 benchmarks to hand.