Showing results for 
Search instead for 
Did you mean: 

Compatibility issues mounting LittleFS File system written with mbed in STM32CubeIDE. STM32L4


I am developing a bootloader which communicates with an external flash memory (AT45DB041E) in order to check if a file is written inside the flash. This file that my bootloader is searching for is written from another program which is on the eclipse and uses mbed for LittleFileSystem functions and the BlockDevice. When this program finishes its work my bootloader starts and fails to mount the flash memory and every time I am getting this error message:

Corrupted dir pair at {0x0, 0x1}

However, I have checked my functions in littlefs that I use for reading and writing data to a specific file with a dummy code which was making the below steps:

1) Mounting the flash (Success)
2) Opening a file for reading writing (Success)
3) Writing 160KB of data (as the file size that mbed uses) (Success)
4) Closing the file (Success)
5) Opening the file again only with reading (Success)
6) Start reading the data from the file (Success)
7) Close the file (Success)
8) Unmount the file system (Success).

But when I test my code with the code from eclipse that uses mbed for LittleFileSystem it returns corrupted data when mount and eventually makes a format which destroys the file system and after that I am able to mount successfully, which is not the case I want, since I need to open the file that eclipse (using mbed is writing inside the flash memory).

I have checked the configuration parameters that the LittleFileSystem uses in the read/prog/block_count/block_size/lookahead_size and are the same with mine in the STM32CubeIDE but nothing works.

So my question is that: Could be an compatibility issue between the eclipse embed LittleFileSystem and the STM32CubeIDE littleFS that I am using and they cannot work together or not?

Based on the datasheet I use continuous array read implementation for binary page size and it works successfully with some tests that I have made and for programming I am storing the data that I need to send to the external flash memory to a specific buffer that the external flash has (1/2) and after that I use the functionality buffer to main memory program in order to flash the buffer contents inside the main memory, which works properly as well. I don't know what else to do and this question came to my mind but I didn't find something relevant online and I wanted to ensure that I can make them work together before making any changes to my code.

Thank you in advance!