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.

CC3220: Web Server based on OOB example

Part Number: CC3220

Hi,

as far as I know it it not possible to use the NWP HTTP web server to access files on SD card.
So I have to use my own HTTP web server.

My starting point is the OOB example.
This app is already modified to work as AP on my own hardware (CC3220MODASF).

Some questions:
1) Where is the correct point in source code of OOB to disable the NWP HTTP server?
2) Where is the correct point in source code of OOB to set a listing socket and accept incoming conniction for my own HTTP web server?

Regards
Jörg

  • Hi Jörg,

    The internal http server is enabled by default.

    See section 8.3 "Configurations and Settings" of http://www.ti.com/lit/swru455. See the rest of section 8 for everything else on the internal HTTP server.

    Hope this helps,
    Kevin
  • Hi Kevin,

    I know the functionality of the NWP web server and also how to disable it. The API documentation does not help at that point.

    Please read my questions above.

    Regards
    Jörg

  • This standard docs do not answer the given questions.
  • Hi Jörg,

    1. I don't think the internal HTTP server is stopped in the OOB example and is just left enabled by default. I.E. there is no sl_NetAppStop() call to disable it.

    2. I think the document I linked earlier may have better resources for you than the OOB. The ota_task.c of the OTA sets up a listening socket and accepts a new connection.

    Best,
    Kevin
  • Hi Kevin,

    as far as I understand, the internal NWP HTTP server is also used for provisioning independent if in STA or AP mode.
    Therefore in my app where the CC3220 is used as AP, as long as no connection from a STA is established, the NWP HTTP server must be enabled.
    When the connection is established, I can switch the NWP HTTP server off.

    Is that right?

    Actually to switch the NWP HTTP server off I use the SimpleLinkWlanEventHandler and the SL_WLAN_EVENT_STA_ADDED where I added the sl_NetAppStop(SL_NETAPP_HTTP_SERVER_ID).
    And also in SL_WLAN_EVENT_STA_REMOVED I switch it on again.
    By the way I have limited the maximum STA to 1 that can connect to AP.

    Is that a good solution or is there a better way?

    Regards
    Jörg

  • Hi Jörg,

    The NWP HTTP server is used for AP provisioning. SmartConfig, in which the device is in STA role, does not require the internal HTTP server.

    After provisioning is complete, and you are connected to the AP, there should be no issue disabling the HTTP, assuming you are not using it for anything else.

    I think your solution isn't bad. Though I would not suggest calling the sl_NetAppStop and Start functions within the actual event handlers. It's better to signal an event within the event handler and then handle the stopping/starting within a different function that handles the event. I believe calls to NWP within simpleLink event handlers could cause some issues and even break your program.

    The CC3220 provisioning example within the SDK may give you some insight on how to handle the signaling.

    Best,
    Kevin
  • Hi Kevin,

    ok, I moved the function calls to another thread and signal the STA add and remove to this thread in the event handler only.

    Other questions:
    When STA is connected the first time the event handler SimpleLinkNetAppEventHandler, SL_NETAPP_EVENT_DHCPV4_LEASED is called for getting an IP address from DHCP.
    After this, I disconnect STA from AP and reconnect it again.
    But then this event handler isn't called, because the DHCP already knows the MAC address and therefore has stored the leased IP address in internal table.
    How can I set the behaviour, that every time a STA is connected to AP the DHCP will (re-)assign an IP address, so that the interrupt handler is called every time?

    Why can I create a listening socket only when a STA is connected to AP?
    When no STA is connected I get an error return code.

    Regards
    Jörg

  • Hi Jörg,

    I believe you'd have to release the IP somehow. You're wanting to re-assign the IP just so the event handler would be called again? Are there any other event handlers that trigger upon disconnecting the STA and reconnecting it? I feel like there should be a more practical way of handling this and I'm not sure if the behavior your asking about can be established.

    Regarding the listening socket, are you binding the socket with SL_INADDR_ANY set? I believe this should listen for any IP connected to the server.

    See the following post, it may provide some insight:

    e2e.ti.com/.../625336

    Best,
    Kevin