环境: CubeMX(5.2.1) HAL库(1.15.0) STM32F765IIK(主频180MHz,关闭Cache) SDMMC2+DMA FATFS(R0.12c)
测试程序:void sdcard_test_task(void *p) {
static FATFS fs;
FIL fil;
uint32_t bw;
const char *w = "1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n"
"1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234_1234\r\n";
if (f_mount(&fs, "0:", 1)) {
__nop();
return;
}
while (1) {
if (f_open(&fil, "ggg.txt", FA_OPEN_ALWAYS | FA_WRITE) == FR_OK) {
f_lseek(&fil, f_size(&fil));
f_write(&fil, w, strlen(w), &bw);
f_close(&fil);
} else {
__nop();
}
HAL_Delay(100);
}
}
|