Hello,
Customer of mine is trying to get the sensor app up and running, can you please offer some assistance here:
I am working with MSP-EXP430FR5739 board and CC3000 WiFi module model TiWi-SL. I am trying to get the Sensor Demo app to work. The problem I am hitting is when the PC (the GUI app) initiates connection, connection never gets established. Network analyzer shows the packets are sent and received back and forth correctly for a short while, but after 2-3 successful SYN packets there is SYN packet sent from the PC to the device, that never gets any response, like it's never received by the device. The behavior does not seem to be always the same, sometimes I think I see data packet (with payload 'DATA' in ASCII) but no response. Sometimes there is a short (<1s) visualization of the blue "moon" in the GUI but it quickly disappears.
DHCP works always, and I can always send data out over UDP in my test app, and sometimes (randomly) I can even establish an outgoing TCP connection, but as soon as I start sending over TCP the MCU starts behaving erratically and I cannot step over machine instructions in the debugger.
Thanks,
Jason
---------------------------------------------------------------------------------------------------------Please click the Verify Answer button on this post if it answers your question.---------------------------------------------------------------------------------------------------------
Hi Jason,
Your problem is a bit strange given that the GUI does in fact send the "DATA" string. This means that the TCP connection has established.For some reason, the board isn't sending the data or something is happening to the data in the air or otherwise
There are a few possible issues where this can happen:
1) There were a few known issues of this with older software versions and in some specific languages where the data is not correctly translated. Can you describe the customer's setup and the version of the sensor app they're using?
2) I have seen an issue when this can happen in congested networks when mixed mode b,g,n is enabled. If you have control of the router, please change the settings
so that the router only uses a mixed mode of b,g (i.e. don't use 802.11n and see how that works).
3) Congestion in general can cause packets to be dropped. After a certain amount of time passes, the GUI assumes that the node has disconnected and will "drop" it. Is this a congested environment?
Regards,Gustavo
Thanks Gustavo,
I received some more info form the customer:
<quote>
I just narrowed down our problem a little:
- First Time Config problem with TPLINK router shows when I try to push the button on the router or run Quick Setup from the router. However if use the Android/iPhone application everything magically works. In our designed system we won't have a cell phone to initiate the connection, so we need to understand what is that 'magic' that the Android app is doing and be able to do the same from the router itself.
- the TCP problem was also to do with the router setup. If I establish connection to the router using wlan_connect API, I run into the TCP issues. However if I do First Time Config and then establish connection through existing profiles, TCP works fine. Same as above, we are going to need some clarification there so to be sure that we can run this with various routers setups.
</quote>
Thoughts?
Jason,
1) The customer is incorrectly using First Time Config. The button the customer is pushing is the WPS button that is not at all related to First Time Config. WPS is not universally supported whereas First Time Config is, and the CC3000 does not support WPS.
In First Time Config there is not magic. The CC3000, when placed in first time config mode (in the sensor app this is done via a button), will scan the air looking for a specially crafted Probe Request or Beacon. These packets are normally crafted when a user uses a device to connect to a network. In the case of First Time Config, the name of the network is crafted as such that it conveys information about which network actually they should connect to. More information on this is available here:
http://processors.wiki.ti.com/index.php/CC3000_First_Time_Configuration
The AP itself is not involved at all with First Time Config. The customer/user does not need to do anything to it. The interaction is solely between the CC3000 and another device that can transmit the information using a WiFi interface.
2) I am not sure about the second problem since I believe the customer is incorrectly using what he believes is "First Time Config".The Laptop/Computer needs to be associated to the AP. Whether that is using WPS or the passphrase, that is up to the customer.The CC3000 needs to also be associated to that same AP. If it is the TP-LINK AP provided in the kit, this can all be done automatically using the USB once, or done with first time config. Another option is with wlan_connect. It is possible that the customer is calling the API incorrectly. Please provide a code snippet to see how the function is being called.
Note that the best approach for this is to modify the demo_config.h file fields and not the code itself.
Customer response:
Here is more information on the connectivity issues.
The first problem is adding a profile through the API , instead of using First Time Config. I wonder if I've set the password field correctly:
char tplink[] = "TP-LINK";
unsigned char password[] = "sifra123";
err = wlan_ioctl_set_connection_policy(DISABLE, DISABLE, DISABLE);
err = wlan_add_profile(WLAN_SEC_WPA, tplink,
7, NULL,
0,
password,
8);
// after thisi restart CC3000, all the steps just like with First Time Config,
The second problem is TCP issue when using wlan_connect. Itseems to be due to using Huawei HG520c router instead of the TP-Link router. The WiFi connection was OK with both routers, but TCP connection failed with the Huawei router - exactly the same code.
Overall I am mostly concerned aboutWPS as that seems to be the easiest way of connecting and does not require the user to connect any additional devices to do the setup.
Thanks for the help.
-Jason
After adding the profile, the customer should re-enable the use of profiles using the set_connection_policy API:
wlan_ioctl_set_connection_policy(DISABLE, DISABLE, ENABLE);
When using the Huawei router, how does he know the TCP connection is failing? Can he ping the CC3000 module?How is the AP configured? DId he try to disable mixed mode bgn and just have bg enabled?
Gustavo
Response Below:
Stored profiles:
Yes I already set connection policy that way, every time I reset CC3000 and want to connect to a stored profile. Similar as with first time config.
Huawei router:
TCP connection is failing because HCI wait for event times out after 60 seconds and connect() returns error. I can't remember if ping worked on Huawei, but UDP send from the device worked, but there were problems receiving UDP (HCI waiting for event times out).
I am not sure how to describe the config on the router because there are many options, but I have 10 other devices working fine with it. I haven't tried bg mode because I didn't want to add additional constraints on which routers this will work on. We can try this later if needed to debug this.
Thanks Gustavo.
Does the customer have a WiFi sniffer? The only way now to see what is going on is to use such sniffer to see whether the CC3000 sends the SYN packet when it wants to connect.
Even if the customer has no WiFi sniffer, using WIreshark can reveal whether such SYN packet has arrived at the computer.
By the way, did customer rewrite the software? The sensor application does not use connect. If the customer isn't using the sensor application, he should at least try to see if it works with the other router. If it does, then the issue is with the customer's code. However, given that the TP-LINK AP works, I can only assume that there might be a firewall preventing the port that the CC3000 is using from communicating. Customer should disable any firewall and security to see if that works.
I forgot to mention. Another thing the customer should do is use iperf, or its java equivalent jperf, between two computers connected to the Huawei router and see if that works.
http://sourceforge.net/projects/iperf/files/jperf/jperf%202.0.0/jperf-2.0.0.zip/download
Just run the jperf bat file and the GUI will load. Make sure customer tries the exact same port as the application is using in the connection.
If this fails to work, then the router is likely filtering packets on the port.
Hi Gustavo,
Thanks for your replies. I will get back to you about the Huawei router.
But for now, can you please give me an advice what am I doing wrong with the wlan_add_profile call? That seem like the most basic thing that should work with TPLink router, since First Time Config can work with it. Did I miss any parameters or any special NVRAM setup?
Nikola
Nikola,
From the posts I don't understand what is the exact issue. Are you unable to connect to the AP when you add a profile?
What code are you executing (a code snippet would be helpful)? Are you deleting other profiles (in some of the reference code, 3 profiles are deleted).
Gustavo,
The issue with saving the profile is that when CC3000 restarts it cannot connect to any of the stored profiles. However if I use first time config instead of wlan_add_profile, then it is saved correctly. So the issue seems to be in the way I am using wlan_add_profile API. A snipped of the code is above in this thread.
Note that this is a separate issue from the Huawei router issue.
Regards,
Yes, I have used wlan_del_profile several times to make sure the first-time-configured ones are all erased for this test (that part is not visible in the code snipped above because it's in a different function).
From your description it seems that the connect using profiles flag policy is not set, so the CC3000 on startup doesn't use the profile. On the other hand, the First time config function or functionality does set the policy correctly, which is why first time config continues connecting.
I suggest you use similar calls to the set policy functions as that one used in first time config function.
I do always set the policy to use profiles, just like the sample in Basic WiFi Sample. Here is my restart function, which I call after setting the profile:
void wlan_restart(){ P3OUT &= ~BIT7; ulCC3000Connected = 0; ulCC3000DHCP = 0; wlan_ioctl_set_connection_policy(DISABLE, DISABLE, ENABLE); wlan_stop(); __delay_cycles(6000000); wlan_start(0); wlan_set_event_mask(HCI_EVNT_WLAN_KEEPALIVE|HCI_EVNT_WLAN_UNSOL_INIT|HCI_EVNT_WLAN_ASYNC_PING_REPORT); }
Enable fast connect as well, the second parameter in the connection policy function and see whether that works.