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: Help with AP Provisioning confirmation (and simplelink starter pro app)

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

HI all, I have a Launchpad LAUNCH-CC3220MODASF loaded with the FreeRTOS/CCS Provisioning example.  I am using sp_3.9.0.6_2.0.0.0_2.2.0.6

When I start the launchpad, i get this on the terminal:

==================================
Provisioning Example Ver. 01.00.00.14
==================================

CHIP 0x31000019
MAC 31.2.0.0.0
PHY 2.2.0.6
NWP 3.9.0.6
ROM 0
HOST 3.0.1.41
MAC address: 50:f1:4a:61:48:e8


Starting Provisioning! mode=2 (0-AP, 1-SC, 2-AP+SC, 3-AP+SC+EXT)

so far, so good.  I open a browser on my android tablet (Android 7.1.1) and browse to 10.123.45.1/index.html  

I go to the "Profiles" tab, and enter the SSID and password for my network.  I get this on the terminal:

 [Provisioning] Profile Added: SSID: RND_EE

Now, in the browser, I tap the "confirm" button.  I get this on the terminal:

[Provisioning] Profile confirmation: WLAN Connected!
[Provisioning] Profile confirmation: IP Acquired!

Sweet.  The device connects to the SSID, and I can connect to it at 192.168.1.100 -- so that's happy.  But after a bit, the device times out and I see this on the terminal:

 [Provisioning] Profile Confirmation failed (Connection Success, feedback to Smartphone app failed)

the simplelink app "sees" the device on my network, but it just opens index.html on the device.  so it doesn't seem to be doing anything fancy.

According the programmer's guide, SWRU455G, Section 16.8, "Delivering Feedback to the User", page 239:

"To get the confirmation result, the smartphone app may disconnect from the configured wireless network and try to directly connect the SimpleLink device AP (possible only if AP-provisioning or AP+SC-provisioning configuration modes are used). If the smartphone app was able to connect to the SimpleLink AP, it sends an HTTP GET request to the device internal HTTP server, to retrieve the confirmation result.

So how to to send the confirmation?

I started at section 9.4.6, "Provisioning Confirmation" on 163 of SWRU55G:

 

Posts to /api/1/wlan/en_ap_scan/confirm_req are handled as described in Chapter 16.

 but I get a 404 when I try to post to that url.  Looking at he index.html page's "confirm" button tries to send a GET to http://10.123.45.1/api/1/wlan/confirm_req

