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.

LAUNCHCC3220MODASF: get provisioning status at power up?

Part Number: LAUNCHCC3220MODASF

I've noticed that if the provisioning process is interrupted, sl_FsOpen(), eg, will fail with -2014 (PROVISIONING_IN_PROCESS) at power up.  A reset doesn't fix it, so my guess is that there's a flag set in flash ROM for this.  What I'd like to do is check for this and clear it if possible.

Right now, I guess I could test for -2014 error returned from sd_FsOpen(), then try to issue 

 sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP,0xFF,0,NULL, 0x0);

  to (hopefully) clear the flag. 

Is this the right approach?

Thanks!

Chris

  • Hi Chris,

    The approach you have is correct. If you look at the out_of_box example, it has the same idea in provisioningStop() of provisioning_task.c. In that function, it calls a simple API to get the NWP firmware version numbers, but is really there to check for that -2014 PROVISIONING_IN_PROCESS error and then turn off provisioning if that is the case:

    SlDeviceVersion_t ver = {0};
        uint8_t configOpt = 0;
        uint16_t configLen = 0;
    
        /* check if provisioning is running */
        configOpt = SL_DEVICE_GENERAL_VERSION;
        configLen = sizeof(ver);
        retVal =
            sl_DeviceGet(SL_DEVICE_GENERAL, &configOpt, &configLen,
                         (uint8_t *)(&ver));
        if(SL_RET_CODE_PROVISIONING_IN_PROGRESS == retVal)
        {
            UART_PRINT(
                "[Provisioning task]  Provisioning is already running, "
                "stopping it...\r\n");
            retVal =
                sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP,ROLE_STA,0,NULL,
                                    0);
    
            /* wait for the stopped event to arrive - wait for PrvnState_Init */
            do
            {
                provisioningState = GetProvisioningState();
                usleep(1000);
            }
            while(provisioningState != PrvnState_Init);
    
            pCtx->provisioningStatus = PrvsnStatus_Stopped;
    
            retVal = SL_RET_CODE_PROVISIONING_IN_PROGRESS;
        }

    Let me know if you need more clarification or have further questions on this topic.

    Regards,
    Michael

  • Michael, thanks so much for the reply!

    Chris