TI中文支持网
TI专业的中文技术问题搜集分享网站

cc3220sf 使用fs.h中的sl_write无法将数据写到Flash中?

你好。我使用SDK中的filesystem例程,发现无法将数据写到Flash中。请问下操作是否有问题?代码如下:

char* DeviceFileName = "MyFile.txt";
unsigned long MaxSize = 63 * 1024; //62.5K is max file size
long DeviceFileHandle = -1;
_i32 RetVal; //negative retval is an error
unsigned long Offset = 0;
unsigned char InputBuffer[100];
_u32 MasterToken = 0;
// Create a file and write data. The file in this example is secured, without signature and with a fail safe commit
//create a secure file if not exists and open it for write.
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;
//Preferred in secure file that the Offset and the length will be aligned to 16 bytes.
RetVal = sl_FsWrite( DeviceFileHandle, Offset, (unsigned char *)"HelloWorld", strlen("HelloWorld"));
RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
上述这段代码是使用file:///C:/ti/simplelink_cc32xx_sdk_4_30_00_06/docs/wifi_host_driver_api/html/group___file_system.html 文档里面的实例代码的。并且返回的RetVal显示API运行成功,文件已经写入,但是当我打开Uflash在Files里面却看不到MyFile.txt这个文件夹。请问哪里出现了问题
Susan Yang:

请问您是直接使用的TI例程?硬件使用的也是TI开发板?能否给出软硬件详细信息,我明天拿板子测试一下

,

user6458813:

你好,我在里面关于编写FLASH的代码就如上面所示,只是不同的是我把开发板上的flash换成了Micron Serial NOR Flash Memory的MT25QL256ABA。因为原先的flash可能坏了,我就使用这个flash给换了上去。

,

user6458813:

你好,我在程序里面添加了写进去然后再打开该文件然后读出来的操作,发现能读出之前写进去的数据。但是,我目的是想创建一个能在Uflash 里面的files文件夹下看到的文件。请问下我该怎么做

,

Kevin Qiu1:

更换flash尽量要与原来型号一致,否则可能会不兼容
文件系统的使用手册第8章说明很详细,你可以看一下www.ti.com.cn/…/swru455m.pdf

赞(0)
未经允许不得转载:TI中文支持网 » cc3220sf 使用fs.h中的sl_write无法将数据写到Flash中?
分享到: 更多 (0)