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.

CC3200-LAUNCHXL: File operations example: ReadFileFromDevice reads the fs_demo.txt contents with offset.

Part Number: CC3200-LAUNCHXL

Dear TI Team,

       I have verified the file_operations example, from SDK example 1.4.0, I have checked both following options, works pretty well all the time. but if same file operations changes merged to mqtt_client_tirtos to store credentials it is working for option1(use both WriteFileToDevice & ReadFileFromDevice), but fails in option 2(Reads only ReadFileFromDevice by commenting WriteFileToDevice function). The work around option is working for option 2(if WriteFileToDevice function is called after the ReadFileFromDevice). 

option 1: use the example as it is

if(WriteFileToDevice(&ulToken, &lFileHandle) < 0)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
LOOP_FOREVER();
}


if(ReadFileFromDevice(ulToken, lFileHandle) < 0)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
LOOP_FOREVER();
}

Result: Both buffers values are identical and correct. (gaucOldMacDonald & gaucCmpBuf)., work for both file operations & mqtt_client_tirtos example

Option 2: Read file without using write operations.- (comment WriteFileToDevice function), 

/* if(WriteFileToDevice(&ulToken, &lFileHandle) < 0)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
LOOP_FOREVER();
}*/


if(ReadFileFromDevice(ulToken, lFileHandle) < 0)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
LOOP_FOREVER();
}

Result: gaucCmpBuf reads the correct values, work for file operations but failed for mqtt_client_tirtos example.

 

Workaround for option 2: use ReadFileFromDevice function then call WriteFileToDevice function.

/* if(WriteFileToDevice(&ulToken, &lFileHandle) < 0)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
LOOP_FOREVER();
}*/


if(ReadFileFromDevice(ulToken, lFileHandle) < 0)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
LOOP_FOREVER();
}

 if(WriteFileToDevice(&ulToken, &lFileHandle) < 0)
{
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
LOOP_FOREVER();
}

Result: With this work around for mqtt_client_tirtos  example reads correct values.

 

           I think there is some memory mapping issue, with code size increase or decrease, since we will be developing the codes, it should not read some garbage values stored for wifi credentials. Please, help me to fix this issue, Is there any way to store fs_demo.txt file into particular memory location such that it is not disturbed with future developed codes.

Thanks and Regards,

Bhairu