eclipse-threadx / levelx

Eclipse ThreadX - LevelX Provides Flash Wear Leveling for FileX and Stand Alone purposes.
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/levelx/index.md
MIT License
102 stars 61 forks source link

LevelX Nand "defrag" problem #46

Open ZoppiCustom opened 6 months ago

ZoppiCustom commented 6 months ago

Hi,

I am using LevelX (6.4.1) with NAND flash. In my test, I created a 64MB disk and repeatedly cycled through writing, reading, and deleting ten 200KB files. After several cycles, I can no longer write files because the free block list tail is 0, causing the lx_nand_flash_block_allocate function to error out.

What I don't understand is why the tail goes to 0. When I check the block status table, I find that some blocks are full (0xC040), but many blocks have only partial writes (0xA002). In this case, is it not possible to perform a defrag to optimize the utilization of the blocks? I tried reading the forum and I understand that with the new lx_nand_flash_sector_release I don't need to defrag the disk, but something is wrong. Can you help me?

Thanks a lot error_func nand_flash_var status_table