最近试玩了STM32用SPI方式操作SD卡,这样就涉及到文件系统,搜索到几种支持FAT16/32的文件,综合考虑,最后选择了完全开源、免费的FATFS,版本是R0.07e,该版本支持长文件名:
Since the FatFs module is completely separated from disk I/O layer, it requires following functions to lower layer to read/write the physical disk and to get current time. The low level disk I/O module is not a part of FatFs module so that it must be provided by user. The sample drivers are also available in the resources.
- disk_initialize - Initialize disk drive
- disk_status - Get disk status
- disk_read - Read sector(s)
- disk_write - Write sector(s)
- disk_ioctl - Control device dependent features
- get_fattime - Get current time
以下是512M SD1.0卡和4G SDHC卡的测试结果:
**************************************************
Card Type : SD V1
File System Sub Type : FAT16
Total space (Bytes) : 511574016
Available space (Bytes) : 511369216
Physical drive number : 0
Maximum cluster : 62450
Number of free clusters : 62423
Last allocated cluster : 0
Maximum sector size : 512
Number of sectors per cluster : 16
Number of FAT copies : 2
Sectors per fat : 244
File system info sector : 0
Root directory start sector : 729
FAT start sector : 241
Data start sector : 761
**************************************************
Write File Successed: 0:CardInfo.txt, 64:64
Write File Successed: 0:ffext2.ini, 13312:13312
Read File Successed: 0:ffext2.ini, 13312:13312
Write File Successed: 0:ffext1.txt, 13312:13312
**************************************************
Card Type : SD V2HC
File System Sub Type : FAT32
Total space (Bytes) : 3949592576
Available space (Bytes) : 3949588480
Physical drive number : 0
Maximum cluster : 964258
Number of free clusters : 964255
Last allocated cluster : 3
Maximum sector size : 512
Number of sectors per cluster : 8
Number of FAT copies : 2
Sectors per fat : 7534
File system info sector : 1
Root directory start sector : 2
FAT start sector : 36
Data start sector : 15104
**************************************************
Write File Successed: 0:CardInfo.txt, 64:64
Write File Successed: 0:ffext2.ini, 13312:13312
Read File Successed: 0:ffext2.ini, 13312:13312
Write File Successed: 0:ffext1.txt, 13312:13312
以下是移植文件:
(601.38 K) 该附件被下载次数 126
相关推荐
地线干扰与抑制
三菱FX系列PLC教程 20 —— FX系列的取脉冲指令(LDP、LDF、ANDP、ANDF、ORP、ORF)
Sony据报考虑出售通讯芯片业务 料估值约3亿美元
半导体键合市场创新推动先进封装技术
铜关税给芯片供应链带来压力和不确定性
三菱FX系列PLC教程 19 —— FX系列的取反指令(INV)
一个数码相机的电路图
8w高保真有源奋调调节放大器电路
甲类功放电路
keil的问题,各位高手请进
科技支出仍然持续不确定
3W功率放大器电路
美国电子产品进口结构半年来转变巨大
Alphabet超出盈利目标,但投资者担心人工智能支出增加
东风获得顶级安全认证 将世界级车辆安全带到阿联酋
华硕工程师谈主板供电电路设计 经典!!
三菱FX系列PLC教程 22 —— FX系列的置位与复位指令(SET RST)
白宫发布广泛的人工智能政策建议
三菱FX系列PLC教程 18 —— FX系列的接点并联指令(OR、ORI)
有源低通滤波器的优化设计
10w、15w高保夏放大器电路
vxworks中启动顺序的问题
哪里有system designer 3.0?
采用低电压电源互补输出级的1.5w低频放大器电路
三菱FX系列PLC教程 21 —— FX系列的微分输出指令(PLS PLF)
USB芯片CY7C63723
中国集成电路大全 接口部分
白宫公布美国人工智能行动计划
ads使用求教
莱迪思与三菱电机合作带来新一代工业自动化体验