Wifi connection unsuccesful
응답
17. 8. 2 오후 2:04

I am trying to make a wifi connection from my XDK through the Workbench application.I installed the workbench and connected my XDK to my Mac via USB.I have given the right SSID and password.For some reason the connection fails.Below is the logs I captured from the console.Wifi is WPA based.Any pointers for troubleshoting this?I dont see any logs in Problems tab

 

 INFO | XDK DEVICE 1: Hello from f4b85e3ea7a2

 INFO | XDK DEVICE 1:  Connecting to Alex Philip 

 INFO | Port '/dev/tty.usbmodem1411' has been disconnected

 INFO | Connecting to XDK device 'XDK Device 1' in port '/dev/tty.usbmodem1411'...

 INFO | Connection to port '/dev/tty.usbmodem1411' established

 INFO | XDK DEVICE 1: Hello from f4b85e3ea7a2

 INFO | XDK DEVICE 1:  Connecting to Alex Philip 

 INFO | Port '/dev/tty.usbmodem1411' has been disconnected

 INFO | Connecting to XDK device 'XDK Device 1' in port '/dev/tty.usbmodem1411'...

 INFO | Connection to port '/dev/tty.usbmodem1411' established

 INFO | XDK DEVICE 1: Hello from f4b85e3ea7a2

 INFO | XDK DEVICE 1:  Connecting to Alex Philip 

 INFO | Port '/dev/tty.usbmodem1411' has been disconnected

 INFO | Connecting to XDK device 'XDK Device 1' in port '/dev/tty.usbmodem1411'...

 INFO | Connection to port '/dev/tty.usbmodem1411' established

 INFO | XDK DEVICE 1: Hello from f4b85e3ea7a2

 INFO | XDK DEVICE 1:  Connecting to Alex Philip 

 INFO | Port '/dev/tty.usbmodem1411' has been disconnected

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 2 오후 3:38 as a reply to Alex Philip.

Hello Alex,

it is difficult to give precise advice only based on the console log of the communication between the XDK and the XDK-Workbench. I need more details to be able to help.

What project did you use for this application? Did you use the XdkApplicationTemplate and implement it yourself using the WiFi guide at xdk.io/guides, or did you use one of the examples from the XDK-Workbench as a basis?

Did you verify that the WiFi access point on your Mac is running correctly? Can other devices connect to the WiFi?

Did you use a static IP, or DHCP for the XDK?

Additionally, since the message  INFO | Port '/dev/tty.usbmodem1411' has been disconnected appears quite often, does the XDK disconnect automatically, or do you reboot the XDK manually (by turning it off and on)?

Kind regards,
Franjo

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 3 오전 10:24 as a reply to Franjo Stjepandic.

Hi Franjo,

Thanks for your response.This is a custome templat and my goal is to setup a Wifi connection to the SSID "Alex Philip" and send MQTT messages to the broker.I can email you my archive.zip file.Shall I send it to info@appropos.de.I have configured the right password and the Access Point is using WPA-PSK.My own laptop connects to this SSID and it works fine.

I can probably send a snapshot of my A.P config as well.The same template file(.zip) works for a colleague of mine,ofcourse he has a different Access Point and XDK.Not sure what else can I send to assist with the troubleshooting.

Thank

-Alex

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 3 오후 2:57 as a reply to Alex Philip.

Hello Alex,

thanks for the clarifications. If the same project works for a colleague of yours, then it probably is not an issue with the application. But for further testing, there is an example in the Workbench's Welcome screen called WlanNetworkManagement (The Welcome Screen appears when starting the Workbench, the examples are on the left).

Open that project, and then open the header-file WlanNetworkManagement in the project for editting, and insert your WiFi's SSID and Password on line 81 / 82. Additionally, set NCI_DHCP_MODE to 2 on line 76. This will make the XDK use DHCP for the IP. Rebuild the project and flash it to the XDK. The XDK-Workbench will print the available WiFi networks and attempt to connect to the WiFi network you set in the header-file.

If this doesn't work and your WiFi hotspot is not listed in the console log, then I think it might be a problem with your WiFi configuration. In that case, I would recommend trying to connect to another WiFi.

You may also send the project and the snapshot of your WiFi configuration to us if the previous steps do not help. We will take a look at the project and compare the configuration to ours.

Kind regards,
Franjo

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 3 오후 5:46 as a reply to Franjo Stjepandic.

Hi Franjo,

 

Tried you suggestion with the example WlanNetworkManagement.Please have a look at the screenshots I attached.It tries to connect to the SSID and then error out.I have also attached screenshots or thr Problem window and A.P basic configs.Please have a look and let me know if you find something wrong.

 

Thanks

-Alex

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 3 오후 6:24 as a reply to Alex Philip.

Hi Alex,

I'm not sure if this helps. But could you possibly try to configure your WLAN to use authentication option: WPA2-PSK.

The HttpExampleClient worked out-of-the-box for me. I did see that my XDK got a valid IPv4 address from the router.

 

Kind regards

Phuong

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 4 오후 1:48 as a reply to Phuong Nguyen.

Hello Alex,

Would you be so kind to answer, whether the WlanNetworkManagement actually lists your WiFi’s SSID in the console?
The screenshot shows the console log of your other project. Did you flash the WlanNetworkManagement correctly? It should first print all available WiFi networks, which your XDK can find, and then attempt to connect to the WiFi you specified in the header-file.

My WiFi configuration is similar to yours, I have tried out multiple configurations, to see if I can reproduce the behaviour that you have. That means, I wanted to produce a situation where my computer can connect to the WiFi, but my XDK can’t. But, I was only able to produce situations where either both can connect, or both can not connect. But I have noticed that your Guard Interval is set to long, while I can only set the Guard Interval to short. Do you have the option to set it to short as well?

Further, I would like to know the operating capacity of the wifi channels in your environment. This could be a possible cause, why the XDK is unable to connect.

In any case, do regard Phuong’s suggestion and set the Security Mode to WPA2-PSK. Even if it does not help, I would always recommend to use the highest possible security level.

Also, did you try using your smartphone as a hotspot and connect to it with the XDK? Or any other WiFi access point for that matter? How far away is your XDK from the access point? If the XDK is far away, or obstructed by other clients trying to connect / other arbitrary WiFi signals, it might not be able to connect either.

If all of that does not solve the problem, it might be that you need to update the firmware. For that, please post your e-mail address here, so we can contact you directly.

Kind regards,
Franjo

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 7 오전 6:14 as a reply to Franjo Stjepandic.

Hi Franko/Phuong,

 

Thanks for your suggestions.I tried another Acess Point and am able to connect now.Regarding your suggestion to use WPA2-PSK,actually I would like to use that.I thought this is not supported as the Wifi guide talks only about WPA.I would like to know how I can connect to WPA2-PSK-Enterprise.Since that need a username and password and I dont see a username variable in the example header files.Could you please help me with me the configuration for this?

 

Thanks

-Alex

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 7 오후 1:18 as a reply to Alex Philip.

Hello Alex,

I am glad to hear that you made it work by connecting your XDK to another Wi-Fi hotspot. Regarding your questions about WPA2-PSK-Enterprise, I recommend taking a look at this thread. It offers a complete Wi-Fi enterprise XDK demo for download.
All necessary information about it is available in the Read me, which is also available for download there.

Please let me know if this was helpful and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 10 오전 8:04 as a reply to Franjo Stjepandic.

Hey Stefan,

 

Another question.Now that my Wifi connection is succesful am trying to get the device talk to the MQTT Broker.Below is the console logs and this seem to go in a loop.I have attached my mqtt.c for your reference.My colleague says he has MQTTS with TLS going.I was wondering if thats mandatory or something.I do not have TLS setup on my broker.But I would expect some packets to be recvd on the Router.Right now it looks like the device is not sending anything to port 8882 that I can see on my router. So the question is as follows:

1.Is Secure MQTT/TLS needed and could that be issue..?

2.Any other suggestions to troubleshoot?

 

Connecting to K device 'XDK Device 1' in port 'COM18'...
 INFO | Connection to port 'COM18' established
 INFO | K DEVICE 1: Hello from f4b85e3ea7a2
 INFO | K DEVICE 1:  Connecting to Alex 
 INFO | K DEVICE 1:  Connected to WPA network successfully. 
 INFO | K DEVICE 1:   Ip address of the device: 172.20.10.9 
 INFO | Disconnecting K device 'XDK Device 1' from port 'COM18'...
 INFO | Port 'COM18' has been disconnected

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 10 오후 1:27 as a reply to Alex Philip.

Hello Alex,

TLS is not required for MQTT, and that is why I think you can replace the call TLSConnectNetwork(...) on line 375 in your code with ConnectNetwork(&n, mqttsrv, mqttport). Let the rest stay the same, except for the function, of course.

Additionally, make sure you use the correct address and port. Especially the port, since the reserved ports for MQTT brokers are 1883 for normal connections and 8883 for secure connections (SSL/TSL). If you changed that manually and knowingly, then it shouldn't be a problem, either.

As for where the XDK is stuckin a loop, I recommend implementing some debug-prints at locations within the code, where you suspect the XDK might be stuck afterwards. Basically, use something like printf("LOG: location 1") before certain codes are executed. You will see where the XDK stops or is stuck that way.

Do you have a JLink Debugger? This is an additional hardware tool for debugging applications on the XDK. Also, since you asked for WPA2-PSK-Enterprise in your last post, how is your progress on that?

Please tell me if this was helpful, and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 10 오후 2:41 as a reply to Franjo Stjepandic.

Tried your suggestion.Pls see below the code snippet.It doesnt seem to enter that function.Not sure.   

 

if (RETCODE_OK == WlanConnect_WPA((WlanConnect_SSID_T) ssid,

    (WlanConnect_PassPhrase_T) wpa, NULL)) {

        NetworkConfig_GetIpSettings(&myIpSettings);

        *IpaddressHex = sl_Htonl(myIpSettings.ipV4);

        (void)Ip_convertAddrToString(IpaddressHex,(char *)&ipAddress);

        printf("Connected to Alex's WPA network successfully. \r\n ");

        printf("LOG: location 0. \r\n ");

        printf(" Ip address of the device: %s \r\n ",ipAddress);

        printf("LOG: location 1. \r\n ");

    } else {

        printf("Error occurred connecting %s \r\n ", ssid);

    }

    printf("LOG: location 2. \r\n ");

    NewNetwork(&n);

    MQTTClient(&c, &n, 10000, mqttbuf, sizeof(mqttbuf), mqttreadbuf, sizeof(mqttreadbuf));

    printf("LOG: location 3. \r\n ");

    printf("LOG: location X. \r\n ",mqttsrv, mqttport, &n);

if  (ConnectNetwork(&n, mqttsrv, mqttport))

 {

  printf("LOG: location 4. \r\n ");

  printf("Connected to %s:%d with TLS 1.2\r\n ", mqttsrv, mqttport);

 

    MQTTPacket_connectData data = MQTTPacket_connectData_initializer;

data.willFlag = 0;

data.MQTTVersion = 3;

data.clientID.cstring = mqttid;

data.keepAliveInterval = 15;

data.cleansession = 1;

if (mqttuser[0])

data.username.cstring = mqttuser;

if (mqttpass[0])

data.password.cstring = mqttpass;

 

if (!MQTTConnect(&c, &data)) {

MQTTMessage msg = {.payload = pnpbuf, .payloadlen = strlen(pnpbuf)};

//MQTTSubscribe(&c, mqttcfg, QOS0, mqttCfg);

MQTTPublish(&c, mqttpnp, &msg);

 

printf("Connected to MQTT broker\r\n ");

    return;

} else {

printf("Failed to connect to MQTT broker\r\n ");

cc3200_disconnect(&n);

}

 

    } else {

    printf("Failed to connect to %s:%d with TLS 1.2\r\n ", mqttsrv, mqttport);

    printf("LOG: location 5. \r\n ");

    }

 

printf("Connect failed, retrying in %dms...\r\n ", wifiretry * 1000);

