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.

CC3100BOOST: HTTP client example from sdk; sending repeated requests (1 per min) fails after 8 GET requests

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

Hi. I have a msp430f5529lp and cc3100boost and have modified the http_client example from the cc3100sdk_1.2.0. My app should grab data from a remote server every minute for 1 hr. As is currently set up, it will execute the first 8 GET requests then the call to HTTPCli_connect fails within the call to ConnectToHTTPServer. Monitoring the requests from the server side, I see that there are no more requests made from the cc3100 client (after the 8th) and my router indicates that the device is still attached with an IP. I can change the duration between requests made by the client to every 2 minutes and still only 8 requests are made so this does not appear to be a time out issue.

I have searched the sdk files and see that functions HTTPCli_destruct, delete, disconnect are only found in the netapps/http/client/httpcli.c and .h files so they are not used by the http_client example in the sdk. It doesn't appear that the httpcli struct is ever destroyed.

Below is the overall design of the app in the main func. I have tried other permutations (e.g., where the device is started, connection made with AP before entering the loop) and same issue. My questions are 1) is this the appropriate way to manage requests that are made with this frequency (1 request/minute)? 2) Should I delete and (re)create the httpClient struct each cycle? I'd be happy to post all of the related code if necessary. Thanks for any suggestions!

CODE DESIGN OVERVIEW

configure clocks, etc.

configures the cc3100 device to default state

loop forever

check if minute has elapsed

initialize the 3100 with sl_Start

establish connection with AP

connect to HTTP server

send HTTP GET and process response

stop the 3100 with sl_Stop

  • I should add that all HTTP GET requests are identical.
  • Hi Nick,

    I believe this should resolve if you call HTTPCli_connect only once, but make multiple GET requests

    -Aaron
  • Should have thought more about this. As I said, the sdk example did not use HttpCli_disconnect (actually, I thought that the server would do that). After using the HTTPCli_disconnect and pulling the HTTPCli_construct out of the call to ConnectToHTTPServer, I have a system that repeats the HTTP GET request as long as I need.
    Now, I need to test to see whether I need to reestablish a connection with the AP before running the ConnectToHTTPServer. Any suggestions on how to do that? It appears that there is a GET_STATUS_BIT macro in sl_common.h that I could use. Does anyone have an idea whether I should test for the STATUS_BIT_IP_LEASED bit to be set or would it be better to test for whether the STATUS_BIT_IP_ACQUIRED bit is set? Thanks again!
  • Thanks Aaron. For some reason, calling HTTPCli_connect only once and making multiple GET requests didn't work for me using the http_client example in the platform/msp430f5529lp/example_project_css folder. As I indicated above, this was solved by connecting and disconnecting each time. My question about determining if the connection to the AP had closed (for any reason) by checking the GET_STATUS_BIT still stands and I may post that in a different thread if no one responds, then I'll close this thread by verifying the answer.
  • HI Nick,

    You should be able to check the status bit to determine the state of the connection as long as your event handlers appropriately set it for AP connection, AP disconnection, and IP acquire. STATUS_BIT_IP_ACQUIRED is the correct one to check for connection to an AP.

    -Aaron