Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
dfs_mount
SFUD
外部flash
挂载失败,Can't enable write status.
发布于 2022-11-03 11:30:17 浏览:1206
订阅该版
[tocm] 外部flash挂载文件系统失败,`[I/SFUD] Error: Can't enable write status`. - Board: AT_START_F437_V1.0 - MCU: AT32F437ZMT7 - Flash: EN25QH128A-104HIP ## 原理图: ![Dingtalk_20221103112028.jpg](https://oss-club.rt-thread.org/uploads/20221103/c4cd4f8e97c1af083c2f8a2a32f5fbb6.jpg "Dingtalk_20221103112028.jpg") ## 日志: ``` initialize rti_board_start:0 done initialize rt_hw_qspi_bus_init[D/drv.qspi] qspi1 register success :0 done initialize rt_hw_pin_init:0 done initialize rt_hw_spi_init:0 done \ | / - RT - Thread Operating System / | \ 4.1.1 build Nov 3 2022 10:47:58 2006 - 2022 Copyright by RT-Thread team do components initialization. initialize rtu:865) The flash device manufacturer ID is 0x1C, memory type ID is 0x70, capacity ID is 0x18. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:131) Check SFDP header is OK. The reversion is V1.0, NPN is 0. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:173) Check JEDEC basic flash parameter header is OK. The table id is 0, reversion is V1.0, length is 9, parameter table pointer is 0x000030. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:203) JEDEC basic flash parameter table info: [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:204) MSB-LSB 3 2 1 0 [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0001] 0xFF 0xB1 0x20 0xED [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0002] 0x07 0xFF 0xFF 0xFF [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0003] 0x6B 0x00 0xEB 0x5F [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0004] 0xBB 0x04 0x3B 0x08 [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0005] 0xFF 0xFF 0xFF 0xFE [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0006] 0xFF 0x00 0xFF 0xFF [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0007] 0xEB 0x5F 0xFF 0xFF [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0008] 0x52 0x0F 0x20 0x0C [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:206) [0009] 0xFF 0x00 0xD8 0x10 [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:215) 4 KB Erase is supported throughout the device. Command is 0x20. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:234) Write granularity is 64 bytes or larger. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:250) Block Protect bits in device's status register are solely volatile. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:255) Flash device requires instruction 50h as the write enable prior to performing a volatile write to the status register. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:271) 3-Byte only addressing. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:305) Capacity is 16777216 Bytes. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:311) Flash device supports 4KB block erase. Command is 0x20. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:311) Flash device supports 32KB block erase. Command is 0x52. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud_sfdp.c:311) Flash device supports 64KB block erase. Command is 0xD8. [I/SFUD] Find a EON flash chip. Size is 16777216 bytes. [D/SFUD] (/mnt/d/repo/rt-thread/components/drivers/spi/sfud/src/sfud.c:844) Flash device reset success. [I/SFUD] en25qh128 flash device is initialize success. flash already enter qspi mode [I/SFUD] Probe SPI flash en25qh128 by SPI device qspi10 success. flash sfud success :0 done initialize elm_init:0 done initialize finsh_system_init:0 done [390 main] HZ 288000000 [390 mnt_init] mkfs elm [W/time] Cannot find a RTC device! [I/SFUD] Error: Can't enable write status. format error, result=1 [410 mnt_init] mount en25qh128 dfs mount failed msh /> ``` ------------------------------------ ## 挂载成功代码如下: ```c /** * 使能qspi模式 * @param device : qspi设备 */ static void w25q128jvx_enter_qspi_mode(struct rt_qspi_device* device) { /* 0x38 enter qpi mode */ char instruction = 0x38; char status = w25q128jv_read_status_register2(device); char write_status2_buf[2] = { 0 }; /* 0x31 write status register2 */ write_status2_buf[0] = 0x31; status |= 1 << 1; //w25q128jv写使能 w25q128jv_write_enable(device); //写状态寄存器 write_status2_buf[1] = status; rt_qspi_send(device, &write_status2_buf, 2); //设置qspi模式 rt_qspi_send(device, &instruction, 1); rt_thread_mdelay(10); g_FlashIsEnterQspi = true; } /** * 挂在设备到qspi总线上 * @return 挂载状态 */ static int rt_hw_qspi_flash_with_sfud_init(void) { logi(); /* w25q128jv128挂在qspi总线上 */ rt_err_t ret = at32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25q128jvx_enter_qspi_mode, RT_NULL); if (ret != RT_EOK) { rt_kprintf("qspi attach device failed\n"); return -RT_ERROR; } return RT_EOK; } /** * 注册为快设备 * @return 状态 */ static int rt_hw_qspi_block_device_init(void) { rt_hw_qspi_flash_with_sfud_init(); /* w25q128jvh 注册为块设备*/ if (RT_NULL == rt_sfud_flash_probe(DISK_FLASH_DEV_NAME, "qspi10")) { rt_kprintf("flash sfud failed\n"); return -RT_ERROR; } return RT_EOK; } /*设备自动初始化 */ INIT_DEVICE_EXPORT(rt_hw_qspi_block_device_init); /** * qspi退出qpi模式,并复位 */ void w25q128jv_reset() { /* * Reset Quad I / O(RSTQIO) (FFh) or Release Quad I / O Fast Read Enhancement Mode(FFh) * 0xff This command can’t be used in Standard SPI mode. */ qspi_cmd_type cmd; cmd.pe_mode_enable = FALSE; cmd.pe_mode_operate_code = 0; cmd.instruction_code = 0xFF; cmd.instruction_length = QSPI_CMD_INSLEN_1_BYTE; cmd.address_code = 0; cmd.address_length = QSPI_CMD_ADRLEN_0_BYTE; cmd.data_counter = 0; cmd.second_dummy_cycle_num = 0; cmd.operation_mode = QSPI_OPERATE_MODE_444; cmd.read_status_config = QSPI_RSTSC_HW_AUTO; cmd.read_status_enable = FALSE; cmd.write_data_enable = TRUE; qspi_cmd_operation_kick(QSPI1, &cmd); /* wait command completed */ while (qspi_flag_get(QSPI1, QSPI_CMDSTS_FLAG) == RESET); qspi_flag_clear(QSPI1, QSPI_CMDSTS_FLAG); cmd.pe_mode_enable = FALSE; cmd.pe_mode_operate_code = 0; cmd.instruction_code = 0x66; cmd.instruction_length = QSPI_CMD_INSLEN_1_BYTE; cmd.address_code = 0; cmd.address_length = QSPI_CMD_ADRLEN_0_BYTE; cmd.data_counter = 0; cmd.second_dummy_cycle_num = 0; cmd.operation_mode = QSPI_OPERATE_MODE_111; cmd.read_status_config = QSPI_RSTSC_HW_AUTO; cmd.read_status_enable = FALSE; cmd.write_data_enable = TRUE; qspi_cmd_operation_kick(QSPI1, &cmd); /* wait command completed */ while (qspi_flag_get(QSPI1, QSPI_CMDSTS_FLAG) == RESET); qspi_flag_clear(QSPI1, QSPI_CMDSTS_FLAG); cmd.pe_mode_enable = FALSE; cmd.pe_mode_operate_code = 0; cmd.instruction_code = 0x99; cmd.instruction_length = QSPI_CMD_INSLEN_1_BYTE; cmd.address_code = 0; cmd.address_length = QSPI_CMD_ADRLEN_0_BYTE; cmd.data_counter = 0; cmd.second_dummy_cycle_num = 0; cmd.operation_mode = QSPI_OPERATE_MODE_111; cmd.read_status_config = QSPI_RSTSC_HW_AUTO; cmd.read_status_enable = FALSE; cmd.write_data_enable = TRUE; qspi_cmd_operation_kick(QSPI1, &cmd); /* wait command completed */ while (qspi_flag_get(QSPI1, QSPI_CMDSTS_FLAG) == RESET); qspi_flag_clear(QSPI1, QSPI_CMDSTS_FLAG); volatile u32 i = 0xffff; while (i-- > 0); } /** * @brief at32_qspi_init * @param * @retval none */ static int at32_qspi_init(struct rt_qspi_device *device, struct rt_qspi_configuration *qspi_cfg) { /* 省略qspi初始化代码 */ /* 复位w25q128jv */ extern void w25q128jv_reset(); w25q128jv_reset(); return result; } ```
查看更多
3
个回答
默认排序
按发布时间排序
LeonRT
2023-03-27
hello
检查flash的WP引脚
lx1024
2024-03-07
这家伙很懒,什么也没写!
挂载成功代码如下: ```c /** * 使能qspi模式 * @param device : qspi设备 */ static void w25q128jvx_enter_qspi_mode(struct rt_qspi_device* device) { /* 0x38 enter qpi mode */ char instruction = 0x38; char status = w25q128jv_read_status_register2(device); char write_status2_buf[2] = { 0 }; /* 0x31 write status register2 */ write_status2_buf[0] = 0x31; status |= 1 << 1; //w25q128jv写使能 w25q128jv_write_enable(device); //写状态寄存器 write_status2_buf[1] = status; rt_qspi_send(device, &write_status2_buf, 2); //设置qspi模式 rt_qspi_send(device, &instruction, 1); rt_thread_mdelay(10); g_FlashIsEnterQspi = true; } /** * 挂在设备到qspi总线上 * @return 挂载状态 */ static int rt_hw_qspi_flash_with_sfud_init(void) { logi(); /* w25q128jv128挂在qspi总线上 */ rt_err_t ret = at32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25q128jvx_enter_qspi_mode, RT_NULL); if (ret != RT_EOK) { rt_kprintf("qspi attach device failed\n"); return -RT_ERROR; } return RT_EOK; } /** * 注册为快设备 * @return 状态 */ static int rt_hw_qspi_block_device_init(void) { rt_hw_qspi_flash_with_sfud_init(); /* w25q128jvh 注册为块设备*/ if (RT_NULL == rt_sfud_flash_probe(DISK_FLASH_DEV_NAME, "qspi10")) { rt_kprintf("flash sfud failed\n"); return -RT_ERROR; } return RT_EOK; } /*设备自动初始化 */ INIT_DEVICE_EXPORT(rt_hw_qspi_block_device_init); /** * qspi退出qpi模式,并复位 */ void w25q128jv_reset() { /* * Reset Quad I / O(RSTQIO) (FFh) or Release Quad I / O Fast Read Enhancement Mode(FFh) * 0xff This command can’t be used in Standard SPI mode. */ qspi_cmd_type cmd; cmd.pe_mode_enable = FALSE; cmd.pe_mode_operate_code = 0; cmd.instruction_code = 0xFF; cmd.instruction_length = QSPI_CMD_INSLEN_1_BYTE; cmd.address_code = 0; cmd.address_length = QSPI_CMD_ADRLEN_0_BYTE; cmd.data_counter = 0; cmd.second_dummy_cycle_num = 0; cmd.operation_mode = QSPI_OPERATE_MODE_444; cmd.read_status_config = QSPI_RSTSC_HW_AUTO; cmd.read_status_enable = FALSE; cmd.write_data_enable = TRUE; qspi_cmd_operation_kick(QSPI1, &cmd); /* wait command completed */ while (qspi_flag_get(QSPI1, QSPI_CMDSTS_FLAG) == RESET); qspi_flag_clear(QSPI1, QSPI_CMDSTS_FLAG); cmd.pe_mode_enable = FALSE; cmd.pe_mode_operate_code = 0; cmd.instruction_code = 0x66; cmd.instruction_length = QSPI_CMD_INSLEN_1_BYTE; cmd.address_code = 0; cmd.address_length = QSPI_CMD_ADRLEN_0_BYTE; cmd.data_counter = 0; cmd.second_dummy_cycle_num = 0; cmd.operation_mode = QSPI_OPERATE_MODE_111; cmd.read_status_config = QSPI_RSTSC_HW_AUTO; cmd.read_status_enable = FALSE; cmd.write_data_enable = TRUE; qspi_cmd_operation_kick(QSPI1, &cmd); /* wait command completed */ while (qspi_flag_get(QSPI1, QSPI_CMDSTS_FLAG) == RESET); qspi_flag_clear(QSPI1, QSPI_CMDSTS_FLAG); cmd.pe_mode_enable = FALSE; cmd.pe_mode_operate_code = 0; cmd.instruction_code = 0x99; cmd.instruction_length = QSPI_CMD_INSLEN_1_BYTE; cmd.address_code = 0; cmd.address_length = QSPI_CMD_ADRLEN_0_BYTE; cmd.data_counter = 0; cmd.second_dummy_cycle_num = 0; cmd.operation_mode = QSPI_OPERATE_MODE_111; cmd.read_status_config = QSPI_RSTSC_HW_AUTO; cmd.read_status_enable = FALSE; cmd.write_data_enable = TRUE; qspi_cmd_operation_kick(QSPI1, &cmd); /* wait command completed */ while (qspi_flag_get(QSPI1, QSPI_CMDSTS_FLAG) == RESET); qspi_flag_clear(QSPI1, QSPI_CMDSTS_FLAG); volatile u32 i = 0xffff; while (i-- > 0); } /** * @brief at32_qspi_init * @param * @retval none */ static int at32_qspi_init(struct rt_qspi_device *device, struct rt_qspi_configuration *qspi_cfg) { /* 省略qspi初始化代码 */ /* 复位w25q128jv */ extern void w25q128jv_reset(); w25q128jv_reset(); return result; } ```
xiongzh
2024-11-25
这家伙很懒,什么也没写!
解决了吗,我也遇到这个问题了
撰写答案
登录
注册新账号
关注者
0
被浏览
1.2k
关于作者
lx1024
这家伙很懒,什么也没写!
提问
2
回答
4
被采纳
0
关注TA
发私信
相关问题
1
【分享】如何使用 SFUD 库来操作 SPI Flash 设备
2
SFUD怎么使用
3
请教大家一下关于 SFUD 的的问题
4
移植sfud
5
使用SFUD操作FLASH
6
env使用easyflash不是3.2.4版本,而且没有type插件?
7
新增了W25X32设备成功,无法格式化
8
easyflash随着数据存储量增加,耗费时间加长
9
关于SFDP的问题
10
spi nand flash 能使用SFUD驱动吗
推荐文章
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
在用clangd开发RTT吗,快来试试如何简单获得清晰干净的工作区
2
GD32F450 片内 flash驱动适配
3
STM32H7R7运行CherryUSB
4
RT-Smart首次线下培训,锁定2024 RT-Thread开发者大会!
5
使用RC522软件包驱动FM1722
热门标签
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
ESP8266
I2C_IIC
UART
WIZnet_W5500
ota在线升级
freemodbus
PWM
flash
cubemx
packages_软件包
BSP
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
中断
编译报错
Debug
SFUD
rt_mq_消息队列_msg_queue
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
a1012112796
10
个答案
1
次被采纳
踩姑娘的小蘑菇
4
个答案
1
次被采纳
红枫
4
个答案
1
次被采纳
张世争
4
个答案
1
次被采纳
Ryan_CW
4
个答案
1
次被采纳
本月文章贡献
catcatbing
3
篇文章
6
次点赞
YZRD
2
篇文章
5
次点赞
qq1078249029
2
篇文章
2
次点赞
xnosky
2
篇文章
1
次点赞
Woshizhapuren
1
篇文章
5
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部