Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
FAL
The erase operation did not really succeed 的问题
发布于 2020-04-18 15:46:07 浏览:1255
订阅该版
* 本帖最后由 viyjk99 于 2020-4-18 15:47 编辑 * 在stm32f205上移植了SFUD和FAL,在main中调用: ```int main(void) { spi_sfud_init(); fal_init(); ......... }```初始化信息: ```[SFUD] Warning: The OS tick(100) is less than 1000. So the flash write will take more time. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud.c:861) The flash device manufacturer ID is 0xC2, memory type ID is 0x20, capacity ID is 0x16. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:131) Check SFDP header is OK. The reversion is V1.0, NPN is 1. [SFUD] (..\..\..\..\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. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:203) JEDEC basic flash parameter table info: [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:204) MSB-LSB 3 2 1 0 [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0001] 0xFF 0xF1 0x20 0xE5 [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0002] 0x01 0xFF 0xFF 0xFF [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0003] 0x6B 0x08 0xEB 0x44 [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0004] 0xBB 0x04 0x3B 0x08 [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0005] 0xFF 0xFF 0xFF 0xEE [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0006] 0xFF 0x00 0xFF 0xFF [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0007] 0xFF 0x00 0xFF 0xFF [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0008] 0x52 0x0F 0x20 0x0C [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0009] 0xFF 0x00 0xD8 0x10 [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:215) 4 KB Erase is supported throughout the device. Command is 0x20. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:234) Write granularity is 64 bytes or larger. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:245) Target flash status register is non-volatile. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:271) 3-Byte only addressing. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:305) Capacity is 4194304 Bytes. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:311) Flash device supports 4KB block erase. Command is 0x20. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:311) Flash device supports 32KB block erase. Command is 0x52. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:311) Flash device supports 64KB block erase. Command is 0xD8. [SFUD] Find a Micronix flash chip. Size is 4194304 bytes. [SFUD] (..\..\..\..\components\drivers\spi\sfud\src\sfud.c:840) Flash device reset success. [SFUD] MX25L3206E flash device is initialize success. [SFUD] Probe SPI flash MX25L3206E by SPI device spi10 success. [D/FAL] (fal_flash_init:61) Flash device | onchip_flash | addr: 0x08000000 | len: 0x00040000 | blk_size: 0x00020000 |initialized finish. [D/FAL] (fal_flash_init:61) Flash device | MX25L3206E | addr: 0x00000000 | len: 0x00400000 | blk_size: 0x00001000 |initialized finish. [32;22m[I/FAL] ==================== FAL partition table ==================== [0m [32;22m[I/FAL] | name | flash_dev | offset | length | [0m [32;22m[I/FAL] ------------------------------------------------------------- [0m [32;22m[I/FAL] | bootloader | onchip_flash | 0x00000000 | 0x00004000 | [0m [32;22m[I/FAL] | app | onchip_flash | 0x00004000 | 0x0003c000 | [0m [32;22m[I/FAL] | boot_up | MX25L3206E | 0x00000000 | 0x00010000 | [0m [32;22m[I/FAL] | par1 | MX25L3206E | 0x00010000 | 0x00000400 | [0m [32;22m[I/FAL] | par2| MX25L3206E | 0x00010400 | 0x00080000 | [0m [32;22m[I/FAL] | par3| MX25L3206E | 0x00090400 | 0x00080000 | [0m [32;22m[I/FAL] ============================================================= [0m [32;22m[I/FAL] RT-Thread Flash Abstraction Layer (V0.5.99) initialize success.[0m```调用fal_test函数会出现错误。 ```int fal_test(const char *partiton_name) { int ret; int i, j, len; uint8_t buf[FAL_TEST_BUF_SIZE] = {0}; const struct fal_flash_dev *flash_dev = RT_NULL; const struct fal_partition *partition = RT_NULL; if (!partiton_name) { rt_kprintf("Input param partition name is null!
"); return -1; } partition = fal_partition_find(partiton_name); if (partition == RT_NULL) { rt_kprintf("Find partition (%s) failed!
", partiton_name); ret = -1; return ret; } flash_dev = fal_flash_device_find(partition->flash_name); if (flash_dev == RT_NULL) { rt_kprintf("Find flash device (%s) failed!
", partition->flash_name); ret = -1; return ret; } rt_kprintf("Flash device : %s " "Flash size : %dK " "Partition : %s " "Partition size: %dK
", partition->flash_name, flash_dev->len/1024, partition->name, partition->len/1024); /* 擦除 `partition` 分区上的全部数据 */ ret = fal_partition_erase_all(partition); if (ret < 0) { rt_kprintf("Partition (%s) erase failed!
", partition->name); ret = -1; return ret; } rt_kprintf("Erase (%s) partition finish!
", partiton_name); /* 循环读取整个分区的数据,并对内容进行检验 */ for (i = 0; i < partition->len;) { rt_memset(buf, 0x00, FAL_TEST_BUF_SIZE); len = (partition->len - i) > FAL_TEST_BUF_SIZE ? FAL_TEST_BUF_SIZE : (partition->len - i); /* 从 Flash 读取 len 长度的数据到 buf 缓冲区 */ ret = fal_partition_read(partition, i, buf, len); if (ret < 0) { rt_kprintf("Partition (%s) read failed!
", partition->name); ret = -1; return ret; } for(j = 0; j < len; j++) {
/* 校验数据内容是否为 0xFF */ if (buf[j] != 0xFF) { rt_kprintf("The erase operation did not really succeed!
"); ret = -1; return ret; }
} i += len; } /* 把 0 写入指定分区 */ for (i = 0; i < partition->len;) { /* 设置写入的数据 0x00 */ rt_memset(buf, 0x00, FAL_TEST_BUF_SIZE); len = (partition->len - i) > FAL_TEST_BUF_SIZE ? FAL_TEST_BUF_SIZE : (partition->len - i); /* 写入数据 */ ret = fal_partition_write(partition, i, buf, len); if (ret < 0) { rt_kprintf("Partition (%s) write failed!
", partition->name); ret = -1; return ret; } i += len; } rt_kprintf("Write (%s) partition finish! Write size %d(%dK).
", partiton_name, i, i / 1024); /* 从指定的分区读取数据并校验数据 */ for (i = 0; i < partition->len;) { /* 清空读缓冲区,以 0xFF 填充 */ rt_memset(buf, 0xFF, FAL_TEST_BUF_SIZE); len = (partition->len - i) > FAL_TEST_BUF_SIZE ? FAL_TEST_BUF_SIZE : (partition->len - i); /* 读取数据到 buf 缓冲区 */ ret = fal_partition_read(partition, i, buf, len); if (ret < 0) { rt_kprintf("Partition (%s) read failed!
", partition->name); ret = -1; return ret; } for(j = 0; j < len; j++) { /* 校验读取的数据是否为步骤 3 中写入的数据 0x00 */ if (buf[j] != 0x00) { rt_kprintf("The write operation did not really succeed!
"); ret = -1; return ret; } } i += len; } ret = 0; return ret; }``` 错误提示: Flash device : MX25L3206E Flash size : 4096K Partition : boot_up Partition size: 64K Erase (boot_up) partition finish! The erase operation did not really succeed! Fal partition (boot_up) test failed! 格式化分区失败,这会是什么原因造成的???
查看更多
4
个回答
默认排序
按发布时间排序
armink
2020-04-18
这家伙很懒,什么也没写!
会不会是 flash 加保护了,可以单独擦写下其他地址试试
viyjk99
2020-04-18
这家伙很懒,什么也没写!
擦除其他地址也是FAIL......
viyjk99
2020-04-18
这家伙很懒,什么也没写!
有没有解锁的接口?
viyjk99
2020-04-18
这家伙很懒,什么也没写!
是被写保护,单独封装一个接口就好了。 int sfud_unprotect() { return sfud_write_status(sfud_norflash0, false, 0x00); }
撰写答案
登录
注册新账号
关注者
0
被浏览
1.3k
关于作者
viyjk99
这家伙很懒,什么也没写!
提问
12
回答
20
被采纳
0
关注TA
发私信
相关问题
1
关于FAL移植
2
添加fal软件包之后编译出现错误,求助!
3
关于easyflash4.0的写入和读取norflash一些疑惑咨询
4
FAL驱动移植&构建脚本问题
5
帮我看一下这样分区会不会冲突??
6
EasyFlash 4.0疑似出BUG
7
疑似FAL日志输出与DFS冲突??
8
fal软件包偏移量大于等于当前分区的大小会报错
9
为什么片内Flash总是写失败?
10
片上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-thred的stm32h723对应bsp包CubeMX添加其他外设报错
2
RT-Thread中的time溢出问题,时间戳溢出,解决方法
3
ART-PI使用env驱动ETH网卡,pc和板子可以ping通
4
SystemView线程名字不显示
5
只用网页也能跑RT-Smart 无门槛腾讯Cloud studio + smart-build快速构建
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
rt-smart
FAL
I2C_IIC
UART
ESP8266
cubemx
WIZnet_W5500
ota在线升级
PWM
BSP
flash
freemodbus
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
keil_MDK
ulog
SFUD
msh
C++_cpp
MicroPython
本月问答贡献
RTT_逍遥
9
个答案
2
次被采纳
三世执戟
8
个答案
1
次被采纳
KunYi
8
个答案
1
次被采纳
winfeng
2
个答案
1
次被采纳
YZRD
2
个答案
1
次被采纳
本月文章贡献
catcatbing
2
篇文章
5
次点赞
swet123
1
篇文章
4
次点赞
Days
1
篇文章
4
次点赞
YZRD
1
篇文章
2
次点赞
阳光的掌控者
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部