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.

CCS/CC3200: CC3200 Provisioning with RTOS "TIMEOUT" error

Part Number: CC3200
Other Parts Discussed in Thread: SYSCONFIG

Tool/software: Code Composer Studio

I 'm doing the usual MQTT example but having a problem with including provisioning to my RTOS main task. This is what error i get:


Note,the many "[NETAPP EVENT] IP leased to a client" are due to me connecting and disconnecting with the smartphone prior to doing provisioning. Even though the startProvisioning API returns -3 (I suppose it's TIMEOUT?), the profile is sometimes actually added and i can see it in the device's webserver. In the smartphone side,this is what i see:

The project and the dependencies have been set to OS_DEBUG and debug configurations. Things i've tried:

  • The functions generalTimeoutHandler,waitmSec, timeoutHandler, ProvEventTimeoutHdl ,ProvWaitHdl that need to be defined in MAIN for the provisioning to work. I made sure i;m not using the timers A1 and A0 anywhere else at the same time.
  • Added USE_TIRTOS,SL_PLATFORM_MULTI_THREADED to my project's and also the provisioninglib project's predefined symbols.
  • Other configurations than OS_DEBUG. In some the program doesn't work at all.
  • Made sure that the following lines are included in the "Simplelink/user.h": #include "provisioning_api.h", #define SL_EXT_LIB_1 sl_Provisioning
  • Tried the same things with a totally different project using FREE RTOS. Same outcome.
  • One weird thing i've noticed is that the CCS has copied the projects wlan_station, driverlib, and simplelink, to the workspace although the "getting started" instructions say it shouldn't and i had disabled the option when importing. Maybe i'm setting the configurations to the wrong projects? These projects are in my workspace now. These are my linker includes:

Please help. Alex

  • Hi Alex,

    To establish a baseline here, what SDK and service pack are you using on the CC3200? Please make sure you have the latest service pack flashed to your device as it contains the latest bug fixes and errors.

    I see you've added provisioning to the MQTT client application correct? 

    It looks like you have a profile that your device is trying to connect to at startup. You are probably getting odd provisioning behavior because you are trying to provision while your device is already connected to an AP. Do you still get this behavior if you delete all profiles at startup before trying to provision? Also make sure you use AP provisioning and not SmartConfig since it's more reliable.

    Jesu

  • I have the latest SDK(1.5) and the latest service pack flashed (seen in the terraterm above). Even installed them with new CCS version.

    Yes its the MQTT client application,modified with AP provisioning inside the main task.

    Sometimes the profile indeed gets added(like seen in my pictures above) but provisioning always finishes with error. I'm deleting all profiles at startup(running the regular ConfigureSimpleLinkToDefaultState() function) . Also tried setting different connection policies in there, no effect.

    The non-OS application is working fine.

  • Any ideas? This is a really important issue...

    Maybe i will use the non-os version and do the provisioning before the RTOS starts...

  • Hey Alex,

    I see in your UART log screenshot both the provisioning task and the mqtt task return the same error. I'm not sure if you may have a scheduling conflict. Could you try doing provisioning with everything else disabled in your application (e.g. MQTT, peripheral... etc)? Please let me know the results. Also, what function specifically returns -3 error?

    Jesu

  • sl_extlib_ProvisioningStart is the first API returning -3. It's within function startProvisioning(),which runs from the main task and also returns -3.

    The main task is the MqttClient task from the example projects. But the particular project shouldn't matter, as i have also tried to add provitioning to he get_time project (Freertos) and it fails the same way.

    The startProvisioning() function has been ported from the AP provisioning project just with changing some lines MAP_UtilsDelay-->osi_Sleep. I am not running anything else there ,as this is at the start of the task.

    Here are some RTOS data before the instruction sl_extlib_ProvisioningStart is ran,if it's worth anything:

    Thanks ,Alex

  • Hi Alex,

    Please give me some time to test this and get back to you. I do not see anything wrong with your setup. 

    Jesu

  • Hi Alex,

    I can somewhat re-create the behavior you're seeing. I'm not sure if it's exactly the same. 

    I get the following error in the SimpleLink Start Pro mobile app when I try to provision: "The provisioning sequence has not started yet. Device is waiting for configuration to be sent".

    Could you confirm that you get the -3 errors when the provisioning timeout occurs? In my tests I noticed startProvisioning returns when the provisioning timeout occurs. My guess so far is that there's something causing the OS provisioning library to not progress even though the AP profile is getting added. This is why we are staying stuck until the timeout occurs and then we can connect to the AP.

    Jesu

  • Sometimes this is the error i get with this program in the SimpleLink Start Pro mobile app ,too.
    Yes that's the same errors. The -3 errors. Are they timeout? I don't know.

  • Any news from this? Do we know who wrote this library? Maybe they can help. I think this is a problem many people have.

  • Hi Alex,

    I can confirm startProvisioning is returning due to a timeout in the provisioning process but that is just a symptom not the problem. These libraries were written a long time ago and unfortunately are no longer prioritized. My suggestion for you long term would be to use a CC3220 or CC3235 as we support these devices regularly and have their associated software on a quarterly release schedule. 

    You can try taking a look at the out_of_box example. This example is RTOS based and supports provisioning. I personally have not had a chance to look into this but it looks like its worth looking into. I will continue investigating this in the background. If you find anything noteworthy please share here with the community.

    Jesu

  • Hmm. Maybe this library got messed up with the new SDKs. Were people working with RTOS AP provisioning before in CC3200? I haven't found anything in github... If you can find any example where it works then we will sort this out.

    Unfortunately doing Non-OS provisioning in an RTOS project throws me a all kinds of errors,so no way around this. The out of box example uses smartconfig,not AP.

    CC3235 sounds good but we have already purchased a bunch of cc3200 devkits in campus, they are supposed to be a reliable chip.

  • Hi Alex,

    Correct, out of box example works using Sysconfig based provisioning. Is that not an option for you? All RTOS based examples that require provisioning use Smartconfig.

    Jesu

  • Unfortunately the out of box example's provisioning doesn't work,and i remember reading somewhere that smartconfig in cc3200 has been deprecated?

    We don't have any example from anybody to look at ,where AP provisioning with RTOS works?

    Greetings,Alex

  • Hi Alex,

    I remember reading somewhere that smartconfig in cc3200 has been deprecated?

    Correct. As I mentioned before we no longer actively support CC3200 with quarterly SW updates. This is why I suggested upgrading to CC3220 or CC3235 but I understand you have already may your purchase in bulk. With that said, what kind of problems are you seeing with smartconfig RTOS provisioning?

    We don't have any example from anybody to look at ,where AP provisioning with RTOS works?

    There is no example that uses AP provisioning with RTOS. All use smart config.

    Jesu

  • Then i guess it would be better to try using an older SDK and see if the program works there. Any ideas?

    Although in github the other people's codes tend to use the HTML website provisioning which i consider improper for my purpose.

    After that i guess i will be moving to cc3235. Still ,a shame that something so basic doesn't work on the cc3200.

  • Hi Alex,

    It is always better to use the latest SDK because it will have the latest bug fixes. 

    When using Smart config for provisioning there's generally some reliability concerns because there's some environmental factors that come into play. Smart config has been improved upon for our cc3220 and cc3235 devices but will remain the same for cc3200 . We typically recommend to have AP provisioning or WPS as a back up. https://processors.wiki.ti.com/index.php/CC3200_SmartConfig_Provisioning

    Regarding AP provisioning, I could consistently get it working with the non-OS version as you can as well. If you are using just using these for educational purposes I recommend just working off of the provisioning_ap example - Smartconfig is not suitable if multiple devices are going to be provisioned at the same time. If you really need OS based AP provisioning you can try importing the provisioninglib project and try rebuilding the library. There is some E2E forums from community members we have assisted in the past on this:

    https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/t/589812?CC3200-Provisioning-AP-Example-Unable-to-Start-Provisioning-Sequence

    Make sure you rebuild it with the SL_PLATFORM_MULTI_THREADED define. https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/t/552002

    Also, apart from the other benefits I've already mentioned about upgrading to cc3220 and cc3235, if this is for educational purposes we also have Simplelink Academy for CC3220 and CC3235 devices which is a great teaching resource. To summarize it's basically a collection of labs/projects and tutorials that go over nearly every feature in our device in some way or another. 

    I hope this helps.

    Jesu

  • Sorry if i'm doing a stupid question,but truth is i'm struggling with compilers and include options. I notice that the provisioninglib project has been imported to my workspace but the compiler and linker include options of my project in question list the ${CC3200_SDK_ROOT}/simplelink_extlib/provisioninglib
    headers and source files. When i change these include options to my workspacev10/provisioninglib , it throws me a

    cannot open source file "provisioning_api.h"

    error within the simplelink/user.h project. However this simplelink project is the one in the ${CC3200_SDK_ROOT} ,and NOT the one imported from the beginning in my workspace ,which of course i have configured for OS. Maybe i'm including something wrong here?

  • Hey Alex,

    No apology necessary. I am here to help!

    First thing is let me verify when you imported the provisioninglib you did not have the "Copy to workspace" checked. You don't want to do this because when you build it will generate the new libraries and you want it to reference the library directories in the SDK as well as any other files. 

    Be careful when making changes to this project because you will be making changes to the actual source files in the SDK. Make sure you leave yourself a way to get back to the original project to not corrupt anything in the SDK. 

    Please try this and confirm you are able to build the provisioninglib project.

    EDIT: Once you do this and you start making modifications as well as generating new library files also verify that your other projects using provisioning are referencing the newly generated library files. 

    Jesu

  • Thanks for helping.

    I can't import the provisioninglib project without copying to workspace. It greys out the option and copies it anyway,as you can see here in its settings afterwards it's location is in the workspace:

    And then the rest of the projects include the ${CC3200_SDK_ROOT}/simplelink_extlib/provisioninglib directory and not my imported & modified one. For example see the default provisioning_AP example:

    But as i mentioned, if i change the includes to my workspacev10/provisioninglib directory, my RTOS project throws me that error upon compilation.

  • Hi Alex,

    It appears you are correct. It is not like this in the CC3220 SDK - my mistake for assuming. With that said I do not get build error on the provisioninglib project in my workspace. You will have to get the library generated from the workspace directory then and copy it to where the other projects are referencing it.

    If you are getting build errors without making changes you must have modified something that is breaking it. Perhaps try re-installing the SDK for a fresh start.

    Jesu

  • I wasn't getting any build errors with the provisioninglib. Anyway, i did what you sugested,since i couldn't link to the provisioninglib in the ${CC3200_SDK_ROOT}, i just copied the one i had modified in my workspace over there so it was now modified for RTOS. No effect.

    I also tried to include in the linker the modified provisioninglib and simplelink source files from my workspace instead of ${CC3200_SDK_ROOT},as seen below. No effect still. Provisioning ends with errors and profile doesn't get added.

  • Hi Alex,

    I hope you find this information helps you solve the issue you are having. I took the time to dive into this myself and get it working. Below are the steps I followed from start to finish to get the provisioning_ap example working with RTOS based provisioning. 

    1. Import the provisioning_ap and ti_rtos_config project to your workspace

    2. In the provisioning_ap project, right click on it, go to properties->ARM linker-> file search path and delete all the linked libraries (top window) and copy and paste the ones below:

    ${INHERITED_LIBRARIES}
    ${CC3200_SDK_ROOT}/simplelink/ccs/OS_debug/simplelink.a
    ${CC3200_SDK_ROOT}/driverlib/ccs/Release/driverlib.a
    ${CC3200_SDK_ROOT}/oslib/ccs/ti_rtos/ti_rtos.a
    ${CC3200_SDK_ROOT}/simplelink_extlib/provisioninglib/ccs/os/provisioninglib.a
    libc.a

    You'll see most of these are the same. The only thing I changed was I used the OS version of simplelink.a, OS version of provisioninglib.a and added the ti_rtos.a library.

    3. Also in the provisioning_ap project, right click->properties->ARM compiler->include options and delete all the include options (top window) and copy and paste the ones below:

    ${INHERITED_INCLUDE_PATH}
    ${PROJECT_ROOT}
    ${CC3200_SDK_ROOT}/simplelink/
    ${CC3200_SDK_ROOT}/simplelink/include
    ${CC3200_SDK_ROOT}/simplelink/source
    ${CC3200_SDK_ROOT}/driverlib/
    ${CC3200_SDK_ROOT}/inc/
    ${CC3200_SDK_ROOT}/example/common/
    ${CC3200_SDK_ROOT}/simplelink_extlib/provisioninglib
    ${CC3200_SDK_ROOT}/oslib
    ${CG_TOOL_ROOT}/include

    Most of these should be familiar as well. If I remember correctly all I did here was add oslib.

    4. ... properties->ARM Compiler->Predefined symbols, delete all pre-defined symbols (top window) and copy and paste the ones below:

    ${INHERITED_SYMBOLS}
    ccs
    USE_TIRTOS
    SL_PLATFORM_MULTI_THREADED
    cc3200
    __CCS__

    5. properties->build->dependencies then click add and add the ti_rtos_config project

    6. Lastly replace your main.c file in the project with the one I attached below. I just added an include for TI-RTOS, corrected a bug I found related to SL_PLATFORM_MULTI_THREADED and performed all initial configuration for the host driver and RTOS setup (e.g. spawn SL task, osi_start etc.). 

    I double checked my steps here and I know for certain that this works with SDK v1.5 and the service pack that comes with it. 

    You should be able to extract the information you need from here for your setup.

    EDIT: Forgot to attach main.c file. 

    1411.main.c
    //*****************************************************************************
    //
    // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 
    // 
    // 
    //  Redistribution and use in source and binary forms, with or without 
    //  modification, are permitted provided that the following conditions 
    //  are met:
    //
    //    Redistributions of source code must retain the above copyright 
    //    notice, this list of conditions and the following disclaimer.
    //
    //    Redistributions in binary form must reproduce the above copyright
    //    notice, this list of conditions and the following disclaimer in the 
    //    documentation and/or other materials provided with the   
    //    distribution.
    //
    //    Neither the name of Texas Instruments Incorporated nor the names of
    //    its contributors may be used to endorse or promote products derived
    //    from this software without specific prior written permission.
    //
    //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    //  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    //  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    //  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    //  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    //  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    //  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    //  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    //  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    //  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    //  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    //
    //*****************************************************************************
    
    
    //*****************************************************************************
    //
    // Application Name     -   Provisioning AP
    // Application Overview -   This is a sample application demonstrating how to
    //                          provision a CC3200 device.
    //
    //*****************************************************************************
    
    
    //****************************************************************************
    //
    //! \addtogroup simplelink_provisioning
    //! @{
    //
    //****************************************************************************
    
    // Simplelink includes
    #include "simplelink.h"
    
    //Driverlib includes
    #include "hw_types.h"
    #include "hw_ints.h"
    #include "hw_memmap.h"
    #include "rom.h"
    #include "rom_map.h"
    #include "interrupt.h"
    #include "prcm.h"
    #include "utils.h"
    #include "timer.h"
    
    // free-rtos/TI-rtos include
    #include "osi.h"
    
    // Provisioning lib include
    #include "provisioning_api.h"
    #include "provisioning_defs.h"
    
    //Common interface includes
    #include "pinmux.h"
    #include "gpio_if.h"
    #include "common.h"
    #include "timer_if.h"
    #ifndef NOTERM
    #include "uart_if.h"
    #endif
    
    #define TASK_PRIORITY                          (1)
    #define OSI_STACK_SIZE                   (2048)
    #define SPAWN_TASK_PRIORITY     9
    
    #define APPLICATION_NAME        "AP Provisioning"
    #define APPLICATION_VERSION     "1.4.0"
    
    
    #define WLAN_DEL_ALL_PROFILES   0xFF
    
    
    #define SL_PARAM_PRODUCT_VERSION_DATA 	"R1.0"
    #define PROVISIONING_TIMEOUT            300 //Number of seconds to wait for provisioning completion
    
    // Application specific status/error codes
    typedef enum{
        // Choosing -0x7D0 to avoid overlap w/ host-driver's error codes
        LAN_CONNECTION_FAILED = -0x7D0,
        DEVICE_NOT_IN_STATION_MODE = LAN_CONNECTION_FAILED - 1,
        STATUS_CODE_MAX = -0xBB8
    }e_AppStatusCodes;
    
    
    //*****************************************************************************
    //                 GLOBAL VARIABLES -- Start
    //*****************************************************************************
    volatile unsigned long  g_ulStatus = 0;//SimpleLink Status
    unsigned long  g_ulGatewayIP = 0; //Network Gateway IP address
    unsigned long  g_ulStaIp = 0;
    unsigned char  g_ucConnectionSSID[SSID_LEN_MAX+1]; //Connection SSID
    unsigned char  g_ucConnectionBSSID[BSSID_LEN_MAX]; //Connection BSSID
    
    unsigned long 	g_ulTimerA2Base;
    _u8 volatile g_TimerATimedOut;
    _u8 volatile g_TimerBTimedOut;
    
    #if defined(ccs)
    extern void (* const g_pfnVectors[])(void);
    #endif
    #if defined(ewarm)
    extern uVectorEntry __vector_table;
    #endif
    //*****************************************************************************
    //                 GLOBAL VARIABLES -- End
    //*****************************************************************************
    
    
    //****************************************************************************
    //                      LOCAL FUNCTION PROTOTYPES
    //****************************************************************************
    int startProvisioning();
    static void BoardInit(void);
    static void InitializeAppVariables();
    
    //*****************************************************************************
    // SimpleLink Asynchronous Event Handlers -- Start
    //*****************************************************************************
    
    
    //*****************************************************************************
    //
    //! \brief The Function Handles WLAN Events
    //!
    //! \param[in]  pWlanEvent - Pointer to WLAN Event Info
    //!
    //! \return None
    //!
    //*****************************************************************************
    void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
    {
        if(!pWlanEvent)
        {
            return;
        }
        switch(pWlanEvent->Event)
        {
            case SL_WLAN_CONNECT_EVENT:
            {
                SET_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION);
    
                //
                // Information about the connected AP (like name, MAC etc) will be
                // available in 'slWlanConnectAsyncResponse_t'
                // Applications can use it if required
                //
                //  slWlanConnectAsyncResponse_t *pEventData = NULL;
                // pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected;
                //
    
                // Copy new connection SSID and BSSID to global parameters
                memcpy(g_ucConnectionSSID,pWlanEvent->EventData.
                       STAandP2PModeWlanConnected.ssid_name,
                       pWlanEvent->EventData.STAandP2PModeWlanConnected.ssid_len);
                memcpy(g_ucConnectionBSSID,
                       pWlanEvent->EventData.STAandP2PModeWlanConnected.bssid,
                       SL_BSSID_LENGTH);
    
                UART_PRINT("[WLAN EVENT] STA Connected to the AP: %s , "
                           "BSSID: %x:%x:%x:%x:%x:%x\n\r",
                          g_ucConnectionSSID,g_ucConnectionBSSID[0],
                          g_ucConnectionBSSID[1],g_ucConnectionBSSID[2],
                          g_ucConnectionBSSID[3],g_ucConnectionBSSID[4],
                          g_ucConnectionBSSID[5]);
            }
            break;
    
            case SL_WLAN_DISCONNECT_EVENT:
            {
                slWlanConnectAsyncResponse_t*  pEventData = NULL;
    
                CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION);
                CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED);
    
                pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected;
    
                // If the user has initiated 'Disconnect' request,
                //'reason_code' is SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION
                if(SL_WLAN_DISCONNECT_USER_INITIATED_DISCONNECTION == pEventData->reason_code)
                {
                    UART_PRINT("[WLAN EVENT]Device disconnected from the AP: %s, "
                               "BSSID: %x:%x:%x:%x:%x:%x on application's "
                               "request \n\r",
                               g_ucConnectionSSID,g_ucConnectionBSSID[0],
                               g_ucConnectionBSSID[1],g_ucConnectionBSSID[2],
                               g_ucConnectionBSSID[3],g_ucConnectionBSSID[4],
                               g_ucConnectionBSSID[5]);
                }
                else
                {
                    UART_PRINT("[WLAN ERROR]Device disconnected from the AP AP: %s, "
                               "BSSID: %x:%x:%x:%x:%x:%x on an ERROR..!! \n\r",
                               g_ucConnectionSSID,g_ucConnectionBSSID[0],
                               g_ucConnectionBSSID[1],g_ucConnectionBSSID[2],
                               g_ucConnectionBSSID[3],g_ucConnectionBSSID[4],
                               g_ucConnectionBSSID[5]);
                }
                memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID));
                memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID));
            }
            break;
    
            case SL_WLAN_STA_CONNECTED_EVENT:
            {
            	// when device is in AP mode and any client connects to device cc3xxx
            	SET_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION);
            	CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION_FAILED);
    
            	//
            	// Information about the connected client (like SSID, MAC etc) will
            	// be available in 'slPeerInfoAsyncResponse_t' - Applications
            	// can use it if required
            	//
            	// slPeerInfoAsyncResponse_t *pEventData = NULL;
            	// pEventData = &pSlWlanEvent->EventData.APModeStaConnected;
            	//
    
            }
            break;
    
            case SL_WLAN_STA_DISCONNECTED_EVENT:
            {
            	// when client disconnects from device (AP)
            	CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION);
            	CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_LEASED);
    
            	//
            	// Information about the connected client (like SSID, MAC etc) will
            	// be available in 'slPeerInfoAsyncResponse_t' - Applications
            	// can use it if required
            	//
            	// slPeerInfoAsyncResponse_t *pEventData = NULL;
            	// pEventData = &pSlWlanEvent->EventData.APModestaDisconnected;
            	//
            }
            break;
    
    
            default:
            {
            	UART_PRINT("[WLAN EVENT] Unexpected event [0x%x]\n\r",
            			pWlanEvent->Event);
            }
            break;
        }
    }
    
    //*****************************************************************************
    //
    //! \brief This function handles network events such as IP acquisition, IP
    //!           leased, IP released etc.
    //!
    //! \param[in]  pNetAppEvent - Pointer to NetApp Event Info
    //!
    //! \return None
    //!
    //*****************************************************************************
    void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
    {
        if(!pNetAppEvent)
        {
            return;
        }
    
        switch(pNetAppEvent->Event)
        {
            case SL_NETAPP_IPV4_IPACQUIRED_EVENT:
            {
                SlIpV4AcquiredAsync_t *pEventData = NULL;
    
                SET_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED);
    
                //Ip Acquired Event Data
                pEventData = &pNetAppEvent->EventData.ipAcquiredV4;
    
                //Gateway IP address
                g_ulGatewayIP = pEventData->gateway;
    
                UART_PRINT("[NETAPP EVENT] IP Acquired: IP=%d.%d.%d.%d , "
                           "Gateway=%d.%d.%d.%d\n\r",
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,3),
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,2),
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,1),
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,0),
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,3),
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,2),
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,1),
                SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,0));
            }
            break;
            case SL_NETAPP_IP_LEASED_EVENT:
            {
            	SET_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_LEASED);
            	//UART_PRINT("[NETAPP EVENT] IP leased to a client\n\r");
    
            	//
            	// Information about the IP-Leased details(like IP-Leased,lease-time,
            	// mac etc) will be available in 'SlIpLeasedAsync_t' - Applications
            	// can use it if required
            	//
            	// SlIpLeasedAsync_t *pEventData = NULL;
            	// pEventData = &pNetAppEvent->EventData.ipLeased;
            	//
    
            	SlIpLeasedAsync_t *pEventData = NULL;
            	pEventData = &pNetAppEvent->EventData.ipLeased;
            	g_ulStaIp = pEventData->ip_address;
            	UART_PRINT("[NETAPP EVENT] IP Leased to Client: IP=%d.%d.%d.%d \n\r",
            	                        SL_IPV4_BYTE(g_ulStaIp,3), SL_IPV4_BYTE(g_ulStaIp,2),
            	                        SL_IPV4_BYTE(g_ulStaIp,1), SL_IPV4_BYTE(g_ulStaIp,0));
            }
            break;
    
            case SL_NETAPP_IP_RELEASED_EVENT:
            {
            	CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_LEASED);
            	UART_PRINT("[NETAPP EVENT] IP Released for Client: IP=%d.%d.%d.%d \n\r",
            	                        SL_IPV4_BYTE(g_ulStaIp,3), SL_IPV4_BYTE(g_ulStaIp,2),
            	                        SL_IPV4_BYTE(g_ulStaIp,1), SL_IPV4_BYTE(g_ulStaIp,0));
    
            	//
            	// Information about the IP-Released details (like IP-address, mac
            	// etc) will be available in 'SlIpReleasedAsync_t' - Applications
            	// can use it if required
            	//
            	// SlIpReleasedAsync_t *pEventData = NULL;
            	// pEventData = &pNetAppEvent->EventData.ipReleased;
            	//
            }
            break;
    
            default:
            {
                UART_PRINT("[NETAPP EVENT] Unexpected event [0x%x] \n\r",
                           pNetAppEvent->Event);
            }
            break;
        }
    }
    
    
    //*****************************************************************************
    //
    //! \brief This function handles HTTP server events
    //!
    //! \param[in]  pServerEvent - Contains the relevant event information
    //! \param[in]    pServerResponse - Should be filled by the user with the
    //!                                      relevant response information
    //!
    //! \return None
    //!
    //****************************************************************************
    void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent,
                                      SlHttpServerResponse_t *pHttpResponse)
    {
        // Unused in this application
    }
    
    //*****************************************************************************
    //
    //! \brief This function handles General Events
    //!
    //! \param[in]     pDevEvent - Pointer to General Event Info
    //!
    //! \return None
    //!
    //*****************************************************************************
    void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent)
    {
        if(!pDevEvent)
        {
            return;
        }
    
        //
        // Most of the general errors are not FATAL are are to be handled
        // appropriately by the application
        //
        UART_PRINT("[GENERAL EVENT] - ID=[%d] Sender=[%d]\n\n",
                   pDevEvent->EventData.deviceEvent.status,
                   pDevEvent->EventData.deviceEvent.sender);
    }
    
    
    //*****************************************************************************
    //
    //! This function handles socket events indication
    //!
    //! \param[in]      pSock - Pointer to Socket Event Info
    //!
    //! \return None
    //!
    //*****************************************************************************
    void SimpleLinkSockEventHandler(SlSockEvent_t *pSock)
    {
        if(!pSock)
        {
            return;
        }
    
        //
        // This application doesn't work w/ socket - Events are not expected
        //
        switch( pSock->Event )
        {
            case SL_SOCKET_TX_FAILED_EVENT:
                switch( pSock->socketAsyncEvent.SockTxFailData.status)
                {
                    case SL_ECLOSE: 
                        UART_PRINT("[SOCK ERROR] - close socket (%d) operation "
                                    "failed to transmit all queued packets\n\n", 
                                        pSock->socketAsyncEvent.SockTxFailData.sd);
                        break;
                    default: 
                        UART_PRINT("[SOCK ERROR] - TX FAILED  :  socket %d , reason "
                                    "(%d) \n\n",
                                    pSock->socketAsyncEvent.SockTxFailData.sd, pSock->socketAsyncEvent.SockTxFailData.status);
                      break;
                }
                break;
    
            default:
            	UART_PRINT("[SOCK EVENT] - Unexpected Event [%x0x]\n\n",pSock->Event);
              break;
        }
    }
    
    
    //*****************************************************************************
    // SimpleLink Asynchronous Event Handlers -- End
    //*****************************************************************************
    
    void generalTimeoutHandler(void)
    {
        Timer_IF_InterruptClear(TIMERA1_BASE);
        g_TimerBTimedOut++;
    }
    
    // General waiting function using timer
    void waitmSec(_i32 timeout)
    {
        //Initializes & Starts timer
        Timer_IF_Init(PRCM_TIMERA1, TIMERA1_BASE, TIMER_CFG_ONE_SHOT, TIMER_A, 0);
        Timer_IF_IntSetup(TIMERA1_BASE, TIMER_A, generalTimeoutHandler);
    
        g_TimerBTimedOut = 0;
    
        Timer_IF_Start(TIMERA1_BASE, TIMER_A, timeout);
    
        while(g_TimerBTimedOut != 1)
        {
            // waiting...
    #ifndef SL_PLATFORM_MULTI_THREADED
            _SlNonOsMainLoopTask();
    #endif
        }
    
        //Stops timer
        Timer_IF_Stop(TIMERA1_BASE, TIMER_A);
        Timer_IF_DeInit(TIMERA1_BASE, TIMER_A);
    }
    
    void timeoutHandler(void)
    {
        Timer_IF_InterruptClear(TIMERA0_BASE);
        g_TimerATimedOut++;
    }
    
    //*****************************************************************************
    // Provisioning Callbacks
    //*****************************************************************************
    _i8 sl_extlib_ProvEventTimeoutHdl(_u8* event, _i32 timeout)
    {
        if(timeout == SL_EXT_PROV_WAIT_FOREVER)
        {
            // Waiting forever, no timeout
            while(*event == FALSE)
            {
                // waiting...
    #ifndef SL_PLATFORM_MULTI_THREADED
                _SlNonOsMainLoopTask();
    #endif
            }
        }
        else
        {
        	//On CC3200, a value greater than 53687 will overflow the buffer,
    		//therefore divide the timeout into smaller pieces.
    		int divider = 10;
    
    		//Initializes & Starts timer
    		Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_PERIODIC, TIMER_A, 0);
    		Timer_IF_IntSetup(TIMERA0_BASE, TIMER_A, timeoutHandler);
    
    		g_TimerATimedOut = 0;
    
    		Timer_IF_Start(TIMERA0_BASE, TIMER_A, timeout/divider);
    
            //Check event or wait until timeout
            while(*event == FALSE && g_TimerATimedOut != divider)
            {
                // waiting...
    #ifndef SL_PLATFORM_MULTI_THREADED
                _SlNonOsMainLoopTask();
    #endif
            }
    
            //Stops timer
    		Timer_IF_Stop(TIMERA0_BASE, PRCM_TIMERA0);
    		Timer_IF_DeInit(TIMERA0_BASE, PRCM_TIMERA0);
    
    		// check if timeout occured
    		if(g_TimerATimedOut == divider)
    		{
    			return -1;
    		}
    
        }
    
    
        return 0;
    }
    
    void sl_extlib_ProvWaitHdl(_i32 timeout)
    {
        waitmSec(timeout);
    }
    
    
    //*****************************************************************************
    //
    //! \brief This function initializes the application variables
    //!
    //! \param    None
    //!
    //! \return None
    //!
    //*****************************************************************************
    static void InitializeAppVariables()
    {
        g_ulStatus = 0;
        g_ulGatewayIP = 0;
        g_ulStaIp = 0;
        //g_ConnectTimeoutCnt = 0;
        memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID));
        memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID));
    }
    
    //*****************************************************************************
    //! \brief This function puts the device in its default state. It:
    //!           - Set the mode to STATION
    //!           - Configures connection policy to Auto and AutoSmartConfig
    //!           - Deletes all the stored profiles
    //!           - Enables DHCP
    //!           - Disables Scan policy
    //!           - Sets Tx power to maximum
    //!           - Sets power policy to normal
    //!           - Unregister mDNS services
    //!           - Remove all filters
    //!
    //! \param   none
    //! \return  On success, zero is returned. On error, negative is returned
    //*****************************************************************************
    static long ConfigureSimpleLinkToDefaultState()
    {
        SlVersionFull   ver = {0};
        _WlanRxFilterOperationCommandBuff_t  RxFilterIdMask = {0};
    
        unsigned char ucVal = 1;
        unsigned char ucConfigOpt = 0;
        unsigned char ucConfigLen = 0;
        unsigned char ucPower = 0;
    
        long lRetVal = -1;
        long lMode = -1;
    
        lMode = sl_Start(0, 0, 0);
        ASSERT_ON_ERROR(lMode);
    
        // If the device is not in station-mode, try configuring it in station-mode 
        if (ROLE_STA != lMode)
        {
            if (ROLE_AP == lMode)
            {
                // If the device is in AP mode, we need to wait for this event 
                // before doing anything 
                while(!IS_IP_ACQUIRED(g_ulStatus))
                {
    #ifndef SL_PLATFORM_MULTI_THREADED
                  _SlNonOsMainLoopTask(); 
    #endif
                }
            }
    
            // Switch to STA role and restart 
            lRetVal = sl_WlanSetMode(ROLE_STA);
            ASSERT_ON_ERROR(lRetVal);
    
            lRetVal = sl_Stop(0xFF);
            ASSERT_ON_ERROR(lRetVal);
    
            lRetVal = sl_Start(0, 0, 0);
            ASSERT_ON_ERROR(lRetVal);
    
            // Check if the device is in station again 
            if (ROLE_STA != lRetVal)
            {
                // We don't want to proceed if the device is not coming up in STA-mode 
                return DEVICE_NOT_IN_STATION_MODE;
            }
        }
        
        // Get the device's version-information
        ucConfigOpt = SL_DEVICE_GENERAL_VERSION;
        ucConfigLen = sizeof(ver);
        lRetVal = sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &ucConfigOpt, 
                                    &ucConfigLen, (unsigned char *)(&ver));
        ASSERT_ON_ERROR(lRetVal);
        
        UART_PRINT("Host Driver Version: %s\n\r",SL_DRIVER_VERSION);
        UART_PRINT("Build Version %d.%d.%d.%d.31.%d.%d.%d.%d.%d.%d.%d.%d\n\r",
        ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
        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]);
    
        // Set connection policy to Auto + SmartConfig 
        //      (Device's default connection policy)
        lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION, 
                                    SL_CONNECTION_POLICY(1, 0, 0, 0, 1), NULL, 0);
        ASSERT_ON_ERROR(lRetVal);
    
        // Remove all profiles
        lRetVal = sl_WlanProfileDel(0xFF);
        ASSERT_ON_ERROR(lRetVal);
    
        
    
        //
        // 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
        //
        lRetVal = sl_WlanDisconnect();
        if(0 == lRetVal)
        {
            // Wait
            while(IS_CONNECTED(g_ulStatus))
            {
    #ifndef SL_PLATFORM_MULTI_THREADED
                  _SlNonOsMainLoopTask(); 
    #endif
            }
        }
    
        // Enable DHCP client
        lRetVal = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,1,1,&ucVal);
        ASSERT_ON_ERROR(lRetVal);
    
        // Disable scan
        ucConfigOpt = SL_SCAN_POLICY(0);
        lRetVal = sl_WlanPolicySet(SL_POLICY_SCAN , ucConfigOpt, NULL, 0);
        ASSERT_ON_ERROR(lRetVal);
    
        // Set Tx power level for station mode
        // Number between 0-15, as dB offset from max power - 0 will set max power
        ucPower = 0;
        lRetVal = sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, 
                WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (unsigned char *)&ucPower);
        ASSERT_ON_ERROR(lRetVal);
    
        // Set PM policy to normal
        lRetVal = sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL, 0);
        ASSERT_ON_ERROR(lRetVal);
    
        // Unregister mDNS services
        lRetVal = sl_NetAppMDNSUnRegisterService(0, 0);
        ASSERT_ON_ERROR(lRetVal);
    
        // Remove  all 64 filters (8*8)
        memset(RxFilterIdMask.FilterIdMask, 0xFF, 8);
        lRetVal = sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (_u8 *)&RxFilterIdMask,
                           sizeof(_WlanRxFilterOperationCommandBuff_t));
        ASSERT_ON_ERROR(lRetVal);
    
        lRetVal = sl_Stop(SL_STOP_TIMEOUT);
        ASSERT_ON_ERROR(lRetVal);
    
        InitializeAppVariables();
        
        return lRetVal; // Success
    }
    
    //*****************************************************************************
    //
    //! Application startup display on UART
    //!
    //! \param  none
    //!
    //! \return none
    //!
    //*****************************************************************************
    static void
    DisplayBanner(char * AppName)
    {
        Report("\n\n\n\r");
        Report("\t\t *************************************************\n\r");
        Report("\t\t       CC3200 %s Application       \n\r", AppName);
        Report("\t\t *************************************************\n\r");
        Report("\n\n\n\r");
    }
    
    //*****************************************************************************
    //
    //! Board Initialization & Configuration
    //!
    //! \param  None
    //!
    //! \return None
    //
    //*****************************************************************************
    static void
    BoardInit(void)
    {
    	// In case of TI-RTOS vector table is initialize by OS itself
    #ifndef USE_TIRTOS
        //
        // Set vector table base
        //
    #if defined(ccs)
        MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
    #endif
    #if defined(ewarm)
        MAP_IntVTableBaseSet((unsigned long)&__vector_table);
    #endif
    #endif
        //
        // Enable Processor
        //
        MAP_IntMasterEnable();
        MAP_IntEnable(FAULT_SYSTICK);
    
        PRCMCC3200MCUInit();
    }
    
    //*****************************************************************************
    //
    //! \brief Function for handling provisioning (adding a profile to a new AP).
    //!
    //! This function assumes running mostly on first time configurations, so
    //! one time settings are handled here.
    //!
    //! \param[in]		None
    //!
    //! \return         None
    //!
    //*****************************************************************************
    int startProvisioning(void)
    {
    	long				lRetVal = -1;
    	long 				FileHandle = 0;
    	slExtLibProvCfg_t	cfg;
    	SlFsFileInfo_t 		FsFileInfo;
    
    
    	UART_PRINT("Starting Provisioning..\n\r");
    
    
    	// Enable RX Statistics
    	sl_WlanRxStatStart();
    
    	// Check if version token file exists in the device FS.
    	// If not, than create a file and write the required token
    
    	// Creating the param_product_version.txt file once
    	if (SL_FS_ERR_FILE_NOT_EXISTS == sl_FsGetInfo(SL_FILE_PARAM_PRODUCT_VERSION, 0 , &FsFileInfo))
    	{
    		sl_FsOpen(SL_FILE_PARAM_PRODUCT_VERSION, FS_MODE_OPEN_CREATE(100, _FS_FILE_OPEN_FLAG_COMMIT), NULL, &FileHandle);
    		sl_FsWrite(FileHandle, NULL, SL_PARAM_PRODUCT_VERSION_DATA, strlen(SL_PARAM_PRODUCT_VERSION_DATA));
    		sl_FsClose(FileHandle, NULL, NULL, NULL);
    	}
    
    	// Creating the config result file once
    	if (SL_FS_ERR_FILE_NOT_EXISTS == sl_FsGetInfo(SL_FILE_PARAM_CFG_RESULT, 0 , &FsFileInfo))
    	{
    		sl_FsOpen(SL_FILE_PARAM_CFG_RESULT, FS_MODE_OPEN_CREATE(100, _FS_FILE_OPEN_FLAG_COMMIT), NULL, &FileHandle);
    		sl_FsWrite(FileHandle, NULL, GET_CFG_RESULT_TOKEN, strlen(GET_CFG_RESULT_TOKEN));
    		sl_FsClose(FileHandle, NULL, NULL, NULL);
    	}
    
    	// Creating the param device name file once/
    	if (SL_FS_ERR_FILE_NOT_EXISTS == sl_FsGetInfo(SL_FILE_PARAM_DEVICE_NAME, 0 , &FsFileInfo))
    	{
    		sl_FsOpen(SL_FILE_PARAM_DEVICE_NAME, FS_MODE_OPEN_CREATE(100, _FS_FILE_OPEN_FLAG_COMMIT), NULL, &FileHandle);
    		sl_FsWrite(FileHandle, NULL, GET_DEVICE_NAME_TOKEN, strlen(GET_DEVICE_NAME_TOKEN));
    		sl_FsClose(FileHandle, NULL, NULL, NULL);
    	}
    
    	// Creating the netlist name file once/
    	if (SL_FS_ERR_FILE_NOT_EXISTS == sl_FsGetInfo(SL_FILE_NETLIST, 0 , &FsFileInfo))
    	{
    		sl_FsOpen(SL_FILE_NETLIST, FS_MODE_OPEN_CREATE(100, _FS_FILE_OPEN_FLAG_COMMIT), NULL, &FileHandle);
    		sl_FsWrite(FileHandle, NULL, SL_SET_NETLIST_TOKENS, strlen(SL_SET_NETLIST_TOKENS));
    		sl_FsClose(FileHandle, NULL, NULL, NULL);
    	}
    
    	// Initializes configuration
    	cfg.IsBlocking         = 1;    //Unused
    	cfg.AutoStartEnabled   = 0;
    	cfg.Timeout10Secs      = PROVISIONING_TIMEOUT/10;
    	cfg.ModeAfterFailure   = ROLE_STA;
    	cfg.ModeAfterTimeout   = ROLE_STA;
    
    	lRetVal = sl_extlib_ProvisioningStart(ROLE_STA, &cfg);
    	ASSERT_ON_ERROR(lRetVal);
    
    	// Wait for WLAN Event
    	while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
    	{
            // waiting...
    #ifndef SL_PLATFORM_MULTI_THREADED
            _SlNonOsMainLoopTask();
    #endif
    	}
    
    	//
    	// Turn ON the RED LED to indicate connection success
    	//
    	GPIO_IF_LedOn(MCU_RED_LED_GPIO);
    
    	//wait for few moments
    	MAP_UtilsDelay(80000000);
    
    	return SUCCESS;
    }
    
    static void SimpleEmail(void *pvParameters)
    {
        long lRetVal = -1;
        //
          // Following function configure the device to default state by cleaning
          // the persistent settings stored in NVMEM (viz. connection profiles &
          // policies, power policy etc)
          //
          // Applications may choose to skip this step if the developer is sure
          // that the device is in its default state at start of applicaton
          //
          // Note that all profiles and persistent settings that were done on the
          // device will be lost
          //
          lRetVal = ConfigureSimpleLinkToDefaultState();
          if(lRetVal < 0)
          {
              if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
                  UART_PRINT("Failed to configure the device in its "
                                "default state \n\r");
    
              LOOP_FOREVER();
          }
    
          UART_PRINT("Device is configured in default state \n\r");
    
          CLR_STATUS_BIT_ALL(g_ulStatus);
    
          //Start simplelink
          lRetVal = sl_Start(0,0,0);
          if (lRetVal < 0 || ROLE_STA != lRetVal)
          {
              UART_PRINT("Failed to start the device \n\r");
              LOOP_FOREVER();
          }
    
          UART_PRINT("Device started as STATION \n\r");
    
          // Connect to our AP using SmartConfig method
          lRetVal = startProvisioning();
          if(lRetVal < 0)
          {
              ERR_PRINT(lRetVal);
          }
          else
          {
              UART_PRINT("Provisioning Succedded \n\r");
          }
    
          LOOP_FOREVER();
    }
    
    
    int main(void)
    {
        long lRetVal = -1;
        //
        // Initialize Board configurations
        //
    
        BoardInit();
        //
        // Configure the pinmux settings for the peripherals exercised
        //
        PinMuxConfig();
    
    #ifndef NOTERM
        InitTerm();
    #endif
    
        //
    	// Display banner
    	//
    	DisplayBanner(APPLICATION_NAME);
    
        // configure RED LED
        GPIO_IF_LedConfigure(LED1);
    
        GPIO_IF_LedOff(MCU_RED_LED_GPIO);
    
        InitializeAppVariables();
    
        //
        // Simplelinkspawntask
        //
        lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
        if(lRetVal < 0)
        {
            ERR_PRINT(lRetVal);
            LOOP_FOREVER();
        }
    
        lRetVal = osi_TaskCreate(SimpleEmail, (signed char*)"SimpleEmail", \
                                        OSI_STACK_SIZE, \
                                        NULL, TASK_PRIORITY+1, NULL );
        if(lRetVal < 0)
        {
            ERR_PRINT(lRetVal);
            LOOP_FOREVER();
        }
    
        osi_start();
    
        while(1)
        {
    
        }
    
    
    }
    

    Jesu

  • Hello again,

    I did some testing with this. You had slightly modified the contents in network_if.h. Seems i also need to remove network_common.c from the project.

    However even in the project you exactly described me, process goes as you show but throws error [-76] after provisioning succeeds. This is what my mqtt project shows after provisioning succeeds:

    I found this thread which says to not use provisioning when already connected. I made sure for this by formatting the flash before i run the code and also modifying provisioningStart:

    if(!IS_CONNECTED(g_ulStatus)){
        lRetVal = sl_extlib_ProvisioningStart(ROLE_STA, &cfg);
        ASSERT_ON_ERROR(lRetVal);
    }

    However this didn't help,even though i now made sure to not be connected. Also tried setting different connection policies.

    Thank you for the help and i know this isn't your fault,but this is getting frustrating, I just think i will start it in AP and just use my phone to send a JSON with a key and the credentials. Seems simple to provision like that.

  • Hi Alex,

    I'm not sure what you are doing that is causing the -76 error. I searched in the SDK and this is the error code: SL_ERROR_WLAN_DRV_START_FAIL.

    You may have to make additional considerations for your custom application to make everything work smoothly. Perhaps try disabling your connection policy before starting provisioning. Also, if you start provisioning don't create or have any other task running. It is best to let that run to completion before starting up the rest of your application. It is makes it easier for debugging because you build your application incrementally. 

    I'm not sure what else to suggest here but I'm glad you finally got provisioning to work. 

    Jesu

  • Hey jesu. This is not only happening to my project,but also to yours. If you let it run further down you will see it throws this error. Anyway i set the connection policy in ConfigureSimpleLinkToDefaultState() to

        lRetVal = sl_WlanPolicySet(SL_POLICY_CONNECTION,
                                    SL_CONNECTION_POLICY(0, 0, 0, 0, 0), NULL, 0);

    but no effect.

  • Hey Alex, 

    You are saying my example code also reproduces this error? All I'm doing is provisioning. Once that finishes I just let it sit there. Do I have to do anything else to reproduce this error?

    Jesu