OpenEdv-开源电子网

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

使用SDIO+DMA 来读写SD卡,怎么提高写的速度?

[复制链接]

2

主题

7

帖子

0

精华

新手上路

积分
32
金钱
32
注册时间
2016-10-31
在线时间
3 小时
发表于 2016-11-7 11:54:27 | 显示全部楼层 |阅读模式
1金钱
   在MINI开发板上我开始使用SPI接口实现一个读卡器,在Windows上写的速度是200KB左右,满足不了要求。后来我改成使用SDIO接口+DMA的方式来读写SD卡,但是在Windows上写文件的速度只有250KB左右,速度提高不明显啊。 我使用的是库函数版本是3.5的。请求指导一下,怎么提高U盘的读写速度啊???
   另外,如果我想使用外接USB的高速PHY芯片,如USB3300 芯片,是不是只能使用STM32F2或者STM32F4的主控啊?


最佳答案

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

我是配置成这样: #define SDIO_FIFO_Address ((uint32_t)0x40018080) DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)SDIO_FIFO_Address;
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

2

主题

7

帖子

0

精华

新手上路

积分
32
金钱
32
注册时间
2016-10-31
在线时间
3 小时
 楼主| 发表于 2016-11-7 11:54:28 | 显示全部楼层
夏至硬汉 发表于 2016-11-9 13:04
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&SDIO->DR;求问楼主这个你是怎么配置的,我编译就 ...

我是配置成这样:
#define SDIO_FIFO_Address               ((uint32_t)0x40018080)
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)SDIO_FIFO_Address;
回复

使用道具 举报

2

主题

7

帖子

0

精华

新手上路

积分
32
金钱
32
注册时间
2016-10-31
在线时间
3 小时
 楼主| 发表于 2016-11-9 11:57:57 | 显示全部楼层
我自己来顶一下,我测试了一下SPI+SD方式的读写速度,写200KB左右,读350KB左右,是不是我们底层驱动函数导致读写这么慢啊?
回复

使用道具 举报

2

主题

7

帖子

0

精华

新手上路

积分
32
金钱
32
注册时间
2016-10-31
在线时间
3 小时
 楼主| 发表于 2016-11-9 12:01:34 | 显示全部楼层
这是我测试读写速度的程序:
[mw_shl_code=c,true]printf("Write single sector time begin ...\r\n");
                couter_time = 0;
                TIM_Cmd(TIM3, ENABLE);        
                for(i=0; i<10000; i++)
                {
                        SDCARD_Write_Sector(read_write_buf,1000+i,1);
                }
                TIM_Cmd(TIM3, DISABLE);
                printf("Write single sector time over ...\r\n");
                printf("write single: time=%d s \r\n",couter_time);
                printf("write single: speed=%d KBps \r\n",5120/couter_time);//(512 * 1000/1024)=5120
               
                printf("Read single sector time begin ...\r\n");
                couter_time = 0;
                TIM_Cmd(TIM3, ENABLE);         
                for(i=0; i<10000; i++)
                {
                        SDCARD_Read_Sector(read_write_buf,1000+i,1);
                }
                TIM_Cmd(TIM3, DISABLE);        
                printf("Read single sector time over ...\r\n");
                printf("Read single : time=%d s \r\n",couter_time);
                printf("Read single : speed=%d KBps \r\n",5120/couter_time);//(512 * 1000/1024)=5120
               
               
               
                printf("Write multi sector time begin ...\r\n");
                couter_time = 0;
                TIM_Cmd(TIM3, ENABLE);  
                for(i=0; i<10000; i+=20)
                {
                        while( SDCARD_Write_Sector(read_write_buf,20000+i,20) == 0xff){};
                }
                TIM_Cmd(TIM3, DISABLE);  
                printf("Write multi sector time over ...\r\n");
                printf("write multi: time=%d s \r\n",couter_time);
                printf("write multi: speed=%d KBps \r\n",5120/couter_time);//(512 * 1000/1024)=5120
               
                printf("Read multi sector time begin ...\r\n");
                couter_time = 0;
                TIM_Cmd(TIM3, ENABLE);  
                for(i=0; i<10000; i+=20)
                {
                        while( SDCARD_Read_Sector(read_write_buf,20000+i,20) == 0xff ){};
                }
                TIM_Cmd(TIM3, DISABLE);  
                printf("Read multi sector time over ...\r\n");
                printf("Read multi : time=%d s \r\n",couter_time);
                printf("Read multi : speed=%d KBps \r\n",5120/couter_time);//(512 * 1000/1024)=5120[/mw_shl_code]
回复

使用道具 举报

11

主题

34

帖子

0

精华

新手上路

积分
24
金钱
24
注册时间
2016-8-15
在线时间
22 小时
发表于 2016-11-9 13:04:22 | 显示全部楼层
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&SDIO->DR;求问楼主这个你是怎么配置的,我编译就出错
回复

使用道具 举报

11

主题

34

帖子

0

精华

新手上路

积分
24
金钱
24
注册时间
2016-8-15
在线时间
22 小时
发表于 2016-11-9 14:05:41 | 显示全部楼层
elimbug 发表于 2016-11-9 13:40
我是配置成这样:
#define SDIO_FIFO_Address               ((uint32_t)0x40018080)
DMA_InitStructur ...

解决了,谢谢
回复

使用道具 举报

2

主题

7

帖子

0

精华

新手上路

积分
32
金钱
32
注册时间
2016-10-31
在线时间
3 小时
 楼主| 发表于 2016-12-2 13:52:36 | 显示全部楼层
没有人回吗?我顶一下,请大神指导一下啊!!!!
回复

使用道具 举报

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

本版积分规则



关闭

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

正点原子公众号

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

GMT+8, 2025-5-25 19:28

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

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