cancel
Showing results for 
Search instead for 
Did you mean: 

Write operation using FileX and LevelX on NOR flash is getting very slow at random

gmandal
Associate

Hi,

I am using W25Q64JV NOR flash of size 8MB on ST STM32U5A9ZJ board. On the flash I have created a file system using LevelX and FileX. I have enabled fault tolerant option in FileX. I am writing 128bytes of data every 500ms to a file. Initially the write operation is taking around 70-80 ms, however after some time (after around 3000 writes) the write operation occasionally is taking around 3-4 seconds. This is after every few writes. Following is the fx_media_format parameters I have used                                

status = fx_media_format( &flashMedia,
                          fx_stm32_levelx_nor_driver,
                          reinterpret_cast<VOID *>(LX_NOR_OSPI_DRIVER_ID),
                          reinterpret_cast<UCHAR *>(mediaMemory), sizeof(mediaMemory),
                          "FLASH_DISK", 
                          1,                             // Number of FATs
                          32,                            // Directory Entries
                          0,                             // Hidden sectors
                          (0x800000 - 0x10000)/ 0x10000, // Total sectors minus one
                          512,                           // Sector size
                          8,                             // Sectors per cluster
                          1,                             // Heads 1 
);

 

Could anyone please  let me know what I might to improve the performance? My goal is to complete the write operation of 128 bytes under 100ms in any circumstances. Thanks in advance.

Goutam


Edited to apply source code formatting - please see How to insert source code for future reference.

2 REPLIES 2
LCE
Principal II

(after around 3000 writes)

Do you or LevelX / FileX take care of wear leveling?

If you're doing your tests a few times you easily reach > 100k writes, and most flash memories getting problems from then on.

So check the flash's datasheet!

Ozone
Principal II

Probably the code erases flash sectors as needed, once a write access crosses over into the next sector.
This sector erase can take dozens or hundreds of milliseconds, and is temperature and wear-dependant.