(by the way, my browser is telling me that it can't find user.js (gets a 404) -- perhaps this is a problem?)

I tried this from the command line (using httpie):

$ http -v GET 192.168.1.100/api/1/wlan/confirm_req

but I get a 404:

GET /api/1/wlan/confirm_req HTTP/1.1

Accept: */*

Accept-Encoding: gzip, deflate

Connection: keep-alive

Host: 192.168.1.100

User-Agent: HTTPie/1.0.2

HTTP/1.0 404 Not Found

on the other hand, in SWRU472, section 7.2 "Android AP Provisioning Mode", page 18, I find the following:

After finding the IP address of the new device, the getCGFResultFromDevice API should be activated to fetch the result and indicate that provisioning is done.

ok, so in the android source code of the android app, i navigate to getCGFResultFromDevice:

I see this line (line 1083 in NetworkUtil.java):

url += "/__SL_G_MCR";

and a little below on line 1108:
HttpGet cfgResult = new HttpGet(url);

so, it appears it's attempting to do a GET 10.123.45.1/__SL_G_MCR

I don't think this is what I'm looking for, because in table 9-19, section 9.5.8, page 170 of SWRU455G, I find this description of the __SL_G_MCR token:

Returns a number code of the provisioning status

But wait, section 2.2.4, "Step 4: Connecting to the DEvice and Getting Feedback" on page 5 of SWRU472 has the following:

 

The final step is to check if the device completed provisioning successfully. This is done by sending a query from the mobile app to the device, asking for the provisioning results.

aaah, so the /api/1/wlan/en_ap_scan/confirm_req API initiates the process -- and triggers the NWP to connect to the SSID.  unfortunately, that same doc (SWRU472) only has detailed instructions for the smart config process and not the AP process, so I have no idea if I'm missing a step.

any help is appreciated.

  • ok, I think I answered my own question in that post, but I figured it might be helpful to someone else. The answer is yes, you need to GET 10.123.45.1/__SL_G_MCR


    $ http -v GET 192.168.1.100/__SL_G_MCR
    GET /__SL_G_MCR HTTP/1.1
    Accept: */*
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Host: 192.168.1.100
    User-Agent: HTTPie/1.0.2



    HTTP/1.0 200 OK
    Content-Length: 1
    Content-Type: text/plain
    Server: WebServer V1.0

    5


    and the device carries on happily . . .
  • . . . . although, instructions (or a link) on how to do this with the starter pro app would be nice :)
  • Hi Christopher,

    Thanks for posting your solution!

    Have you found the Wi-Fi Starter Pro Android source already? That should have the Android implemetation for both SmartConfig and AP Provisioning: www.ti.com/.../wifistarterpro


    From your last comment, do you mean you'd like more information on provisioning using the Wi-Fi Starter Pro app? SimpleLink Academy has a good training on the provisioning process: dev.ti.com/.../

    Best regards,
    Sarah

  • Hi Sarah, thanks for the reply. I do have the Android Wi-Fi Starter Pro app source. In fact, that's where I found this (from my original post):

    "so in the android source code of the android app, i navigate to getCGFResultFromDevice:"

    which put me down the path to figuring out that you need to submit a "GET 192.168.1.100/__SL_G_MCR" to confirm the processing.

    I have indeed checked out the tutorials. But if you look at the provisioning how-to (see link below), you'll see that it covers smart-config process only, and not the AP process. So this leaves two questions in the head of the poor developer who is trying to ship product within a 3 month schedule!

    1. how to use the smart-connect app in APP mode (I still am not sure how to make it work)
    2. what is the technical requirement to successfully complete the AP provisioning process successfully

    I was able to figure out 2 on my own, but it would be nice if the tutorial had a step-by-step to show how the AP process works; and, may I suggest, that the excellent XML activity diagrams be annotated (or at least have a companion document) to show the actual signals being transferred.

    for example, in figure 6 in section 8.4, on page 16 of SWRA513A, perhaps annotate "profile added event" to indicate that this is an actual call to SimpleLinkWlanEventHandler() with an SL_WLAN_EVENT_PROVISIONING_PROFILE_ADDED event; and the "confirmation status success event" is triggeredy by the "get confirmation result (HTTP/HTTPS)" with a GET 192.168.1.100/__SL_G_MCR HTTP request.

    anyway, I'm continually impressed with the simplelink platform and team -- just a few suggestions that make help get these into shipping products faster.

    dev.ti.com/.../


    Chris
  • BTW, I just learned that, in the wifi starter pro app, you must disable SmartConfig in the settings menu to use AP mode -- they do not work simultaneously in the app!
  • Also, after all this time, I just learned about this:
    www.ti.com/.../swru368b.pdf
  • Hi Christopher,

    The SimpleLink Academy training does cover AP Provisioning in task 3. Is that useful information on how to work with the mobile app? We can add some additional information about the event handlers to the Provisioning overview at the top of the training.

    Please note that you linked to the guide for the older generation CC3100/CC3200 devices. The NWP Programmer's Guide for CC3220 is: http://www.ti.com/lit/swru455

    If you need help finding something else, you can find all the device documentation in the SDK itself (like the host driver API guide) or on our product pages: www.ti.com/.../technicaldocuments

    Best regards,
    Sarah
  • Sarah, thanks for the clarification. At first glance, I thought the wiki was a reprint of SWRU470, which is what I've mainly been referring to. At second glance I see that it specifically points out to disable smart config in the settings. That is indeed useful information.

    The documentation is quite good -- I wonder if there were a way to build a tool that allows one to enter a use-case, and it would generate steps and documents to look at! It's not just a problem that TI has, btw . . .

    Also, at first glance, I erroneously thought that 3200 was a family of which the 3220 was part of, rather than a distinct part.

    Trying to move quickly and assimilate details are at odds, evidently :(

    Thanks again for your help!
    Chris