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.
Hi,
Our product scheme is that the host computer (including the HTTP client and server) is set up on PC to communicate with CC3220 based on the HTTP protocol for data transmission. The CC3220 contains two main functions: 1. Operating in AP mode to establish an AP signal, 2. Establishing an HTTP client. The PC will connect to the AP signal of CC3220, so both clients and servers are within the same local network for data transmission.
In the CC3220 SDK, only setting up as a STA mode (where CC3220 connects to a mobile hotspot for testing) allows clients to connect to the server successfully. However, if we switch CC3220 to AP mode where the PC connects to this AP signal, the CC3220 client cannot connect to the server. The function HTTPClient_connect returns an error code -2006 (indicating an input parameter error). The HOSTNAME is verified to be correct.
Questions:
Hi Jan,
I directly invoked the function HTTPClient_connect, and the specific location where the error code -2006 occurs is in the function SlNetUtil_getHostByName.
The return value is -2006, and its failure causes subsequent functions like SlNetSock_connectURI to fail with a return value of -2006 as well.
Hi,
Error code -2006 means that input parameter into SlNetUtil_getHostByName() is not correct. If use use debugger and check internal variable domainBuff before you call SlNetUtil_getHostByName() is is set to "10.123.45.2" right? What domain name have you uses with your STA test. It was used IP address like "">http://142.251.36.78" or doamin name like "http://google.com"?
Jan
The value of domainBuff is 10.123.45.2,In STA mode, doamin name was used IP address like "">http://142.251.36.78:8080", Connection successful, as shown in the following image.
The key issue lies here. Both the FAE and I failed with the same test (-2006).
How should the domain name be set correctly?
Hi,
From file /source/ti/net/slnetutils.c it looks your error code is returned because SlNet interface is not set at your case. Please make sure that you SlNet layer is properly initialised (e.g. calling ti_net_SlNet_initConfig() etc.).
Part of SlNetUtil_getHostByName() function where is likely failing your code at AP mode.
/* Search for the highest priority interface according to the ifBitmap and the queryFlags */ netIf = SlNetIf_queryIf(ifBitmap, SLNETIF_QUERY_IF_STATE_BIT | SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT); /* Check if the function returned NULL or the requested interface exists */ if ( (NULL == netIf) || ( NULL == (netIf->ifConf)->utilGetHostByName) ) { /* Interface doesn't exists, return error code */ return SLNETERR_RET_CODE_INVALID_INPUT; }
Jan
Hi Jan
Your guess is correct; in AP mode, the `ti_net_SlNet_initConfig` function does not return a value of 0, but rather -2006, which indicates a failure to initialize SlNetSock. What could be the possible reasons for the failure of this function to execute? I just conducted a test, and in STA mode, even if the `ti_net_SlNet_initConfig` function fails to execute(-2006), it is still possible to successfully connect to the server.
Hi,
Function ti_net_SlNet_initConfig() is generated by Sysconfig, from this reason I am not sure why this is failing at your case.
I don't have much experience with SlNet_ layer and AP mode. Please wait for answer from TI engineer. But I guess you will need to call SlNetIf_init()...
Jan
Hi,
You said that you called SlNetIf_init(), right? but what about SlNetIf_add()? did you call it?
Please see the generated file ti_net_config.c. It contains the relevant code and you should call it from the main.
Regards,
Shlomi
Hi Shlomi
Thanks for your reply!
Yes, I have called the SlNetIf_add() function in the mainthread, and I have confirmed that the SlNetIf_init, SlNetIf_add, and
other functions return a value of 0 (Zero on success, or a negative error code on failure), but the ti_net_SlNet_initConfig
function still returns a value of -2006.
When debugging the file ti.net_config.c, I checked and there do not appear to be any issues with the execution of the
function. The content of the file is as shown in the figure.
Hi,
Hard to tell why it still fails.
Will try to look into it some more and get back to you.
Regards,
Shlomi
Hi,
Getting back here.
Hard to tell what is going on without debugging so I do recommend to go step by step into SlNetIf_queryIf() and check what makes the function return with an error.
Regards,
Shlomi
Hi Shlom,
Thank you very much for your attention to this matter. Your professionalism sets an example for me to follow. Please give me some time to debugging the execution of the function SlNetIf_queryIf(). I will get back to you as soon as I have results.
Thank you again.
Hi Shlomi,
I am not sure if the failure of the ti_net_SlNet_initConfig() function that we previously discussed has any impact, but the following debugging results are based on the premise that it failed to execute.
In AP mode, the SlNetIf_queryIf() function is not executed. The calling relationship of these functions is as shown in the figure.Only the SlNetSock_create() function calls the SlNetIf_queryIf() function. Both the SlNetSock_connectURI() and HTTPClient_connect2() functions call the SlNetSock_create(), but in fact, the SlNetSock_create() function is also not executed due to unmet execution conditions.
Because the STA mode has successfully connected to the server, I didn't carefully examine the execution of internal functions before. However, the recent debugging results show that in STA mode, the SlNetIf_queryIf() function executed successfully, returned the correct value, and was not null.
I guess that we may have identified the reason. The inability to connect to the server in AP mode may be caused by the failure of this series of functions to execute. However, I don't know why the execution conditions for the SlNetSock_create() function are not met in AP mode.This requires further debugging on my part and your support.
The problem we are currently experiencing is easily reproducible, and the FAE has already reproduced it. Whether using our own server or a third-party server, as long as it runs on a PC and the PC connects to the AP signal of the CC3220 within a local network, the problem of the client cannot connect to the server will occur. I also have a LaunchPad with the model number LAUNCHCC3235MOD, and it exhibits the same issue.
Hi,
I will need to dig into the code to understand more.
It might be though that it was not tested/supported for AP role but I need to check.
Regards,
Shlomi
Hi Shlomi,
Thank you again for your attention to this matter. I'll wait for your reply. if there is anything further
we can provide to assist in your investigation, please let us know. Your conclusions and
suggestions are very important to me.
Hi,
I understand. Just to set the expectation, since it requires me to build a setup and test, it is not an immediate task I can pull off.
It would require some time.
Regards,
Shlomi