嵌入式技术论坛
直播中

ss

6年用户 8762经验值
擅长:电源/新能源 制造/封装 RF/无线
私信 关注
[问答]

使用fal软件包向片内flash写入数据失败怎么解决呢

使用fal软件包向片内flash写入数据时显示写入错误!

(fal_partition_write:437) Partition write error! Flash device(onchip_flash) write error!

对比例程发现写入前需要擦除分区的全部数据,才能写入成功(软件擦除或下载时j-link擦除全部分区),否则就会出现写入错误问题,但这种做法在实际项目中不可行,请问大家有什么解决方法?还是有哪些初始化宏没有设置?

[SFUD] Find a Winbond flash chip. Size is 16777216 bytes.
[SFUD] NOR_FLASH flash device is initialize success.
[D/FAL] (fal_flash_init:61) Flash device |             onchip_flash | addr: 0x08000000 | len: 0x00080000 | blk_size: 0x00000800 |initialized finish.
[D/FAL] (fal_flash_init:61) Flash device |                nor_flash | addr: 0x00000000 | len: 0x01000000 | blk_size: 0x00001000 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name       | flash_dev    |   offset   |    length  |
[I/FAL] -------------------------------------------------------------
[I/FAL] | app        | onchip_flash | 0x00000000 | 0x00060000 |
[I/FAL] | param      | onchip_flash | 0x00060000 | 0x00020000 |
[I/FAL] | easyflash  | nor_flash    | 0x00000000 | 0x00080000 |
[I/FAL] | download   | nor_flash    | 0x00080000 | 0x00100000 |
[I/FAL] | wifi_image | nor_flash    | 0x00180000 | 0x00080000 |
[I/FAL] | font       | nor_flash    | 0x00200000 | 0x00700000 |
[I/FAL] | filesystem | nor_flash    | 0x00900000 | 0x00700000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer (V0.5.0) initialize success.
I/main: Flash device : onchip_flash   Flash size : 512K   Partition : param   Partition size: 128K
[E/FAL] (fal_partition_write:437) Partition write error! Flash device(onchip_flash) write error!

回帖(3)

ss

2022-3-24 09:51:53
所有的Flash都是先擦后写的,而且擦除的时候是要把整页或整个扇区擦除掉。
所以,一般是擦除之前把页或扇区内的内容拷贝出来,然后进行修改,擦除后,把修改后的内容再写回去。
举报

ss

2022-3-24 09:52:02
Flash的分区正确吗?分区边界需要以Flash扇区为单位的。还有MCU的不同型号中有的Flash的扇区大小也不一致,前面的小,后面的大,需要仔细分区。
举报

ss

2022-3-24 09:52:48
flash都是操作方式都是需要先擦除再写,而擦除区域要按片擦除,就会擦除大片的区域,如果仅仅时为了写少量数据,需要先把数据先读回来,将要写的数据合并写入flash的扇区。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分