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.

CC3100SDK: AP - Provisioning

Part Number: CC3100SDK
Other Parts Discussed in Thread: CC3100, CC3200

Hi,

I am trying to bring up the AP-Provisioning feature on CC3100 WiFi device.

I am able to successfully compile my firmware with the provisioning library got from SDK.

After calling the startProvisioning() in my firmware, "SimpleLink Starter Pro" Android APP is able to succesfully check if the device is a simplelink device.

On firmware side the code is able to detect all WiFi nodes (APs) it can see, and puts it in the "g_Networks" variable list. I can see all the SSIDs installed in the office.

The question is, how is this list sent to the APP on my Android mobile phone, so it can display and allow me to select the WiFi network from the list to tell the device know which WiFi network it should connect to.

Is there any async interrupts that is suppose to be generated, if so, at what point?

What are the event handlers and how/where do i register them.

Thanks,

Prem

  • Hi Prem,

    The sl_Provisioning_HttpServerEventHdl() in events_handler.c will get called and send the list of discovered networks. This is based on the reception of user defined GET tokens.

    This will get generated once when you set the device to configure or open up the networks list in the mobile application.

    Best Regards,
    Ben M
  • Hi Ben,

    How does sl_Provisioning_HttpServerEventHdl() really get called? is it suppose to be called based on SPI interrupt generated by CC3100?
    Are we suppose to register this handler any where in the code? if so please let me know where to do this. Right now only the definition of sl_Provisioning_HttpServerEventHdl() function is there, and this function is not called from anywhere in the code.

    Thanks,
    Prem
  • Hi Prem,

    It will be called by the SimpleLink Host Driver in the same way that the application callbacks get called. You do not need to register it in the code yourself, all you need to do is make sure that the following is defined at the top of your user.h:

    #define SL_EXT_LIB_1 sl_Provisioning

    Then rebuild the SimpleLink Host Driver and link it to your application. The actual registration is done in simplelink.h. Note that the sl_Provisioning_HttpServerEventHdl() callback will only run during provisioning, while g_UseProvisioningLibHandlers is set. Otherwise, the event is propagated to the application handlers.


    Best Regards,

    Ben M

  • Hi Ben,

    I am calling sl_Provisioning_HttpServerEventHdl(), sl_Provisioning_WlanEventHdl() and sl_Provisioning_NetAppEventHdl() from within SimpleLinkHttpServerCallback(), SimpleLinkWlanEventHandler() and SimpleLinkNetAppEventHandler() functions respectively.

    This change has made AP-Provisioning work for me.

    You may close this thread.

    Thanks,

    Prem

  • Hi Prem,

    That could be a workaround, but this shouldn't be necessary if the SimpleLink library and provisioning library are re-built with the proper defines and correctly linked to the project. When provisioning is enabled, the provisioning handlers should be called in place of the application callbacks while provisioning is active.

    If you run into any issues with this approach, please consider re-investigating.

    Best Regards,
    Ben M
  • I have the same issue with SDK 1.3. I made the change in user.h, recompiled simplelink (for TI-RTOS), and rebuilt my project. The sl_Provisioning_* event handlers aren't being called, nor can I set breakpoints in them, indicating they aren't being compiled in. Prem's workaround is working for me (except that no HTTP events are flowing in at all), but I'd like to fix this properly. Suggestions welcome.
  • Hi Clinton,

    SDK version 1.3 is out for CC3200. Is that what you are working with? Also, are you working off the default provisioning_ap example or adding AP provisioning to another project?

    Thanks,
    Ben M
  • Hi, Ben. Yes, I'm using SDK 1.3 for CC3200. I did try the provisioning_ap example, which doesn't use TI-RTOS, and while it sort of works, I don't see any events flowing through that either despite enabling debug mode in provisioning_defs.h.

    But I need a TI-RTOS application with AP provisioning, so I started with the empty TI-RTOS example in the SDK and added the provisioning code. With Prem's workaround for the events, I got the output below. Note the absence of HTTP events, which causes the provisioning code to return with a timeout even when a valid profile was entered and a connection made prior to the timeout. I'd rather not have to hack in another workaround!

    Clinton

    Host Driver Version: 1.0.1.11
    Build Version 2.0.7.0.31.0.0.4.1.1.5.3.3
    Starting Provisioning..
    [INFO ProvLib] configuration parameters: auto start enabled 1
    [DEBUG ProvLib] startApProvisioning: starting AP provisioning
    [INFO ProvLib] Device name mysimplelink, default device name F4B85E49A45D@mysimplelink length 25
    [DEBUG ProvLib] networksListScan: scan mode 1 (1 STA, 0 AP)
    [DEBUG ProvLib] provisioningRun: g_libraryTimeout 3000
    [DEBUG ProvLib] provisioningRun: retval -1 g_ucRxTokensBitMask 0x0 g_ucSlEventBitMask 0x0 g_ucProvisioningState 1 g_ NetListHandlingState 1
    [DEBUG ProvLib] Scan complete, got 5 networks
    [DEBUG ProvLib] [0] SSID Tievoli [-80]
    [DEBUG ProvLib] [1] SSID ATT9aMK5ct [-76]
    [DEBUG ProvLib] [2] SSID knight [-72]
    [DEBUG ProvLib] [3] SSID ATT5B7Bck2 [-86]
    [DEBUG ProvLib] [4] SSID camden [-87]
    [DEBUG ProvLib] SetDeviceMode: setting device to 2
    [INFO ProvLib] provisioning_NetAppHdl: IP acquired 0xc0a80101 signalNeeded 0
    [NETAPP EVENT] IP Acquired: IP=192.168.1.1, Gateway=192.168.1.1
    [DEBUG ProvLib] SetDeviceMode: device was set to 2
    [DEBUG ProvLib] continueApProvisioning
    [DEBUG ProvLib] startApProvisioning waiting for user commands for 300000 msecs
    [DEBUG ProvLib] ProvisioningRun() = 2
    [DEBUG ProvLib] provisioningRun: g_libraryTimeout 300000
    [INFO ProvLib] provisioning_WlanEventHdl: STA e0-c7-67-83-1c-98 is connected to SL AP, provisioning TO 300000
    [WLAN EVENT] STA connected to SimpleLink AP
    [DEBUG ProvLib] provisioningRun: retval 0 g_ucRxTokensBitMask 0x0 g_ucSlEventBitMask 0x0 g_ucProvisioningState 1 g_N etListHandlingState 2
    [DEBUG ProvLib] ProvisioningRun() = 2
    [DEBUG ProvLib] provisioningRun: g_libraryTimeout 300000
    [NETAPP EVENT] IP Leased
    [INFO ProvLib] provisioning_WlanEventHdl: STA was disconnected from SL AP
    [WLAN EVENT] Unexpected event [0x6]
    [DEBUG ProvLib] provisioningRun: retval 0 g_ucRxTokensBitMask 0x0 g_ucSlEventBitMask 0x0 g_ucProvisioningState 1 g_N etListHandlingState 2
    [DEBUG ProvLib] ProvisioningRun() = 2
    [DEBUG ProvLib] provisioningRun: g_libraryTimeout 300000
    [DEBUG ProvLib] provisioningRun: retval -1 g_ucRxTokensBitMask 0x0 g_ucSlEventBitMask 0x0 g_ucProvisioningState 1 g_ NetListHandlingState 2
    [DEBUG ProvLib] handleTimeout: timeout on waiting for user commands, switching to mode 0 & exiting
    [DEBUG ProvLib] SetDeviceMode: setting device to 0
    [DEBUG ProvLib] S[INFO ProvLib] provisioning_WlanEventHdl: SL STA is connected to knight
    [WLAN EVENT] STA Connected to the AP: knight, BSSID: 28:cf:da:b9:a8:7b
    etDeviceMode: device was set to 0
    [DEBUG ProvLib] ProvisioningRun() = 3
    Error [-3] at line [618] in function [startProvisioning]
    Error [-3] at line [390] in function [inet_Initialize]
    [NETAPP EVENT] IP Acquired: IP=10.0.1.29, Gateway=10.0.1.1
  • Hi Clinton,

    I recommend first making sure you have the example from the SDK working before moving on. There is no need to put the provisioning handlers inside the application handlers.

    A couple of notes, make sure you have followed all of these steps:

    1. After enabling the the debug by modifying provisioning_defs.h, you need to rebuild the provisioninglib. (Import into workspace and rebuild)
      1. Note - It may import with a slightly wrong include path that causes a build error. Go into the project properties -> include options and change "${PROJECT_LOC}\..\" to "${ORIGINAL_PROJECT_ROOT}\..\"
    2. Please also make sure, after making the change to the user.h file, that you imported and rebuilt the simplelink project for the NON_OS_debug configuration
    3. Next, change the provisioning_ap example to link to the builds of the library in your workspace instead of the default library builds in the SDK
    4. Finally, rebuild the provisioning_ap example

    As long as the device does not have a profile stored, the provisioning will run and allow you to add a new profile.