-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
W25Q64BV Write Enable Failed #34
Comments
您好这个我测试了,没有问题。可能代码移植有问题,建议用逻辑分析仪查一下波形 |
很可能是CS脚没有配置对! |
不需要在 CubeMX 中配置片选引脚,片选引脚会在后面使用 |
我也遇到同样的问题,我的是W25Q16DV #include "drv_spi.h"
#include <rtdevice.h>
#include "spi_flash_sfud.h"
#define SPI_NAME "spi1" //spi 接口名
#define CS_GPIO GPIOB //片选GPIO组 stn32
#define CS_PIN GPIO_PIN_14 //片选GPIO脚 stm32
#define SPI_DEV_NAME "spi10" //挂在在spi总线上的设备名
#define FLASE_NAME "W25Q16" //flash设备名
#define FS_NAME "elm" //文件系统
#define ROOT_PATH "/flash1" //文件系统的根目录
int w25q_init(void){
rt_hw_spi_device_attach(SPI_NAME, SPI_DEV_NAME, CS_GPIO, CS_PIN);
rt_hw_us_delay(100);
if(rt_sfud_flash_probe(FLASE_NAME, SPI_DEV_NAME)){
rt_kprintf("sfud flash probe success\n");
return RT_EOK;
}
else{
rt_kprintf("sfud flash probe fail\n");
return RT_ERROR;
}
}
INIT_COMPONENT_EXPORT(w25q_init);
int dfs_mount_init(void){
dfs_mkfs(FS_NAME, FLASE_NAME);
if(dfs_mount(FLASE_NAME, ROOT_PATH, FS_NAME, 0, 0) == 0){
rt_kprintf("dfs_mount success\n");
return RT_EOK;
}
else{
rt_kprintf("dfs_mount fail\n");
return RT_ERROR;
}
}
INIT_COMPONENT_EXPORT(dfs_mount_init); \ | /
- RT - Thread Operating System
/ | \ 4.1.0 build Sep 22 2022 10:51:26
2006 - 2022 Copyright by RT-Thread team
[I/SFUD] Warning: Read SFDP parameter header information failed. The W25Q16 is not support JEDEC SFDP.
[I/SFUD] Find a Winbond W25Q16BV flash chip. Size is 2097152 bytes.
[I/SFUD] W25Q16 flash device is initialize success.
[I/SFUD] Probe SPI flash W25Q16 by SPI device spi10 success.
sfud flash probe success
[I/SFUD] Error: Can't enable write status.
format error, result=1
dfs_mount fail BV 和 DV 差不多所以没改,也是0x40 0x15, CS确定没问题,因为用示例程序读ID成功了 msh />mkfs -t elm W25Q16
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't enable write status.
format error, result=1
mkfs failed, result=-5 |
这个可能与spi的驱动有关系,我也遇到过类似的,但后来发现是多个SPI读写切换引起,切换后需要重新重新初始化SPI发自我的手机-------- 原始邮件 --------发件人: ThinkCode ***@***.***>日期: 2022年9月22日周四 11:15收件人: armink/SFUD ***@***.***>抄送: Subscribed ***@***.***>主 题: Re: [armink/SFUD] W25Q64BV Write Enable Failed (#34)
我也遇到同样的问题,我的是W25Q16DV
#include "drv_spi.h"
#include <rtdevice.h>
#include "spi_flash_sfud.h"
#define SPI_NAME "spi1" //spi 接口名
#define CS_GPIO GPIOB //片选GPIO组 stn32
#define CS_PIN GPIO_PIN_14 //片选GPIO脚 stm32
#define SPI_DEV_NAME "spi10" //挂在在spi总线上的设备名
#define FLASE_NAME "W25Q16" //flash设备名
#define FS_NAME "elm" //文件系统
#define ROOT_PATH "/flash1" //文件系统的根目录
int w25q_init(void){
rt_hw_spi_device_attach(SPI_NAME, SPI_DEV_NAME, CS_GPIO, CS_PIN);
rt_hw_us_delay(100);
if(rt_sfud_flash_probe(FLASE_NAME, SPI_DEV_NAME)){
rt_kprintf("sfud flash probe success\n");
return RT_EOK;
}
else{
rt_kprintf("sfud flash probe fail\n");
return RT_ERROR;
}
}
INIT_COMPONENT_EXPORT(w25q_init);
int dfs_mount_init(void){
dfs_mkfs(FS_NAME, FLASE_NAME);
if(dfs_mount(FLASE_NAME, ROOT_PATH, FS_NAME, 0, 0) == 0){
rt_kprintf("dfs_mount success\n");
return RT_EOK;
}
else{
rt_kprintf("dfs_mount fail\n");
return RT_ERROR;
}
}
INIT_COMPONENT_EXPORT(dfs_mount_init);
\ | /
- RT - Thread Operating System
/ | \ 4.1.0 build Sep 22 2022 10:51:26
2006 - 2022 Copyright by RT-Thread team
[I/SFUD] Warning: Read SFDP parameter header information failed. The W25Q16 is not support JEDEC SFDP.
[I/SFUD] Find a Winbond W25Q16BV flash chip. Size is 2097152 bytes.
[I/SFUD] W25Q16 flash device is initialize success.
[I/SFUD] Probe SPI flash W25Q16 by SPI device spi10 success.
sfud flash probe success
[I/SFUD] Error: Can't enable write status.
format error, result=1
dfs_mount fail
BV 和 DV 差不多所以没改,也是0x40 0x15, CS确定没问题,因为用示例程序读ID成功了
在终端也试了格式化和挂载也失败了
msh />mkfs -t elm W25Q16
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't enable write status.
format error, result=1
mkfs failed, result=-5
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
那我要把flash挂载文件系统,这个怎么重新初始化。我测试过确实有的时候好,有的时候不能用。用sf工具读没有问题,但写和擦除时好时坏。 |
我测试过,好像写状态试能的问题 msh />sf bench yes
Erasing the sf_cmd 2097152 bytes data, waiting...
[I/SFUD] Error: Can't disable write status.
Erase benchmark success, total time: 0.032S.
Writing the sf_cmd 2097152 bytes data, waiting...
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't disable write status.
[I/SFUD] Error: Can't enable write status.
[I/SFUD] Error: Can't disable write status.
Writing sf_cmd failed, already wr for 3072 bytes, write 256 each time
Write benchmark has an error. Error code: 2.
Reading the sf_cmd 2097152 bytes data, waiting...
Data check ERROR! Please check you flash by other command.
Read sf_cmd failed, already rd for 0 bytes, read 256 each time
Read benchmark has an error. Error code: 3.
This flash operate has an error. Error code: 3. 打不开关不上,然后挂载文件系统是报的是格式不正确,应该 W25Q16DVSIG 是支持的吧 |
我又尝试了战舰V3上的W25Q128JV 没有出现这个问题,使用正常,能成功挂载为文件系统。 |
我给我F407的板子也换上了W25Q128JV,依然有问题 |
/**
// if (result == SFUD_SUCCESS) { 如果实在找不到办法,可以在sfud.c中屏蔽掉读写状态位判断就能正常读写了 |
借用https://blog.csdn.net/p1279030826/article/details/107334427,这个作者的方法做如下两点修改: 最终串口打印结果为: [11:29:41.307]收←◆繱FUD](......\sfud\src\sfud.c:116) Start initialize Serial Flash Universal Driver(SFUD) V1.1.0. [11:29:41.574]收←◆Erase the W25Q16BV flash data finish. Start from 0x00000000, size is 1024. The W25Q16BV flash test is success. |
使用其他的F407测试, 没有出现这个问题, 果然便宜没好货, 这个单片机可能是翻新的或是拆机的, 现在已经坏了写不进去程序了. |
你好,你的工具设计很不错,我尝试了下,修改def为winbod W25Q64BV,运行后发现在
“sfud_erase”中执行write enable报错,但我用其它驱动读写都没问题,说明板子是可以write enable的,看你的代码中有lock spi 然后unlock spi这个动作,不太明白为什么需要,也不清楚为什么Status Register的WEL位没有置1,请问可以帮我看看么,谢谢!
*SFUD](......\sfud\src\sfud.c:861) The flash device manufacturer ID is 0xEF, memory type ID is
0x40, capacity ID is 0x17.
SFUD Error: Check SFDP signature error. It's must be 50444653h('S' 'F' 'D' 'P').
[SFUD]Warning: Read SFDP parameter header information failed. The W25Q64BV is not support JEDEC SFDP.
[SFUD]Find a Winbond W25Q64BV flash chip. Size is 8388608 bytes.
SFUD Flash device reset success.
[SFUD]W25Q64BV flash device is initialize success.
[SFUD]Error: Can't enable write status.
Erase the W25Q64BV flash data failed.
The text was updated successfully, but these errors were encountered: