我想将数据写入zedboard的sdcard。我能够将数据写入 DRAM。现在我想读取DRAM的数据并将其写入SD卡。我遵循了这个(http://elm-chan.org/fsw/ff/00index_e.html),但它不符合我的要求。我无法为此找到任何教程任何示例等。请任何教程链接或任何示例。谢谢。
问问题
3396 次
3 回答
1
请注意,经验告诉我,您需要以文件系统块大小的倍数写入文件,对于 FAT 文件系统,通常为 512 字节。写入少于 512 个字节并关闭文件将使其长度为零字节。
于 2017-09-15T22:12:52.710 回答
1
如果您使用的是 Vivado SDK,我假设您是,那么使用 SD 卡非常简单。
- 要在 Xilinx SDK 中包含 Fat 文件系统,请打开您的 Board Support Package(system.mss 文件)并选择Modify this BSP's Settings。在概览下,您可以选择xilffs。
- 接下来,您必须编写软件以访问 SD 卡。这个库提供了各种各样的功能。您可以查看here_1、here_2或here_3。在这第二个参考中提供了各种各样的复杂功能。
除此之外,为了使用SD卡,你基本上应该做的事情写在下面。请注意,这只是一个概述,您应该参考我给您的参考资料。
# Flush the cache
Xil_DCacheFlush();
Xil_DCacheDisable();
# Initialize the SD Card
f_mount(0, 0);
f_mount(0, <FATFS *>)
# Open a file using f_open
# Read and Write Operations
# Either use f_write or f_read
# Close your file with f_close
# Unmount the SD with f_mount(0,0)
于 2015-09-10T15:31:47.227 回答
0
在新版本的 Xilffs (Fatfs) 库语法几乎没有改变。
新语法是:
static FATFS FS_instance; // File System instance
const char *path = "0:/"; // string pointer to the logical drive number
static FIL file1; // File instance
FRESULT result; // FRESULT variable
static char fileName[24] = "FIL"; // name of the log
result = f_mount(&FS_instance, path, 0); //f_mount
result = f_open(&file1, (char *)fileName, FA_OPEN_ALWAYS | FA_WRITE); //f_open
可能这可以帮助你。
于 2017-03-09T05:26:41.597 回答