failure fx_media_open when I use fileX throught levelX

Alexandre Bruliau 30 Reputation points
2023-05-16T16:27:27.4+00:00

Hello,

I am using a MT29F1G01ABAFDSF NAND flash memory with those features:

1024 sectors

64 pages per sectors

2048 bytes per page + 128 bytes spare bytes

I was planning to first use fileX without levelX since I thought levelX was only used for wear levelling.

In consequence, I was directly calling my low level drivers functions in the Entry Callback Function passed as argument to fx_media_format. I was thus able to create a file, read and write . But I noticed that the root sector during the format process was explicitely filled with zero (sector 65 for me). In consequence, its was not possible to use fileX as standalone to a NAND memory without other libraries (do you confirm this behavior is expected?).

I thus decided to use levelX. I first called lx_nand_flashformat in order to erase all sectors and to filled them the 4 bytes provided for the Sector Mapping that return LX_SUCCESS.

In the FX_DRIVER_INIT entry callback function, I called the API lxnandflashopen that return also LXSUCESS.

But when I tried to called fxmediaopen, he doesn't even called my low level drivers functions to read the boot sector because apparently it doesn't find it.

Any Idea how to debug this ?

Azure SQL Database
Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,156 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,508 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,477 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,380 questions
0 comments No comments
{count} votes

Accepted answer
  1. VasimTamboli 4,410 Reputation points
    2023-05-16T17:37:27.6+00:00

    To debug the failure you are experiencing with fx_media_open when using fileX with levelX, you can follow these steps:

    Check the configuration: Verify that the configuration parameters passed to the fx_media_open function are correct. Ensure that the media type, number of sectors, pages per sector, and bytes per page are set accurately according to your NAND flash memory specifications.

    Verify the boot sector: Make sure that the boot sector is properly initialized and located at the expected location on the NAND flash memory. Check if the boot sector data is being read correctly and if it matches the expected format.

    Check the initialization sequence: Review the initialization sequence of your low-level drivers and levelX. Ensure that the drivers are correctly initialized before calling fx_media_open. Check if any necessary initialization steps or callbacks are missing.

    Verify the return codes: Check the return codes of the functions you are calling, such as lx_nand_flashformat and lxnandflashopen. Make sure they return the expected success codes. If they return an error code, investigate the error message to determine the cause of the failure.

    Enable debug logging: Enable debug logging in the fileX and levelX libraries. This can provide valuable information about the internal operations and help identify where the issue occurs. Check the log output to see if there are any error messages or unexpected behavior.

    Validate sector mapping: Ensure that the sector mapping is correctly set up and matches the actual layout of the NAND flash memory. If the sector mapping is not properly configured, it can lead to issues in locating and accessing the boot sector.

    Review the implementation of your low-level drivers: Double-check the implementation of your low-level drivers to ensure they are correctly reading and writing data from/to the NAND flash memory. Verify that the read and write operations are aligned with the specifications of the NAND flash memory you are using.

    Consult the documentation and community resources: Refer to the documentation of fileX, levelX, and your specific NAND flash memory to see if there are any specific considerations or troubleshooting steps you should follow. Additionally, consider reaching out to the fileX and levelX communities or support channels for assistance from experts familiar with these libraries.

    By following these steps and carefully reviewing your implementation and configurations, you should be able to identify and debug the issue with fx_media_open and proceed with the successful initialization and usage of fileX and levelX with your NAND flash memory.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Alexandre Bruliau 30 Reputation points
    2023-05-17T15:34:39.3566667+00:00

    Thanks,

    Apparently it was because I used the format provided levelX at wrong place.

    However, I encountered a new issue:

    When I tried to write a file, read it back the first time (after the format) works fine. But if I reset my MCU and want to open it again, I encountered FX_FILE_CORRUPT.

    Apparently it comes from the second test where "contents is 0" from the API fx_file_open with cluster_count = 1u.

    How can I debug it?

    Best regards, User's image

    0 comments No comments