cancel
Showing results for 
Search instead for 
Did you mean: 

Problems to connect two SPWF01SA via TCP or UDP socket

mhildenbrand
Associate II
Posted on May 27, 2015 at 13:32

Hello,

i´m from Germany, therefore please apologize my mediocre english ;).

I have some problems with the module SPWF01SA. I want to connect them both to each other. One SPWF01SA is configured in the MiniAP mode. The other one have to connect to this AP via Access point connection.

The Problem is, every time the SPWF01SA will join to the other SPWF01SA (with MINIAP), the client module reboot an starts new. This ends in an continuous Loop. On both modules the Firmware SPWF01S-140805-3f58d6b-RELEASE-main is installed.

It would be great if someone can help me. Thank you very much.

Configuration:

MINI AP:

+WIND:1:Poweron (140805-3f58d6b-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:26:WiFi Started AP with network 'ADHOC'

+WIND:24:WiFi Up:172.31.245.1

Settings:

# Dumping All Configuration Keys:

#  nv_manuf = ST

#  nv_model = SPWF01SA

#  nv_serial = 4313D03299

#  nv_wifi_macaddr = 00:80:E1:FF:99:F5

#  blink_led = 0

#  wind_off_low = 0x00000000

#  wind_off_medium = 0x00000000

#  wind_off_high = 0x00000000

#  user_desc = anonymous

#  escape_seq = at+s.

#  localecho1 = 0

#  console1_speed = 115200

#  console1_hwfc = 0

#  console1_enabled = 1

#  sleep_enabled = 0

#  standby_enabled = 0

#  standby_time = 10

#  wifi_tx_msdu_lifetime = 0

#  wifi_rx_msdu_lifetime = 0

#  wifi_operational_mode = 0x00000011

#  wifi_beacon_wakeup = 1

#  wifi_beacon_interval = 100

#  wifi_listen_interval = 0

#  wifi_rts_threshold = 3000

#  wifi_ssid = 41:44:48:4F:43:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_ssid_len = 5

#  wifi_channelnum = 6

#  wifi_opr_rate_mask = 0x00003FCF

#  wifi_bas_rate_mask = 0x0000000F

#  wifi_mode = 3

#  wifi_auth_type = 0

#  wifi_atim_window = 0

#  wifi_powersave = 0

#  wifi_tx_power = 18

#  wifi_rssi_thresh = 0

#  wifi_rssi_hyst = 0

#  wifi_ap_idle_timeout = 120

#  wifi_beacon_loss_thresh = 10

#  wifi_priv_mode = 0

#  wifi_wep_keys[0] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_keys[1] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_keys[2] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_keys[3] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_key_lens = 00:00:00:00

#  wifi_wep_default_key = 0

#  wifi_wpa_psk_raw = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wpa_psk_text = test

#  ip_use_dhcp = 1

#  ip_use_httpd = 1

#  ip_mtu = 1500

#  ip_hostname = iwm-FF-99-F5

#  ip_apdomainname = captiveportal.net

#  ip_ipaddr = 192.168.1.2

#  ip_netmask = 255.255.255.0

#  ip_gw = 192.168.1.1

#  ip_dns = 192.168.1.1

#  ip_http_get_recv_timeout = 3000

#  ip_dhcp_timeout = 20

Client Module:

WIND:1:Poweron (140805-3f58d6b-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:21:WiFi Scanning

+WIND:35:WiFi Scan Complete (0x0)

+WIND:19:WiFi Join:00:80:E1:FF:99:F5

+WIND:1:Poweron (140805-3f58d6b-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:21:WiFi Scanning

+WIND:35:WiFi Scan Complete (0x0)

+WIND:19:WiFi Join:00:80:E1:FF:99:F5

+WIND:1:Poweron (140805-3f58d6b-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:21:WiFi Scanning

+WIND:35:WiFi Scan Complete (0x0)

+WIND:19:WiFi Join:00:80:E1:FF:99:F5

+WIND:1:Poweron (140805-3f58d6b-SPWF01S)

Settings:

# Dumping All Configuration Keys:

#  nv_manuf = ST

#  nv_model = SPWF01SA

#  nv_serial = 4313D17299

#  nv_wifi_macaddr = 00:80:E1:FF:9A:08

#  blink_led = 0

#  wind_off_low = 0x00000000

#  wind_off_medium = 0x00000000

#  wind_off_high = 0x00000000

#  user_desc = anonymous

#  escape_seq = at+s.

#  localecho1 = 0

#  console1_speed = 115200

#  console1_hwfc = 0

#  console1_enabled = 1

#  sleep_enabled = 0

#  standby_enabled = 0

#  standby_time = 10

#  wifi_tx_msdu_lifetime = 0

#  wifi_rx_msdu_lifetime = 0

#  wifi_operational_mode = 0x00000011

#  wifi_beacon_wakeup = 1

#  wifi_beacon_interval = 100

#  wifi_listen_interval = 0

#  wifi_rts_threshold = 3000

#  wifi_ssid = 41:44:48:4F:43:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00                                          :00:00:00:00:00:00:00:00:00:00

#  wifi_ssid_len = 5

#  wifi_channelnum = 6

#  wifi_opr_rate_mask = 0x00003FCF

#  wifi_bas_rate_mask = 0x0000000F

#  wifi_mode = 1

#  wifi_auth_type = 0

#  wifi_atim_window = 0

#  wifi_powersave = 0

#  wifi_tx_power = 18

#  wifi_rssi_thresh = 0

#  wifi_rssi_hyst = 0

#  wifi_ap_idle_timeout = 120

#  wifi_beacon_loss_thresh = 10

#  wifi_priv_mode = 0

#  wifi_wep_keys[0] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_keys[1] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_keys[2] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_keys[3] = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wep_key_lens = 00:00:00:00

#  wifi_wep_default_key = 0

#  wifi_wpa_psk_raw = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:0                                          0:00:00:00:00:00:00:00:00:00:00:00:00

#  wifi_wpa_psk_text = test

#  ip_use_dhcp = 1

#  ip_use_httpd = 1

#  ip_mtu = 1500

#  ip_hostname = iwm-FF-9A-08

#  ip_apdomainname = captiveportal.net

#  ip_ipaddr = 192.168.0.50

#  ip_netmask = 255.255.255.0

#  ip_gw = 192.168.0.1

#  ip_dns = 192.168.0.1

#  ip_http_get_recv_timeout = 3000

#  ip_dhcp_timeout = 20

Sincerely

Manuel H.
8 REPLIES 8
Posted on May 27, 2015 at 14:02

Hi Manuel,

first of all, can you update modules FW please?

http://www.st.com/web/catalog/sense_power/FM2185/SC1930/PF258591

''Design Resources'' > ''

http://www.st.com/web/en/catalog/tools/PF260799

'' or ''

STSW-WIFI002

''

Thanks

jerry
mhildenbrand
Associate II
Posted on May 28, 2015 at 08:39

Hi Jerry,

thanks for your help. I updated both modules. Now it seems to be a little bit better, but the modules still not connect to each other. After the association wit AP runs the module starts new.

Here you can see the report.

AP:

 

+WIND:1:Poweron (150410-c2e37a3-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:26:WiFi Started AP with network 'APTEST'

+WIND:24:WiFi Up:172.31.245.1

+WIND:28:Station 00:80:E1:FF:9A:02 Associated:0

Client:

 

 

+WIND:1:Poweron (150410-c2e37a3-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:21:WiFi Scanning

+WIND:35:WiFi Scan Complete (0x0)

+WIND:21:WiFi Scanning

+WIND:35:WiFi Scan Complete (0x0)

+WIND:19:WiFi Join:00:80:E1:FF:99:F5

+WIND:25:WiFi Association with 'APâ–’

+WIND:1:Poweron (150410-c2e37a3-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:19:WiFi Join:00:80:E1:FF:99:F5

+WIND:21:WiFi Scanning

+WIND:35:WiFi Scan Complete (0x0)

+WIND:21:WiFi Scanning

Greetings

Manuel 

Posted on May 28, 2015 at 09:43

Hi Manuel,

I tried both old FW and new FW, but I don't see the problem.

As first step, please run AT&F. Then, follow hands-on tutorial to create your own network. Lab3 for station, and Lab10 for miniAP.

If doesn't works, give me more details about modules status (at+s.sts), peer status (at+s.peers), network status (at+s.scan), every other useful information is fine.

Thanks

jerry

mhildenbrand
Associate II
Posted on May 28, 2015 at 15:28

Hi Jerry,

i don´t know exactly why, but the problem has come of by itself. Now the modules have a connection to each other. The Problem is solved.

I thank you very much for your support.

My next task is to open a TCP - Connection between the modules. I hope this will now work better  🙂

AP:

 

+WIND:1:Poweron (150410-c2e37a3-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:26:WiFi Started AP with network 'APTEST'

+WIND:24:WiFi Up:172.31.245.1

+WIND:28:Station 00:80:E1:FF:9A:02 Associated:0

+WIND:29:DHCP reply for 172.31.245.2/00:80:E1:FF:9A:02

Client:

+WIND:1:Poweron (150410-c2e37a3-SPWF01S)

+WIND:13:ST SPWF01SA IWM: Copyright (c) 2012-2014 STMicroelectronics, Inc.  All rights Reserved.

+WIND:3:Watchdog Running

+WIND:0:Console active

+WIND:32:WiFi Hardware Started

+WIND:19:WiFi Join:00:80:E1:FF:99:F5

+WIND:19:WiFi Join:00:80:E1:FF:99:F5

+WIND:25:WiFi Association with 'APTEST' successful

+WIND:51:WiFi Handshake Complete

+WIND:24:WiFi Up:172.31.245.2

Best Greetings 

Manuel 

mhildenbrand
Associate II
Posted on May 29, 2015 at 10:50

Hi Jerry,

now i have two additional questions.

Wehen i start a TCP - socket on Port 32000 for example and the IP- adress from the other module (172.31.225.2)  it tells me ''ERROR: Failed to connect''.

But when i start a UDP - socket on Port 32000 with the same IP it works. Do you know why?

Now the second question. After a UDP - socket was started, i want to transmitt data between the modules.

The only way i found to do this, is to create the UDP - socket on the module  with AP ( AT+S.SOCKON=172.31.225.2,32000,u,ind) and the command AT+S.SOCKD=32000,u on the Client Module. After i do this i can send a message from the Ap module to the other. But now the client - module is in ''+WIND:60:Now in Data Mode'' and it is not possible to enter a command.

Can you tell me what i have to do to create a connection between the two modules to send messages against each other (From AP to Client and from Client to AP)

Thanks

Manuel

Posted on May 29, 2015 at 11:43

Hi Manuel,

TCP uses a real connection, so, you get an error if client is not able to reach the server;

UDP does not build a real connection, so, you are always able to send a packet, even if server is not reachable!

SOCKD command is a command to open a socket server;

SOCKON/SOCKW/SOCKR/SOCKQ/SOCKC are commands to manage a socket client.

Socket client is always in ''command mode'', so, you are always able to expect ''OK'' and send the next command;

socket server uses ''data mode'' feature: when you are in data mode, cannot send AT commands, till you come back to command mode through escape_sequence.

First of all you must select which module (miniAP or STAtion) should perform socket server. Then open a socket server on this module, and run SOCKON/SOCKW/etc on the other module. This is all.

Download the hands-on, and use it step by step.

Ciao

jerry

mhildenbrand
Associate II
Posted on June 01, 2015 at 11:42

Hi Jerry,

first off all thanks for your help.

With the configurations you told me it is now possible to create a server on the module with AP and open a socket on the other. The module with AP and server changes automatically in the ''Data Mode'' after a socket client is incomming.

Now it is possible to send a message from the module with socket to the other which is in ''Data Mode'' (AP).

But i can´t find a solution to send a message in the other direction (From module which is in ''Data Mode''(AP) to module with the socket). 

Is it possible to start a server and socket on the same module? Every time i try this and send a message the socket colse automatically after the message was send. (+WIND:58:Socket Closed:1).

Greetings

Manuel

Posted on June 02, 2015 at 11:31

Hi Manuel,

to sent data from Data Mode to socket client, no AT command is needed. Send some byte over UART. 

Note that remote client must open the socket by ''ind'' parameter. If ''ind'' is not used, SOCKQ command must be executed sometimes.

About double connection, yes, it's possible. You can open the socket server on a port, and connect to another socket server through SOCKON.

Obviously, you can open the server on a port, and connect to it by local socket client, but... what's the purpose?

Ciao

j