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.

Compiler/CC3220SF-LAUNCHXL: Application getting reset - SL_WLAN_PROVISIONING_CMD_STOP

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: CC3220SF

Tool/software: TI C/C++ Compiler

Hi,

1. During provisioning the device from mobile App after adding the WLAN profile, applied reset(POR) to the device. 
2. Upon resetting the host processor, I am facing the SL_RET_CODE_PROVISIONING_IN_PROGRESS (-2014L) error because of NWP reset is not happened. 
Please find the error logs below:
**** in main ****
Simple Link task created
Device came up in Station mode
Security alert threshold = 15
SDK successfully initialized.
Device came up in Station mode
[Provisioning task] Device started as STATION
[Provisioning task] validateLocalLinkConnection() sem wait
validateLocalLinkConnection() sem exit ret=0, status=0
[Provisioning task] Cannot connect to AP or profile does not exist
[Provisioning task] detected device is CC3220SF
[NETAPP EVENT] IP Acquired: IP=10.123.45.1 , Gateway=10.123.45.1
[Debug] Post connectionAsyncEvent
[Provisioning task] Device is configured in default state
[Provisioning task] Current: 0, Event: 0, Next: 1
[Provisioning task] Device started in AP role
[NETAPP EVENT] IP Acquired:
[Debug] Post connectionAsyncEvent
[Provisioning task] Host Driver Version: 2.0.1.27
[Provisioning task] Starting Provisioning -
[Provisioning task] in mode 2 (0 = AP, 1 = SC, 2 = AP+SC)
[Provisioning task] Provisioning Started. Waiting to be provisioned..!!
[Provisioning task] Current: 1, Event: 1, Next: 2
[WLAN EVENT] Profile Added              ----------------->(POR Reset applied here)

**** in main **** 
Simple Link task created
Device came up in Station mode
[prvPAL_GetPlatformImageState] sl_FsGetInfo failed (-2014) on /sys/mcuflashimg.bin
Device came up in Station mode
sl_FsCtl failed with error code: -2014

Error [-2014] at line [1367] in function [validateLocalLinkConnection]
[Provisioning task] Wake up on Power ON
[Provisioning task]  Provisioning is already running, stopping it...
[NETAPP EVENT] IP Acquired: [Debug] Post connectionAsyncEvent
[WLAN EVENT] Provisioning stopped
[Provisioning task] Current: 0, Event: 5, Next: 0

3. To avoid the above problem, added the following code, tried reproducing the issue(step-1),Now I am not facing the -2014 error.
Please find the code snippet below:
static WIFIReturnCode_t prvResetNetworkCPU(void)
{
    WIFIReturnCode_t xRetVal = eWiFiSuccess;
    int16_t sRetc = 0;
    int32_t retVal = 0;
    SlDeviceVersion_t firmwareVersion = {0};

    uint8_t ucConfigOpt = 0;
    uint16_t ucConfigLen = 0;
    PrvnState provisioningState;

    /* Get the device's version-information */
    ucConfigOpt = SL_DEVICE_GENERAL_VERSION;
    ucConfigLen = sizeof(firmwareVersion);

    sRetc = sl_Start(0, 0, 0);

    UART_PRINT("******* sl_Start [%d]\n", sRetc);

    /* Return codes greater than or equal to zero indicate the mode (station, softAP, or p2p)
     * that the Wi-Fi device has started up in. */
    if (sRetc < 0)
    {
        /* Handle Error. */
        configPRINTF(("\n sl_Start failed\n"));
        xRetVal = eWiFiFailure;
    }
    else
    {
//Start of -2014L error FIX
        /*  added fix for NWP to reset while proviosioning (SL_RET_CODE_PROVISIONING_IN_PROGRESS -2014 error) */

        retVal = sl_DeviceGet(SL_DEVICE_GENERAL, &ucConfigOpt,
                              &ucConfigLen,
                              (unsigned char *)(&firmwareVersion));

        if (SL_RET_CODE_PROVISIONING_IN_PROGRESS == retVal)
        {
            UART_PRINT((
                "[Provisioning task] Provisioning is already running,"
                " stopping it...\r\n"));
            /* set SL_WLAN_PROVISIONING_CMD_FLAG_EXTERNAL_CONFIRMATION Flag for new prov schema */
            retVal =
                sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP, ROLE_AP, 0, NULL,
                                    SL_WLAN_PROVISIONING_CMD_FLAG_EXTERNAL_CONFIRMATION);

            do
            {
                provisioningState = GetProvisioningState();
                usleep(1000);
            } while (provisioningState != PrvnState_Init);
        }

//End of fix

        /* Stop the simple link device with a stop timeout in msec to
        * finish any pending transmission/reception*/
        sRetc = sl_Stop(SL_STOP_TIMEOUT);

        UART_PRINT("******* sl_Stop [%d]\n", sRetc);

        if (sRetc != 0)
        {
            /* Handle Error. */
            configPRINTF(("\n sl_Stop failed\n"));
            xRetVal = eWiFiFailure;
        }
    }
    return xRetVal;
}

4 After executing the following command "sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP, ROLE_AP, 0, NULL,0)", I observed that Host Application started 2 times after "Switching Networking mode on application request" debug trace. 
Please find the error logs below:
**** in main ****
Simple Link task created
Device came up in Station mode
Security alert threshold = 15
SDK successfully initialized.
Device came up in Station mode
[Provisioning task] Device started as STATION
[Provisioning task] validateLocalLinkConnection() sem wait
validateLocalLinkConnection() sem exit ret=0, status=0
[Provisioning task] Cannot connect to AP or profile does not exist
[Provisioning task] detected device is CC3220SF
[NETAPP EVENT] IP Acquired: IP=10.123.45.1 , Gateway=10.123.45.1
[Debug] Post connectionAsyncEvent
[Provisioning task] Device is configured in default state
[Provisioning task] Current: 0, Event: 0, Next: 1
[Provisioning task] Device started in AP role
[NETAPP EVENT] IP Acquired:
[Debug] Post connectionAsyncEvent
[Provisioning task] Host Driver Version: 2.0.1.27
[Provisioning task] Starting Provisioning -
[Provisioning task] Provisioning Started. Waiting to be provisioned..!!
[Provisioning task] Current: 1, Event: 1, Next: 2
[WLAN EVENT] Profile Added----------------->(POR Reset applied here)


**** in main ****               ----------------------> Application started after applying intentional reset
Simple Link task created
******* sl_Start [0]
[Provisioning task] Provisioning is already running, stopping it...
******* sl_Stop [0]
[NETAPP EVENT] IP Acquired: 
[Debug] Post connectionAsyncEvent
Device came up in Access-Point mode
Switching Networking mode on application request

**** in main ****               ----------------------> Application restarted 1st time
Simple Link task created
******* sl_Start [2]
******* sl_Stop [0]
[NETAPP EVENT] IP Acquired: 
[Debug] Post connectionAsyncEvent
[NETAPP EVENT] IP Acquired: IP=10.123.45.1 , Gateway=10.123.45.1
[Debug] Post connectionAsyncEvent
Device came up in Access-Point mode
Switching Networking mode on application request

**** in main ****               ----------------------> Application restarted second time
Simple Link task created
******* sl_Start [0]
******* sl_Stop [0]
Device came up in Station mode
[prvPAL_GetPlatformImageState] xFileInfo.Flags = 0250
[prvPAL_GetPlatformImageState] eOTA_PAL_ImageState_Valid
[TEMPERATURE] I2C bus initialized. --------------------> Application started as usual


5.Its Looking like Host processor reset happening twice, but if I read the reset reason by using PRCMSysResetCauseGet , its showing POR (means not software reset by the application).
Please help me out resolving this issue and also please let me know any clarification missing.
Regards,
Suresh
  • Hi, 

    Do you knw what is the reason for the MCU reset? I'm not sure if it was intentional (in such case, why?) or happened due to some internal event? (do you watchdog timer? caught an exception?)

    The NWP will stay in provisioning mode until the provisioning timeout will expire or you will send  sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP..).

    In such case you can't issue any other command to the NWP (except for the provisioning stop command).

    Br,

    Kobi

     

  • Hi Kobi,

    Thanks for your response.
     
    It is intentional reset to reproducing the issue. There is no exception caught on watchdog timer.
    I can send and able to stop the Provisioning process, but the only issue is with my point 4, when the moment I send 
    sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP, ROLE_AP, 0, NULL,0) command, 
    upon Switching Networking mode on application request -debug trace, the application is restarting twice, but the reset reason still as POR. 
    Regards,
    Suresh
  • This is not a code form the provisioning example. I guess you are based on the MQTT example.

    The Network_IF_InitDriver() code doesn't consider the provisioning.

    After you call the sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP...)  you still need to wait for the PROVSIONING STOPPED event before other command can be issued.

    Br,

    Kobi

  • Hi Kobi,

    This is AWS MQTT example code we are using.

    After calling the sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP...) we also waited for the PROVSIONING STOPPED event, but the behaviour is same. The host controller was rebooted twice in that case also. In one of the thread of TI it is mentioned to get GetProvisioningState() and wait for the state other than PrvnState_Init. the link is below.

    e2e.ti.com/.../813246

    When we are waiting for PROVSIONING STOPPED event also we see the host controller is booted 2 times.

    Now the basic question is when we are asking network processor to stop provisioning how can the host controller reset? does network process has a control to reset Host? If even that is true, why the reset reason is not changing. For sure it might not be POR.

    We wanted to avoid this host processor reboot when the provisioning is stopped. So please provide us the solution for this at the earliest.

    Note:

    I request you to keep the thread active since already 2 times the questions were asked from TI. We wanted this to be closed quickly as we have a release and it depends on the answer or solution from this thread.

    Regards,

    Suresh

  • I don't know why the host gets reset. it can happen only due to a watchdog (but doesn't seem to be your case) or writing to the PRCM (you may have some reset code in one of the exceptions).

    The code mentioned before (in the other thread) waits for the provisioning state machine to reset which happens once the provisioning-stopped event is received. It is taken from the OOB example.

    Are you using the CC3220SF Launchpad or a custom board?

    Br,

    Kobi