printf("LOG: location 6. \r\n ");

}

 

/* global functions ********************************************************* */

 

 

/**

 * @brief API to de-initialize the WNS module

 */

void deinit(void)

{

    /*do nothing*/

printf("LOG: location 7. \r\n ");

}

/** ************************************************************************* */

 

INFO | Disconnecting XDK device 'XDK Device 1' from port 'COM18'...

 INFO | Port 'COM18' has been disconnected

 INFO | Connecting to XDK device 'XDK Device 1' in port 'COM18'...

 INFO | Connection to port 'COM18' established

 INFO | XDK DEVICE 1: Hello from f4b85e3ea7a2

 INFO | XDK DEVICE 1:  Connecting to Alex 

 INFO | XDK DEVICE 1:  Connected to Alex's WPA network successfully. 

 INFO | XDK DEVICE 1:  LOG: location 0. 

 INFO | XDK DEVICE 1:   Ip address of the device: 172.20.10.9 

 INFO | XDK DEVICE 1:  LOG: location 1. 

 INFO | XDK DEVICE 1:  LOG: location 2. 

 INFO | XDK DEVICE 1:  LOG: location 3. 

 INFO | XDK DEVICE 1:  LOG: location X. 

 INFO | Disconnecting XDK device 'XDK Device 1' from port 'COM18'...

 INFO | Port 'COM18' has been disconnected

 INFO | Connecting to XDK device 'XDK Device 1' in port 'COM18'...

 INFO | Connection to port 'COM18' established

 INFO | XDK DEVICE 1: Hello from f4b85e3ea7a2

 INFO | Disconnecting XDK device 'XDK Device 1' from port 'COM18'...

 INFO | Port 'COM18' has been disconnected

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 10 오후 3:24 as a reply to Alex Philip.

And is it possible for a quick conf call to go over this.I feel that might cut short the time lost in emails.

Please let me know if you have some time tomorrow for an online debugging session..

 

Thanks

-Alex

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 11 오후 5:29 as a reply to Alex Philip.

Hello Alex,

the function ConnectNetwork() returns the value 0 if the connection has been successful. You removed the ! from the original code in the if-condition. Thus, the body of the if-condition will not be reached if the connection is successful.

I would ask you to make the following change to the code snippet you posted:

if  (ConnectNetwork(&n, mqttsrv, mqttport))

to

if  (!ConnectNetwork(&n, mqttsrv, mqttport)).

Related to the online debugging session you suggested, I unfortunately need to tell you, we use this forum specifically to provide general help and advice regarding issues with the XDK and its libraries.

Only exclusive cases, where the solution for an issue is not easily found, or required project exchange lead to email support or any kind of further remote support.
For all other cases, we try to solve them within the XDK community to give all users with similar issues the opportunity to benefit from the proposed solution.

For now, I guess we can still solve your issues within the XDK community. If they are getting more complicated and we are having issues to propose a proper solution for them, we can change to extended communication channels.

Additionally, I would ask you to open a new thread for a new issue. The initial issue of this thread is already solved and other users will find corresponding solutions to issues more easily, if the thread title contains the correct issue.

Please let me know if this was helpful and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

+1 (1 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 16 오전 4:42 as a reply to Franjo Stjepandic.

Hey Franjo,

All is well now.The thing is the firewall was blocking my mqtt packets send from the device.I overlooked this aspect because even while I was sending packets to my mqtt listener port using a 3rdpart client like mqtt fx I could see the packets hitting my router.But I never realized that those packets were being send through the intranet which the firewall allowed where as XDL sends it over public internet.So I was under the wrong impression that XDK is not initiating the MQTT connection.After changing the firewall rule,am able to see the packets and things look good.For any other issues I will open a new post and you can go ahead and close this.

THANKS A TON FOR STICKING WITH ME!!! REALLY APPRECIATE IT!!

0 (0 투표)
RE: Wifi connection unsuccesful
응답
17. 8. 16 오후 1:16 as a reply to Alex Philip.

Hello Alex,

I am glad to hear that you were able to make your application work.

Please do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 투표)