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: SL_FS_ERR_FS_ALREADY_LOADED

Other Parts Discussed in Thread: CC3100, UNIFLASH, CC31XXEMUBOOST

We are working with CC3100 with ServicePack 1.0.0.1.2

In the initial configuration, we execute:

retVal = sl_WlanProfileDel(0xFF);
if (retVal != 0) return ERROR;

In one device, it was returning 0xFFF9. I have seen in fs.h the next definition:

#define SL_FS_ERR_FS_ALREADY_LOADED (-7)

The CC3100 host documentation says that sl_WlanProfileDel returns zero on success and -1 in error.

Why does it return -7?

I began to debug this device and after two or three executions, sl_WlanProfileDel began to return 0,I don't know why and I can't reproduce the error.

Thanks for any ideas that help.

Rubén

  • Hi, and programming the serviec pack shold 

    You can take a look in the following post: http://e2e.ti.com/support/wireless_connectivity/f/968/p/397231/1420088

    Usually it means that the serial flash is full for some reason (can you tell if you programmed on the same board some files). Starting from scretch by formatting should resolve it but since you cannot reproduce it I'm not sure if it is still relevant.

    Shlomi

  • Hi Shlomi,

    I didn't program any file on this board, so the serial flash shouldn't be full. In every execution, I delete all the profiles (sl_WlanProfileDel(0xFF)) and create a new one (this code will only execute in the first start and in a battery replacement). Can it fill the serial flash?

    Thank you very much,

    Rubén
  • Ruben,

    Strange you cannot reproduce it. The -7 is a generic error and not related to the SL_FS_ERR_FS_ALREADY_LOADED. It means you cannot "talk" to the file system or the serial flash from some reason. Please try to reproduce, otherwise I cannot think of anything else.

    Shlomi

  • Shlomi,

    Before sl_WlanProfileDel(0xFF), the program executes sl_Start and sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &configOpt, &configLen, (_u8 *)(&ver)). Both of them return zero. Are the device configurations saved in the serial flash?

    Some time ago, we had a problem in the start sequence. If the device lost power supply repeatedly (because of a initial bad contact of the battery, for example) during the CC3100 configuration it seemed like the CC3100 serial flash became corrupted. We made a simple workaround, waiting 2 seconds before config the CC3100 (to guarantee a stable power supply) I have deleted this 2 second delay and I have reproduced the problem, but in this case, the device doesn't recover the serial flash communication after a few restarts (as happened yesterday)

    It only works again if I format and do a service pack programming with CCS UniFlash.

    (We are using the CC3100 reference design)

    Thank you very much,

    Rubén
  • Ruben,

    For your question, yes, device configuration is saved to serial flash. In the example above, when you set date/time via this API, it ends up storing it on serial flash.

    However, I'm not completely aligned with you on where you introduced this 2 seconds delay. What do you refer as "before config the CC3100"? Are you refering to device initialization (i.e. sl_start) or any other call to APIs like sl_DevSet()?

    What I can suggest is to create a user file just for the test using sl_fs() APIs. There operations would return "true" file system error codes so we can learn more on the state of the serial flash. Can you implement open-write-close on a user file during this 2 seconds window and report back the error code?

    Shlomi

  • Shlomi,

    With "config the CC310" I refer to device initialization (sl_start), sl_DevGet, sl_WlanProfileDel, sl_WlanProfileAdd, sl_WlanPolicySet  and sl_WlanDisconnect.

    When I reproduce the error and implement file system operations, I get:

    - sl_FsGetInfo returns 0xFFCF

    - sl_FsOpen returns 0xFFFFFFCF

    Thank you very much,


    Rubén

  • Ruben,

    Device initialization is protected such that the driver does not return until an interrupt is received back, indicating the CC3100 is up and running. So again, where is this 2 secconds delay implemented in the code (high level code is OK as well)?

    The 0xFFCF means NO_DEVICE_IS_LOADED error. It usually happens when the serial flash cannot be loaded (e.g. hardware issue with the lines). Are you using a custom board or the reference CC3100 BP + EMUBOOST?

    I want to make sure your serial flash is connected OK. You mentioned you can format and program service pack, right? can you do it again and then read the version from the device? I want to see that the version is updated according to the service pack.

    Shlomi

  • Shlomi,

    The 2 seconds delay is just before sl_Start.

    We are using a custom board with the CC3100 reference design.

    Here is the info of the "Get Version":

    [13:20:33] Begin GetVersion operation.
    [13:20:34] INFO: > Executing Operation: Connect
    [13:20:34] DEBUG: waiting and clearing uart rx buffer
    [13:20:36] INFO: setting break signal
    [13:20:36] INFO: --- please restart the device ---
    [13:20:36] DEBUG: wait for ack
    [13:20:37] INFO: connection succeeded
    [13:20:37] INFO: getting storage list
    [13:20:37] DEBUG: wait for ack
    [13:20:37] INFO: > Executing Operation: GetVersion
    [13:20:37] INFO: reading version info
    [13:20:37] DEBUG: wait for ack
    [13:20:37] INFO: > Bootloader version: 2.0.4.0
    [13:20:37] INFO: > Executing Operation: Disconnect
    [13:20:37] DEBUG: disconnecting from device . . .
    [13:20:37] DEBUG: wait for ack
    [13:20:37] Operation GetVersion returned.

    Thank you very much,

    Rubén
  • Ruben,

    Sorry but I meant to read the version from the API, not Uniflash.

    From Uniflash, it is always the ROM boot loader version regardless of the Service Pack - so it is useless.

    From AI, there is an example under device.h file. For your reference:

    Example for getting version:
    SlVersionFull ver;
    pConfigOpt = SL_DEVICE_GENERAL_VERSION;
    sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&pConfigOpt,&pConfigLen,(_u8 *)(&ver));
    printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP %d.%d.%d.%d\nROM %d\nHOST %d.%d.%d.%d\n",
    ver.ChipFwAndPhyVersion.ChipId,
    ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1],
    ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3],
    ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1],
    ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3],
    ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
    ver.RomVersion,
    SL_MAJOR_VERSION_NUM,SL_MINOR_VERSION_NUM,SL_VERSION_NUM,SL_SUB_VERSION_NUM);

    Shlomi

  • Shlomi,

    CHIP 0x04000000
    MAC 31.1.2.0.2
    PHY 1.0.3.23
    NWP 2.2.0.1
    ROM 0x3333
    HOST 1.0.0.1

    Thank you,

    Rubén
  • Ruben,

    It does seem the right version so Service Pack programming went well.

    Do you see the same behavior with the reference board from TI? It is too much effort to try it out?

    Is it possible to provide a code snippet with the API calls and the 2 seconds delay so I can take a look?

    Shlomi

  • Shlomi,

    I'll try to reproduce it with CC31XXEMUBOOST.

    Here is the code snippet:

        delay_ms(2000);
    		
        mode = sl_Start(0, pConfig, 0);
    		
        // If the device is not in station-mode, try configuring it in station-mode 
        if (ROLE_STA != mode)
        {
            if (ROLE_AP == mode)
            {
                // If the device is in AP mode, we need to wait for this event before doing anything 
                while(!IS_IP_ACQUIRED(g_Status));
            }
    
            // Switch to STA role and restart 
            retVal = sl_WlanSetMode(ROLE_STA);
    				if (retVal != 0) return NOK;
    
            retVal = sl_Stop(SL_STOP_TIMEOUT);
            if (retVal != 0) return NOK;
    
            retVal = sl_Start(0, pConfig, 0);
            if (retVal < 0) return NOK;
    
            // Check if the device is in station again 
            if (ROLE_STA != retVal)
            {
                // We don't want to proceed if the device is not coming up in station-mode 
                //ASSERT_ON_ERROR(DEVICE_NOT_IN_STATION_MODE);
            }
        }
    
        //testFS();
    		
        // Get the device's version-information 
        configOpt = SL_DEVICE_GENERAL_VERSION;
        configLen = sizeof(ver);
        retVal = sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &configOpt, &configLen, (_u8 *)(&ver));    
        if (retVal != 0) return NOK;
    
        retVal = sl_WlanProfileDel(0xFF);
        if (retVal != 0) return NOK;
    		
        g_SecParams.Key = staticWLanInfo.password;
        g_SecParams.KeyLen = strlen((char*)staticWLanInfo.password);
        g_SecParams.Type = staticWLanInfo.encryption;
        retVal = sl_WlanProfileAdd(staticWLanInfo.ssid, strlen((char*)staticWLanInfo.ssid), 0, &g_SecParams, 0,7,0);
        if (retVal < 0) return NOK;
    		
        //Connecting to the Access point
        // Set connection policy to Auto + SmartConfig (Device's default connection policy) 
        retVal = sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 1, 0, 0, 0), NULL, 0); // PROFILE
        if (retVal != 0) return NOK;
    
        //  Device in station-mode. Disconnect previous connection if any
        //  The function returns 0 if 'Disconnected done', negative number if already disconnected
        //  Wait for 'disconnection' event if 0 is returned, Ignore other return-codes
        retVal = sl_WlanDisconnect();
        if(0 == retVal)
        {				
            // Wait 
            while(IS_CONNECTED(g_Status)) {
    		_SlNonOsMainLoopTask();
    	}
        }
    
        retVal = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,1,1,&val);
        if (retVal != 0) return NOK;
    
        retVal = sl_Stop(0);
        retVal = sl_Start(0, pConfig, 0);
    
        cont = timeout * 130;
        while (((!IS_CONNECTED(g_Status)) || (!IS_IP_ACQUIRED(g_Status))) && (cont > 0)){
    		cont--;
    		_SlNonOsMainLoopTask();
        }
        if (cont<=0) {
    		return NOK;
        }		
    		
        // Enable statis IP
        ipV4.ipV4 = netInfo.ip;
        ipV4.ipV4Mask = netInfo.mask;
        ipV4.ipV4Gateway = netInfo.gateway;
        ipV4.ipV4DnsServer = SL_IPV4_VAL(0,0,0,0);
        // After calling this API device will be configure for static IP address.
        retVal = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_STATIC_ENABLE,1, sizeof(SlNetCfgIpV4Args_t), (_u8 *)&ipV4);
        if (retVal != 0) return NOK;
    
        // Disable scan
        configOpt = SL_SCAN_POLICY(0);
        retVal = sl_WlanPolicySet(SL_POLICY_SCAN , configOpt, NULL, 0);
        if (retVal != 0) return NOK;
    
        // Set Tx power level for station mode
        // Number between 0-15, as dB offset from max power - 0 will set maximum power
        power = TX_POWER_LEVEL;
        retVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (_u8 *)&power);
        if (retVal < 0) return NOK;
    
        // Set PM policy to normal 
        retVal = sl_WlanPolicySet(SL_POLICY_PM , SL_ALWAYS_ON_POLICY, NULL, 0);
        if (retVal != 0) return NOK;
    
        // Unregister mDNS services 
        retVal = sl_NetAppMDNSUnRegisterService(0, 0);
        if (retVal != 0) return NOK;
        retVal = sl_NetAppStop(SL_NET_APP_MDNS_ID);
        if (retVal < 0) return NOK;
    
        // Remove  all 64 filters (8*8) 
        memset(RxFilterIdMask.FilterIdMask, 0xFF, 8);
        retVal = sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (_u8 *)&RxFilterIdMask,
                           sizeof(_WlanRxFilterOperationCommandBuff_t));
        if (retVal != 0) return NOK;
    
        retVal = sl_Stop(SL_STOP_TIMEOUT);
        if (retVal != 0) return NOK;
    		
        return OK; // Success 
    

    Rubén

  • Thanks,

    Please try with a reference board.

    I still don't see the value of the 2 seconds prior to sl_start().

    In the middle, you have:

    retVal = sl_Stop(0);
    retVal = sl_Start(0, pConfig, 0);
    I would have used 0xff in the sl_stop(0xff).
    Apart from that, it looks fine.
    Shlomi
  • Shlomi,

    While I prepare the test with the reference board, I had doing other tests with our own board and I've seen that when the error happens I only need to format the serial flash (without the Service Pack Programming) to make it works again. I don't know if It can be some kind of clue for you.

    Thank you very much,

    Rubén
  • Thanks but unfortunately it does not shed light. You can work without service pack and in this case the ROM version is used (which is good enough).

    However, you did mention power stabilation issues with your serial flash during starting CC3100 device, right? this is why you introduced the 2 seconds delay. Not sure what you refer to by power stability issues but during initialization of CC3100, it looks for the serial flash and initialized it (e.g. the SPI clock rate). Failing to do so would result in getting the NO_DEVICE_IS_LOADED error since the serial flash could not be initialized.

    Shlomi

  • Hi Ruben,

    Can you please update your current status?

    Shlomi

  • Hi Shlomi,

    I haven't had time to probe with a reference board. I'll update my status as soon as possible

    Thank you very much.

    Ruben