This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC3235SF:关于 CC3235SF 文件写入操作的查询

Guru**** 1952840 points
Other Parts Discussed in Thread: CC3235SF
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1453144/cc3235sf-inquiry-regarding-cc3235sf-file-write-operation

器件型号:CC3235SF

工具与软件:

尊敬的 TI 支持团队:

我希望这封邮件能让您满意。 我遇到有关 CC3235SF 文件写入操作的问题。 具体而言、我想知道文件可以重写的最大次数。

对于上下文、我指的是以下代码:

/** 
 * \return         File handle on success. Negative error code on failure
 * 
 * \sa             sl_FsRead, sl_FsWrite, sl_FsClose
 * \note           Belongs to \ref basic_api
 * \warning        None
 * 
 * \par Example
 * 
 * - Creating a file and writing data to it
 */
char*           DeviceFileName = "MyFile.txt";
unsigned long   MaxSize = 63 * 1024; // 62.5KB is the max file size
long            DeviceFileHandle = -1;
_i32            RetVal;        // Negative return value indicates error
unsigned long   Offset = 0;
unsigned char   InputBuffer[100];
_u32            MasterToken = 0;

// Create a secure file if it doesn't exist and open it for writing
DeviceFileHandle = sl_FsOpen((unsigned char *)DeviceFileName,
                             SL_FS_CREATE | SL_FS_OVERWRITE | SL_FS_CREATE_SECURE | SL_FS_CREATE_NOSIGNATURE | SL_FS_CREATE_MAX_SIZE(MaxSize),
                             &MasterToken);

Offset = 0;
// It is preferred that the Offset and length be aligned to 16 bytes in secure files
RetVal = sl_FsWrite(DeviceFileHandle, Offset, (unsigned char *)"HelloWorld", strlen("HelloWorld"));

RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);

// Open the same file for reading, using the Token obtained during creation
DeviceFileHandle = sl_FsOpen((unsigned char *)DeviceFileName, SL_FS_READ, &MasterToken);

Offset = 0;
RetVal = sl_FsRead(DeviceFileHandle, Offset, (unsigned char *)InputBuffer, strlen("HelloWorld"));

RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);

您能否澄清以这种方式创建的文件重写次数的限制?

感谢您的帮助、我期待您的答复。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    通常、文件系统不是为数据记录目的而设计的。 有限数量的写入周期来自 SPI 闪存的实时时间。 文件系统不支持磨损均衡。 有关串行闪存(sFlash)的模式详细信息、请参阅串行闪存指南

    1月

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。



    尊敬的 Jan D:

    当重写的数据大小相同时、文件系统是否覆盖同一扇区? 如果是这样、我可以根据文件的预期寿命计算文件每天可以重写的次数。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    重写文件时、文件内容的所有扇区都会被擦除、并再次将新内容写入相同扇区。 您需要重写文件而不是删除文件。 这意味着您理论上会将自己的磨损均衡算法与文件系统相比。 由你决定。

    但我个人不建议经常使用文件系统来编写。 因为您将需要处理功率损耗的情况。 因为如果不能正确处理此状态、可能会以损坏的文件系统结束。

    1月

x 出现错误。请重试或与管理员联系。