-
Notifications
You must be signed in to change notification settings - Fork 671
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
CC3220 SLFS examples of WiFiMKII #1005
Comments
I tried to use FS API directly, but unfortunately can't get it working. #include <WiFi.h>
#include <ti/drivers/net/wifi/fs.h>
void setup() {
Serial.begin(115200);
delay(1000);
char* DeviceFileName = "MyFile.txt";
unsigned long MaxSize = 63 * 1024; //62.5K is max file size
long DeviceFileHandle = -1;
_i32 RetVal = 0; //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);
Serial.println(String("sl_FsOpen ") + DeviceFileHandle);
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")+1);
Serial.println(String("sl_FsWrite ") + RetVal);
RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
Serial.println("File written");
// open the same file for read, using the Token we got from the creation procedure above
DeviceFileHandle = sl_FsOpen((unsigned char *)DeviceFileName,
SL_FS_READ,
&MasterToken);
Serial.println(String("sl_FsOpen ") + DeviceFileHandle);
Offset = 0;
RetVal = sl_FsRead( DeviceFileHandle, Offset, (unsigned char *)InputBuffer, strlen("HelloWorld")+1);
Serial.println(String("sl_FsRead ") + RetVal);
RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
Serial.println("Content:");
Serial.println((char*)InputBuffer);
}
void loop() {
// put your main code here, to run repeatedly:
} This is basically copy-pasted from an example.
Have I missed something? |
Figured that out to some extent, but still no luck.
-10271 means The CC3220 Programmer's Guide says:
How do I know that the Programming process has finished? |
@spirilis @robertinant @rei-vilo |
@vshymanskyy , excuse me! |
@Jack0wang yes I did. it appears to be easier to use CCS instead of Energia |
@vshymanskyy Unfortunately, I need it in Energia. |
Are there any plans to provide SLFS functionality to CC3220 series?
Are there any other libraries that enable SLFS access?
P.S. Also reported here: energia/WiFiMKII#2
The text was updated successfully, but these errors were encountered: