Question about LevelX NAND defrag

Matteo Zoppi 0 Reputation points
2024-05-29T10:01:50.5666667+00:00

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?

Thnaks a lot

status_table

nand_flash_var

error_func

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
333 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anushka 320 Reputation points
    2024-05-29T10:10:33.5766667+00:00

    It sounds like you're encountering issues with block allocation and utilization in LevelX with NAND flash. It's indeed odd that the free block list tail is reaching 0 despite having blocks with partial writes. Defragmentation should ideally help optimize block utilization, but it seems like there might be a problem with how it's implemented or triggered. Have you checked if there are any known bugs or limitations in the version of LevelX you're using? Additionally, reviewing the implementation of lx_nand_flash_sector_release might provide insights into why defragmentation isn't working as expected. If you're still stuck, reaching out to the LevelX community or support team could provide further assistance.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.