Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
sd卡挂载
SPI
10
sd卡通过spi挂载失败
发布于 2022-05-17 17:28:43 浏览:420
订阅该版
我按着官网的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); ``` 然后串口显示挂载失败 
查看更多
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
 能搜索到sd的块,但是挂载的时候调用rt_device_open函数 里面的device_init(dev);返回的是失败了
撰写答案
登录
注册新账号
关注者
0
被浏览
420
关于作者
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
机器人操作系统 (ROS2) 和 RT-Thread 通信
4
五分钟玩转RT-Thread新社区
5
国产MCU移植系列教程汇总,欢迎查看!
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
RyanMqtt 移植指南(三)
2
RyanMqtt QOS质量测试(二)
3
WCH APT 零等待FLASH的思考
4
RyanMqtt使用介绍和示例代码(一)
5
RTT平台 zephyr_polling软件包 Bluenrg2 蓝牙芯片启动流程
热门标签
RT-Thread Studio
串口
Env
LWIP
AT
SPI
Bootloader
FinSH
ART-Pi
CAN总线
Hardfault
USB
文件系统
DMA
RT-Thread
SCons
线程
RT-Thread Nano
MQTT
stm32
ESP8266
rt-smart
WIZnet_W5500
RTC
flash
ota
UART
FAL
packages_软件包
I2C
freemodbus
cubemx
潘多拉开发板_Pandora
定时器
BSP
PWM
ADC
socket
AB32VG1
SDIO
keil_MDK
中断
消息队列_msg_queue
编译报错
Debug
C++_cpp
msh
QEMU
SFUD
MicroPython
本月问答贡献
张世争
19
个答案
4
次被采纳
道友
41
个答案
3
次被采纳
CrazyH
51
个答案
2
次被采纳
踩姑娘的小蘑菇
14
个答案
2
次被采纳
xiaorui
8
个答案
2
次被采纳
本月文章贡献
paradox
5
篇文章
4
次点赞
螺丝松掉的人
4
篇文章
12
次点赞
Ryan_CW
3
篇文章
3
次点赞
子牧r
3
篇文章
2
次点赞
牧尘
2
篇文章
6
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部