-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write Performance on NOR Flash is getting very low when using the Fault Tolerant Mode #8
Comments
Hi @PiPointX, Just to rule out that there are no issues in the norDriver. Could you confirm it has the sector release logic (refer: case FX_DRIVER_RELEASE_SECTORS:) In your situation you might want to use a sector size that matches your usage better. For example, if most of your files were 1KB, then perhaps a 1KB sector size might be good. The main idea here is that assuming there is one sector per cluster, it might be good performance wise to try to satisfy a majority of the files with a single allocation (one FAT entry - no chain). As the flash becomes more utilized, performance will indeed decrease from the initial state. There are a couple of things that you can try to help improve this:
|
Hi @bhnaphade Thanks for you reply. To your suggestions:
This is already done when I call fx_media_format with the parameter for the total sector amount (0x2000000 / 0x200) - 1, // Total sectors. In this case the -1 is one logical block.
I have the use case, that a write must be done every second of about 1kByte to a file on the NOR-Flash for 8 - 10 hours. Also during this time other access to other files can be done. So a defragmentation can only be done after this time period. But not during these 8 - 10 hours.
I set LX_NOR_SECTOR_MAPPING_CACHE_SIZE to 1024. But it had no effect. The write speed is still the same. And still gets very low (8.5kByte/sec) when every sector has some content. |
Hi @PiPointX , What is the block size of NOR flash? |
Hi @bhnaphade |
hello. regards |
Hey @trox17-debug |
are there any new insights on your side how we can increase the write performance at least a bit? Or is there an example with an exisiting flash-chip where we can countercheck whether our configuration is correct or not. By now, all suggestion had no effect. Thanks for your response. |
I'm using the NOR-Flash W25Q256 in combination with a STM32H7B3 controller.
After enabling the FaultTolerantMode and writing big data to to the flash, the write performance gets very low.
The W25Q256 has the following coarse specs:
On my controller I'm using threadX, fileX and levelX with the version 6.2.0. Also LX_DIRECT_READ is enabled. and the TX_TIMER_TICKS_PER_SECOND are set to 1000.
To compare different settings I did a write of 8MByte of data to the flash. The write is done by chunks of 512Byte.
So, what have I done:
First Step
Measuring write Speed without FaultTolerantMode enabled.
Therefor the settings of the fx_media_format was the following:
With this setting the write speed is about 200kByte/sec.
But after 8192 writes of 512Byte fileX returns, that the filesystem is full.
After some investigaton I found out, that levelX expects a logical sector sizes of 512Bytes (LX_NOR_SECTOR_SIZE). This means, that the parameters of fx_media_format seems to be wrong.
Second Step
Measuring write Speed without FaultTolerantMode enabled and fixed parameters of fx_media_format.
The parameters of fx_media_format changed now to:
With this setting the write speed is about 26.5kByte/sec, which is, compared with the write speed before, very low.
Third Step
Measuring write Speed with FaultTolerantMode enabled and fixed parameters of fx_media_format.
Compared to the second step, I only enabled the fault tolerant mode in the fx_user.h and called the function fx_fault_tolerant_enable(...).
At the beginning of the 8MByte write process the write speed is 23kByte/sec.
Compared to the 26.5kByte/sec from the second step it's okay but still very low.
But after some time the NOR-Flash seems to be full and levelX starts to delete obsolete sectors. When the deletion of sectors begin, the write speeds break downs to 8.5kByte/sec.
I investigated some time to check what the problem could be.
I found out the following:
I also played a bit with the possible defines in the fx_user.h and lx_user.h (e.g. LX_NOR_SECTOR_MAPPING_CACHE_SIZE) but nothing had impact on the write speed.
Questions
The text was updated successfully, but these errors were encountered: