OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6157|回复: 8

【原子大大进来瞅瞅】关于STM32移植最新的FATFS0.13a的求助

[复制链接]

1

主题

7

帖子

0

精华

新手上路

积分
30
金钱
30
注册时间
2018-1-30
在线时间
4 小时
发表于 2018-1-30 13:53:40 | 显示全部楼层 |阅读模式
1金钱
本帖最后由 yifanshu02 于 2018-1-30 15:01 编辑

最近通过原子的视频在学习STM32,今天移植FATFS,去官网下载的最新的FATFS版本为R0.13a,移植过程中发现了与原子视频很多的不同之处,请问各位大大,以及原子大大有没有移植过最新的FATFS?能否给点指导
附件上传一下FATFS-r0.13a吧
ff13a.zip (2.26 MB, 下载次数: 194)

最佳答案

查看完整内容[请看2#楼]

下一个HAL库版本的带FATFS的程序,然后把你下的0.13A的ff.h,ff.c等文件粘贴过去,直接覆盖,然后再拷贝回来就解决了 原子标准库用的是0.10,hal库是0.12,基本上和0.13差不多了,只是ff.h里面的define定义的头都改成FF_了 之前是_
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

3

主题

85

帖子

0

精华

高级会员

Rank: 4

积分
586
金钱
586
注册时间
2016-5-13
在线时间
106 小时
发表于 2018-1-30 13:53:41 | 显示全部楼层
下一个HAL库版本的带FATFS的程序,然后把你下的0.13A的ff.h,ff.c等文件粘贴过去,直接覆盖,然后再拷贝回来就解决了
原子标准库用的是0.10,hal库是0.12,基本上和0.13差不多了,只是ff.h里面的define定义的头都改成FF_了 之前是_
回复

使用道具 举报

1

主题

7

帖子

0

精华

新手上路

积分
30
金钱
30
注册时间
2018-1-30
在线时间
4 小时
 楼主| 发表于 2018-1-30 16:00:30 | 显示全部楼层
abdfgh 发表于 2018-1-30 15:44
下一个HAL库版本的带FATFS的程序,然后把你下的0.13A的ff.h,ff.c等文件粘贴过去,直接覆盖,然后再拷贝回来就 ...

呢,我去试试
回复

使用道具 举报

4

主题

116

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
4072
金钱
4072
注册时间
2017-11-15
在线时间
330 小时
发表于 2018-2-28 09:20:51 | 显示全部楼层
顶帖,我用0.9的f_mount(0, &fs);能成功。想着升级到最新版,结果
res = f_mount(&fs,"",1);
    printf("%d ",res);
错误码13,挂载都是个事儿。
求支援。
www.littlebutler.top
回复

使用道具 举报

4

主题

116

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
4072
金钱
4072
注册时间
2017-11-15
在线时间
330 小时
发表于 2018-2-28 09:33:00 | 显示全部楼层
求助分析一下
res = f_mount(&fs,"",1);
printf("%d ",res);
返回值13
www.littlebutler.top
回复

使用道具 举报

4

主题

116

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
4072
金钱
4072
注册时间
2017-11-15
在线时间
330 小时
发表于 2018-2-28 10:37:10 | 显示全部楼层
经过跟踪代码,发现,[mw_shl_code=c,true]DRESULT disk_read (
        BYTE pdrv,                /* Physical drive nmuber to identify the drive */
        BYTE *buff,                /* Data buffer to store read data */
        DWORD sector,        /* Start sector in LBA */
        UINT count                /* Number of sectors to read */
)
{
        DRESULT res;
        int result;

        switch (pdrv) {
        case DEV_RAM :
                // translate the arguments here

                result = RAM_disk_read(buff, sector, count);

                // translate the reslut code here

                return res;

        case DEV_MMC :
                // translate the arguments here

                result = MMC_disk_read(buff, sector, count);

                // translate the reslut code here

                return res;

        case DEV_USB :
                // translate the arguments here

                result = USB_disk_read(buff, sector, count);

                // translate the reslut code here

                return res;
        }

        return RES_PARERR;
}[/mw_shl_code]
上面是原本的,改成下面
[mw_shl_code=applescript,true]DRESULT disk_read (
        BYTE pdrv,                /* Physical drive nmuber to identify the drive */
        BYTE *buff,                /* Data buffer to store read data */
        DWORD sector,        /* Start sector in LBA */
        UINT count                /* Number of sectors to read */
)
{
        DRESULT res;
        int result;

        switch (pdrv) {
        case DEV_RAM :
                // translate the arguments here

//                result = RAM_disk_read(buff, sector, count);

                // translate the reslut code here

                return res;

        case DEV_MMC :
                // translate the arguments here

                if(count==1)
        {
              SD_ReadBlock(sector << 9 ,buff2,SECTOR_SIZE);
              memcpy(buff,buff2,SECTOR_SIZE);
        }
        else
        {
              SD_ReadMultiBlocks(sector << 9 ,buff2,SECTOR_SIZE,count);
              memcpy(buff,buff2,SECTOR_SIZE * count);
        }

                // translate the reslut code here

                return RES_OK;

        case DEV_USB :
                // translate the arguments here

//                result = USB_disk_read(buff, sector, count);

                // translate the reslut code here

                return res;
        }

        return RES_PARERR;
}[/mw_shl_code]
并不可行,发现传入的参数是0。
然后索性改成
[mw_shl_code=applescript,true]
DRESULT disk_read (
        BYTE pdrv,                /* Physical drive nmuber to identify the drive */
        BYTE *buff,                /* Data buffer to store read data */
        DWORD sector,        /* Start sector in LBA */
        UINT count                /* Number of sectors to read */
)
{

        if(count==1)
        {
              SD_ReadBlock(sector << 9 ,buff2,SECTOR_SIZE);
              memcpy(buff,buff2,SECTOR_SIZE);
        }
        else
        {
              SD_ReadMultiBlocks(sector << 9 ,buff2,SECTOR_SIZE,count);
              memcpy(buff,buff2,SECTOR_SIZE * count);
        }
                // translate the reslut code here

                return RES_OK;
}[/mw_shl_code]
就可以了。现在比较疑惑的是,怎么改这个传入参数。没有看到你说的lun;
www.littlebutler.top
回复

使用道具 举报

4

主题

116

帖子

0

精华

论坛元老

Rank: 8Rank: 8

积分
4072
金钱
4072
注册时间
2017-11-15
在线时间
330 小时
发表于 2018-2-28 16:19:25 | 显示全部楼层
IdeaMing 发表于 2018-2-28 10:37
经过跟踪代码,发现,[mw_shl_code=c,true]DRESULT disk_read (
        BYTE pdrv,                /* Physical drive nmuber t ...

问题已经解决了,详细看http://www.openedv.com/forum.php ... 5&highlight=fat
www.littlebutler.top
回复

使用道具 举报

5

主题

27

帖子

0

精华

初级会员

Rank: 2

积分
103
金钱
103
注册时间
2017-7-1
在线时间
23 小时
发表于 2018-3-8 15:18:33 | 显示全部楼层
哥们 你的0.13a  语言怎么支持啊
回复

使用道具 举报

2

主题

46

帖子

0

精华

初级会员

Rank: 2

积分
140
金钱
140
注册时间
2014-8-31
在线时间
33 小时
发表于 2018-5-8 20:17:47 | 显示全部楼层
这两天也在研究移植最新的FatFS,发现出现问题,现在仍没解决呢,关注中
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-8 05:16

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表