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.

CC3200: In AP mode connect with Android Phone, send a POST HTTP request will timeout.

Part Number: CC3200

I have 2 situations for test with the same CC3200 and firmware.

1. CC3200 in AP mode, use HUAWEI Mate 9 (buy from China) to Connect CC3200 AP.

    and send a POST HTTP request after connect success.

    sometime it will response 200, but sometime will no response until timeout.

    If I send request after connect AP 4 seconds, it can get response.

    But after 1 minutes, it still not work.

    If I send request after connect AP N seconds, N isn't 4. it can't get any response. 

2. enable cellular network and connect with CC3200 AP.

    and send a POST HTTP  request after connect success.

    some android phone can get response, ex: ASUS Z017DA.

    but some android phone can't, ex: Sony Galaxy

Is this a compatibility issue?

Or can  I fix them by modifying the firmware parameters?

   

  • Hi Vince,

    For case 1, do you have any sniffer captures you can check to see whether the POST request is arriving at the CC3200 successfully? Also, when there is no response, is there any debug output on the CC3200 side that indicates it received any packets?

    For case 2, something I've observed is that many phones will use the cellular network connection instead of Wi-Fi as the data transport if the Wi-Fi connection has no internet access. When you are connecting to the CC3200, you don't have internet access so that might be why you get no response from the CC3200. Again, try using a Wi-Fi sniffer to see whether the POST request arrives at the CC3200 successfully.

    Let me know of your observations so I can help you debug further.

    Regards,
    Michael
  • Hi Michael:

    For case 1, I use the Packet Capute App install from Google Play store to get HTTP Packets.
    When CC3200 doesn't response, Packet Capute App also can't the response Packets.
    But it can get my HTTP POST request packet.
    And I use the UART to get CC3200's log, it seem to received nothing.
    Where Can I add some log message at firmware with Android phone connect CC3200 AP hand shack?

    For case 2, CC3200 in AP mode has no internet access.
    But as I know Android system will give high priority to Wi-Fi.
    And I use WifiLock to let Android always connect CC3200 AP.
    So Android won't switch to cellular network automatically.
    When CC3200 doesn't response, it also seem to received nothing by log.
    For some Android Phones, it is unreasonable to ask all users to disable cellular network.
    Can I modifying the firmware parameters or profile?

    Thank you for your reply.
  • Hi Michael:

    this is a log for case 1 and no response in the end

    WAIT CONNECT A7 [WLAN EVENT] Station disconnected from


    *************************************************
    CC3200 modbus_http client postoxoxox VER 1.35 20181008 Application
    *************************************************



    ssid :TEST-NB /n/r DEVIEC GUID :001-83ebc29e-8d5f-4ebb-98c7-dc905a3f4ca4 /n/r
    STEP 1 START WIFI
    STEP 3 CHECK GUID STEP 2 CHECK Manufacture DATA ____ Manufacture DATA Fault
    Manufacture DATA OK
    STEP 3 chk guid

    WAIT CONNECT A6
    [NETAPP EVENT] IP Acquired: IP=192.168.1.1 , Gateway=192.168.1.1

    Connect to : 'TEST_WIFI_AP--481444'

    STEP 4 BsdTcpServer
    WAIT CONNECT DELAY 742
    WAIT CONNECT A7 [WLAN EVENT] Station connected to device
    Has Client Connetor 882


    *************************************************
    CC3200 modbus_http client postoxoxox VER 1.35 20181008 Application
    *************************************************



    ssid :TEST-NB /n/r DEVIEC GUID :001-83ebc29e-8d5f-4ebb-98c7-dc905a3f4ca4 /n/r
    STEP 1 START WIFI
    STEP 3 CHECK GUID STEP 2 CHECK Manufacture DATA ____ Manufacture DATA Fault
    Manufacture DATA OK
    STEP 3 chk guid

    WAIT CONNECT A6
    [NETAPP EVENT] IP Acquired: IP=192.168.1.1 , Gateway=192.168.1.1

    Connect to : 'TEST_WIFI_AP--481444'

    STEP 4 BsdTcpServer
    WAIT CONNECT DELAY 1216
    ECT A7 [WLAN EVENT] Station connected to device
    as Client Connetor 91
    WAIT CONNECT A6 SL_NETAPP_IP_LEASED_EVENT
    tcp buffer POST /api/get_all_info HTTP/1.1
    Content-Type: application/json
    User-Agent: Dalvik/2.1.0 (Linux; U; Android 7.0; LON-AL00 Build/HUAWEILON-AL00)
    Host: 192.168.1.1
    Connection: Keep-Alive
    Accept-Encoding: gzip
    Content-Length: 0


    Has Client 2Connetor 2 2282
    OK---:
    tcp buffer POST /api/set_test_mode HTTP/1.1
    Content-Type: application/json
    User-Agent: Dalvik/2.1.0 (Linux; U; Android 7.0; LON-AL00 Build/HUAWEILON-AL00)
    Host: 192.168.1.1
    Connection: Keep-Alive
    Accept-Encoding: gzip
    Content-Length: 0

    send 200 ok data etor 2 1

    OK---:
    tcp buffer POST /api/set_test_mode HTTP/1.1
    Content-Type: application/json
    User-Agent: Dalvik/2.1.0 (Linux; U; Android 7.0; LON-AL00 Build/HUAWEILON-AL00)
    Host: 192.168.1.1
    Connection: Keep-Alive
    Accept-Encoding: gzip
    Content-Length: 0

    send 200 ok data etor 2 1

    OK---:

    Thank you!!!
  • Hi Vince,

    For the case 1 logs that you have above, it seems like the CC3200 does send back some data, specifically a 200 status code message indicating a successful post. So at least in the logs above, the CC3200 managed to get the HTTP post requests. However, you also mention that sometimes the android phone does not get back a response. In those cases, do you not get anything on the logs on the CC3200, or do you see the "send 200 ok data etor 2 1" message on the UART port of the CC3200 but not receive any such message on the android side?

    For case 2, there isn't anything you can modify on the CC3200 to prevent conflicts with the user's cellular network. This is since the phone controls which network is used. While Wi-Fi is supposed to be prioritized, this is sometimes not the case. You'll have to see if there is some API in the android side that can help you either force the Wi-Fi to be used exclusively in your app, or turn off cellular data altogether automatically.

    Regards,
    Michael
  • Hi Michael:

    For case 1, when CC3200 doesn't back response, I don't get anything.

    I have a hypothesis is that some error happen in the HTTP.

    So I get the row data from Socket directly.

    And I can get response every time, I need to analyze row data by myself.

    The row data from log seems to be right. 

    Before I used the HttpURLConnection in Android to send request and get response.

    Now I use the Socket in Android to do.

    It seems to prove that my hypothesis is correct.

    What kind of parameters do I need to set in CC3200?

    Or is it a compatibility issue?

    Thank you!!

  • Hi Vince,

    If you are able to get the expected data when using a raw TCP socket, then it is most likely some issue with how the HTTP request is handled.
    With the CC3200, the internal HTTP server is not configurable, and so if there is something abnormal with the HttpURLConnection API in android then you will not be able to reconfigure the CC3200 HTTP functionality to work around it.

    If there is indeed some incompatibility with the HttpURLConnection API and the internal HTTP server, then there are few things you could try. There is a software HTTP server example within the SDK in the form of the websock_camera example. Perhaps you can take that HTTP server code and run it from within the apps core, and so bypass the internal HTTP server that runs from the NWP. Other than that, you can also try reworking your application so that it uses raw TCP sockets, or avoiding those APIs on android.

    Regards,
    Michael
  • Hi Michael:

    I have use  Socket to read and write data to CC3200.

    Testing for android phone will work well. 

    Just when I am happy that the problem has been solved,

    Testing for Xiaomi android phone will timeout for read data.

    The probability of occurrence is very high.

    Even I already set timeout 10 seconds.

    please help me, are these compatibility issues already relevant?

    Thank you!!!