专栏中心

EEPW首页 > 专栏 > STM32 SD卡FATFS移植

STM32 SD卡FATFS移植

发布人:0750long 时间:2010-02-11 来源:工程师 发布文章

 

最近试玩了STM32用SPI方式操作SD卡,这样就涉及到文件系统,搜索到几种支持FAT16/32的文件,综合考虑,最后选择了完全开源、免费的FATFS,版本是R0.07e,该版本支持长文件名:

  • Windows compatible FAT12/16/32 file system.
  • Platform independent. Easy to port.
  • Very small footprint for code and work area.
  • Various configuration options:
    • Multiple volumes (physical drives and partitions).
    • Multiple OEM code pages including DBCS.
    • Long file name (LFN) support in OEM code or Unicode.
    • RTOS support.
    • Multiple sector size support.
    • Read-only, minimized API, I/O buffer and etc...

官网地址:http://elm-chan.org
下载地址:http://elm-chan.org/fsw/ff/ff007e.zip
本地下载:FATFS R007e

(786.01 K) 该附件被下载次数 99


感受就是FATFS十分容易移植,同时对资源不是要求很高,网上对FATFS的移植也比较多。
要点是:
1:SD底层驱动
2:Disk I/O Interface
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

专栏文章内容及配图由作者撰写发布,仅供工程师学习之用,如有侵权或者其他违规问题,请联系本站处理。 联系我们

关键词:

相关推荐

地线干扰与抑制

资源下载 2007-12-24

三菱FX系列PLC教程 20 —— FX系列的取脉冲指令(LDP、LDF、ANDP、ANDF、ORP、ORF)

Sony据报考虑出售通讯芯片业务 料估值约3亿美元

半导体键合市场创新推动先进封装技术

铜关税给芯片供应链带来压力和不确定性

EDA/PCB 2025-07-24

一个数码相机的电路图

科技支出仍然持续不确定

美国电子产品进口结构半年来转变巨大

Alphabet超出盈利目标,但投资者担心人工智能支出增加

东风获得顶级安全认证 将世界级车辆安全带到阿联酋

华硕工程师谈主板供电电路设计 经典!!

白宫发布广泛的人工智能政策建议

有源低通滤波器的优化设计

中国集成电路大全 接口部分

白宫公布美国人工智能行动计划

莱迪思与三菱电机合作带来新一代工业自动化体验

更多 培训课堂
更多 焦点
更多 视频

技术专区