eclipse-threadx/filex

Qestion about application of fileX with fx_fault_tolerant_enable

Closed this issue · 12 comments

Hi. I'm trying to use FileX with fx_fault_tolerant_enable . After fx_media_open success I called fx_fault_tolerant_enable,From Return code fx_fault_tolerant_enable is successful, and data can be saved successfully. However, There is garbled data in the saved data,as shown below, every garbled data stating with "RLTF$", what is the problem?

save data as follow:
#start
00:02:59 -> This is test save data I do not konw How it work as i thought.but never mind I can solve it.
00:02:59 -> This is test save data I do not konw How it work as i thought.but never mind I can solve it.
00:02:59 -> This is test save data I do not RLTF$ 4m�  � P @ P€ AS _ L o g � j_ N e w . l o g S_L~0003LOG 揜餜餜 SV餜� 繟� rk as i thought.but never mind I can solve it.
00:02:59 -> This is test save data I do not konw How it work as i thought.but never mind I can solve it.
00:02:59 -> This is test save data I do not konw How it work as i thought.but never mind I can solve it.
00:02:59 -> This is test save data I do not konw How it work as i thought.but never mind I can solve it.
#end

Gavin

Hi Gavin, did you use fx_media_format for the first time using fault tolerant? If not, please try it. Or else, could you paste the parameters used in this API?

Thanks for your reply.
I ahve used fx_media_fomat for the first time using fault tolerant. I used fx_media_fomat functions as shown below:
res = fx_media_format(&sdio_disk, _fx_sd_driver, 0, media_sd_memory, sizeof(media_sd_memory), "SD_CARD", 2, 32, 0, SDCardInfo.LogBlockNbr, SDCardInfo.LogBlockSize, 16, 255, 63);

What are the values of SDCardInfo.LogBlockNbr and SDCardInfo.LogBlockSize?

SDCardInfo.LogBlockNbr and SDCardInfo.LogBlockSize is invoked from the STM32 HAL library, the values is depend on SD card, I catched Its value:
The value of the LogBlockNbr is 31116288, LogBlockSize is 512.

Could you double check whether the buffers used by fx_media_open and fx_fault_tolerant_enable are different? I run a test based on the sample we released for STM32F746G, it works.

Thanks.
I have checked the buffers fx_media_open and fx_fault_tolerant_enable are the same one, and buffer size I defined is 512 * 20

Could you try to use different buffers and see if the problem is solved?

I have try different buffers, it works.
Why use different buffers?

Good to know! They are used by different purpose. Buffer of fx_media_open is used as cache of sectors. Buffer of fx_fault_tolerant_enable is used as the cache of log file.

OK, I understand. Thank you very much for your help.
Moreover, I want to know how, compare with do not use fx_ fault_ tolerant , what is the difference between the speed of reading and writing data.

With fault tolerant, each transaction will be flushed to media immediately. Without it, data can be cached till flush or media close API is called, or sector cache is full. So, to achieve the integrity of file system, the performance is sacrificed. It depends on the use case of your application on how much performance is affected.

嗯呐,多谢您的指导!