Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
sd卡挂载
SPI
10
sd卡通过spi挂载失败
发布于 2022-05-17 17:28:43 浏览:875
订阅该版
我按着官网的sd卡文件系统教程来的 添加了如下三个函数 ```c void sd_mount(void *parameter) { while (1) { rt_thread_mdelay(500); if(rt_device_find("sd0") != RT_NULL) { if (dfs_mount("sd0", "/C", "elm", 0, 0) == RT_EOK) { LOG_I("sd card mount to '/C'"); break; } else { LOG_W("sd card mount to '/C' failed!"); } } } } int stm32_sdcard_mount(void) { rt_thread_t tid; tid = rt_thread_create("sd_mount", sd_mount, RT_NULL, 1024, RT_THREAD_PRIORITY_MAX - 2, 20); if (tid != RT_NULL) { rt_thread_startup(tid); } else { LOG_E("create sd_mount thread err!"); } return RT_EOK; } INIT_APP_EXPORT(stm32_sdcard_mount); static int rt_hw_spi1_tfcard(void) { __HAL_RCC_GPIOC_CLK_ENABLE(); rt_hw_spi_device_attach("spi1", "spi10", GPIOC, GPIO_PIN_3); LOG_I("sd card \r\n"); return msd_init("sd0", "spi10"); } INIT_DEVICE_EXPORT(rt_hw_spi1_tfcard); ``` 然后串口显示挂载失败 ![image.png](https://oss-club.rt-thread.org/uploads/20220517/d36f2e004c09c3b2733c1afda80ff052.png)
查看更多
4
个回答
默认排序
按发布时间排序
Jim Carrey
2022-05-17
这家伙很懒,什么也没写!
建议直接找到源码加Log分析 源码位置: rt-thread/components/dfs/src/dfs_fs.c line of 214: ```c /** * this function will mount a file system on a specified path. * * @param device_name the name of device which includes a file system. * @param path the path to mount a file system * @param filesystemtype the file system type * @param rwflag the read/write etc. flag. * @param data the private data(parameter) for this file system. * * @return 0 on successful or -1 on failed. */ int dfs_mount(const char *device_name, const char *path, const char *filesystemtype, unsigned long rwflag, const void *data) ``` 加Log分析具体是哪个 return -1 的case 然后验证自己的代码
JonasWen
2022-05-18
这家伙不懒,但是什么也不想写!
你根目录挂载的是什么系统
YZRD
2022-05-18
这家伙很懒,什么也没写!
第一次挂载前可以先格式化试下
imwhisky
2022-05-18
whisky
![image.png](https://oss-club.rt-thread.org/uploads/20220518/4b235b5494ec2a2efde90f5a07b38802.png) 能搜索到sd的块,但是挂载的时候调用rt_device_open函数 里面的device_init(dev);返回的是失败了
撰写答案
登录
注册新账号
关注者
0
被浏览
875
关于作者
imwhisky
whisky
提问
18
回答
3
被采纳
0
关注TA
发私信
相关问题
1
BBB的SPI驱动
2
求个SPI上挂两个或多个设备的使用例子
3
SPI设备有个bug
4
spi flash 的fatfs使用一段时间后读写文件出现故障
5
SPI驱动
6
请教rt_spi_configure函数理解
7
SPI FLASH挂载的问题
8
SPI-FLASH 文件系统 SPIFFS
9
求助一个完整的 spi flash 驱动
10
关于同时使用文件系统与SPI FLASH的问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
【RT-Thread】【ci】【scons】将ci.attachconfig.yml和scons结合使用
2
Rt-thread中OTA下载后,bootloader不搬程序
3
ulog 日志 LOG_HEX 输出时间改为本地日期时间
4
在RT-Thread Studio中构建前执行python命令
5
研究一了一段时间RTT,直接标准版上手太难,想用nano,但又舍不得组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
I2C_IIC
ESP8266
UART
WIZnet_W5500
ota在线升级
cubemx
PWM
flash
freemodbus
BSP
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
SFUD
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
出出啊
1518
个答案
343
次被采纳
小小李sunny
1444
个答案
290
次被采纳
张世争
813
个答案
177
次被采纳
crystal266
547
个答案
161
次被采纳
whj467467222
1222
个答案
149
次被采纳
本月文章贡献
出出啊
1
篇文章
5
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
3
次点赞
crystal266
2
篇文章
2
次点赞
whj467467222
2
篇文章
2
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部