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.
Hello everbody!
EDIT: I changed variable "loop" to unsigned long from unsigned short, now i can make files up to 256kBytes. If I try to do 512kByte, than i get an error code of (-3) which is: SL_FS_ERR_INVALID_MAGIC_NUM. I know the flash is formatted, and before creating the file the AP mode is running. Now every variable is either signed or unsigned long.
I am currently working on the file system of the cc3100. I would like to create files that are around 600.000 - 700.000 bytes. My issue is i cannot do it, depending on the max file size i set in FS_MODE_OPEN_CREATE.
If I try to use a value greater than 150.000 i get : SL_FS_NO_DEVICE_IS_LOADED from sl_FsOpen.
If I use a value between 65536 - 150.000 i get the AP and the http server running, i can open my html file in any browser, but the data is corrupted, as i dont get the same characters in the files that i thought i wrote.
If I use 65536 as the max size value( like in the file system example in the SDK), than everything works fine.
Is it possible to create bigger files? If yes, how so?
I am attaching my code below.
I use uniflash, and I formatted the flash to 16MB. I use a custom board with msp430fr5989.
The cc3100 is in AP mode, and running a http server.(these functions are working)(I start the http server right after i close the file)
#define SL_FILE_NAME "/www/MacDonalds.html" #define BUF_SIZE 2048 //#define SIZE_64K 65536 #define SIZE_64K 131072 retVal = sl_FsOpen((_u8 *)SL_FILE_NAME,FS_MODE_OPEN_WRITE, &Token, &fileHandle); if(retVal < 0) { // File Doesn't exit create a new of 128 KB file retVal = sl_FsOpen((_u8 *)SL_FILE_NAME,FS_MODE_OPEN_CREATE(SIZE_64K,_FS_FILE_OPEN_FLAG_COMMIT|_FS_FILE_PUBLIC_WRITE), &Token, &fileHandle); if(retVal < 0) { uiprintf(retVal, 0); uprintf(" Error in creating the file \n\r",0); } } for (loop = 0; loop < (SIZE_64K/sizeof(oldMacDonald)); loop++) { retVal = sl_FsWrite(fileHandle, (_u32)(loop * sizeof(oldMacDonald)),(_u8 *)oldMacDonald, sizeof(oldMacDonald)); if (retVal < 0) { uprintf(" Error in writing the file \n\r",0); uiprintf(retVal, 0); retVal = sl_FsClose(fileHandle, 0, 0, 0); retVal = sl_FsDel((_u8 *)SL_FILE_NAME, Token); } } retVal = sl_FsClose(fileHandle, 0, 0, 0);
Hi,
Hmm... that is weird. Please wait for answer from TI.
Jan
Vincent,
I reformat the file system after each error. I get this error 10 out of 10.
My goal is to achive 600 kByte files.
I formatted the flash to 1MB, but nothing changed.
So far i tried to create the file from the code, but I tried out a different method
I created a exactly 600 kByte file, added to the file system with uniflash. With the list file system option i can see the file there, and if I start the wifi and the http server I can access it (mydomain.net/myfile.html). If I try to open the file from code it says the file doesnt exist (error code: -11) .
Any help is appreciated.
I finally managed to solve the problem.
When I was formatting the flash to 1MB, I used _FS_FILE_OPEN_FLAG_COMMIT flag for opening my file. The problem with this is that it creates a mirror of the file(makes the file fail-safe). This is why I could make 400kB but not the 600kB.
When I formatted the flash to 16MB it wasn't working... well because the flash wasn't 16MB(slight error in the custom board's layout). After the flash got replaced I managed to format it to 16MB and create my 600kB files.