额,LZ有其他参考代码吗?发一点代码先
[mw_shl_code=c,true]int main(void)
{
FRESULT res;
uint32_t byteswritten;
volatile int num = 0;
HAL_Init();
SystemClock_Config();
res = FATFS_LinkDriver(&SDRAMDISK_Driver, RAMpath);
if(res != FR_OK)
Error_Handler();
res = FATFS_LinkDriver(&SD_Driver, SDpath);
if(res != FR_OK)
Error_Handler();
res = f_mount(&RAMFatFs, (TCHAR const*)RAMpath, 0);
if(res != FR_OK)
Error_Handler();
res = f_mount(&SDFatFs, (TCHAR const*)SDpath, 0);
if(res != FR_OK)
Error_Handler();
/*
res = f_mkfs((TCHAR const*)SDpath, 0, 0);
if(res != FR_OK)
Error_Handler();
*/
res = f_open(&SDFile, "1:STM000.c", FA_OPEN_ALWAYS | FA_WRITE);
if(res != FR_OK)
Error_Handler();
write_buf(middle); //往middle里面填满4096字节数据
while(1) {
num++;
res = f_write(&SDFile, middle, 4096, (void *)&byteswritten);
f_sync(&SDFile);
}
f_close(&SDFile);
FATFS_UnLinkDriver(RAMpath);
FATFS_UnLinkDriver(SDpath);
/* Infinite loop */
while (1)
{
}
}
void write_buf(char middle[4096]) {
char *p = "aaaaaaaabbbbbbbbeeeeeeeeffffffff";
int count = 0;
while(count < 128) {
count++;
strncat(middle,p,128);
}
}
[/mw_shl_code]
大致调用就这样了,里面有RAM,不过没用到
另外我的SD卡簇大小格式化成了4096
|