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.

CC3100: What is the max file size? How can I create a file bigger than 64kBytes?

Part Number: CC3100
Other Parts Discussed in Thread: UNIFLASH, MSP430FR5989, CC3200

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);