Skip to main content
bernd sch�nlebe
Associate II
August 1, 2017
Question

SPWF04SA DHCP Server problem

  • August 1, 2017
  • 5 replies
  • 2551 views
Posted on August 01, 2017 at 11:31

I have setup the module as miniAP with following script: (

http://elektronikab2b.pl/technika/32973-spwf04sa-miniaturowy-modul-wi-fi-z-oferty-stmicroelectronics---przyklady-zastosowan

)

AT+S.WIFI=0

AT+S.FCFG

AT+S.SSIDTXT=test_ap

AT+S.SCFG=wifi_priv_mode,1

AT+S.SCFG=wifi_mode,3

AT+S.SCFG=wifi_wep_keys[0],76543210ab

AT+S.SCFG=wifi_wep_key_lens,05

AT+S.SCFG=wifi_auth_type,0

AT+S.SCFG=ip_ipaddr,192.168.0.1

AT+S.SCFG=ip_use_dhcpc,2

AT+S.WIFI=1

AT+S.WCFG

AT+S.RESET

once it restarts, this is what I get:

Port opened

SPWF04SA WIFI test program start.

Setup SPI done.

Reset module...

Start module...

Done.

RX:02 10 07 02 00 AT+S.WIND:7:Configuration Failure:<wifistate=Hardware power up>:10

RX:02 10 01 16 00 AT+S.WIND:1:Poweron:<wifistate=Hardware power up>:170726-b7ac1ba-SPWF04S

RX:02 10 0D 08 00 AT+S.WIND:13:Copyright:<wifistate=Hardware power up>:SPWF04SA

RX:02 10 03 02 00 AT+S.WIND:3:Watchdog Running:<wifistate=Hardware power up>:20

RX:02 10 00 00 00 AT+S.WIND:0:Console active:<wifistate=Hardware power up>:

RX:02 13 20 00 00 AT+S.WIND:32:WiFi Hardware Started:<wifistate=Radio idle>:

RX:02 13 1A 07 00 AT+S.WIND:26:Started AP:<wifistate=Radio idle>:test_ap

RX:02 19 18 0D 00 AT+S.WIND:24:WiFi Up:<wifistate=802.11 handshake complete>:0:192.168.0.1

RX:02 1A 18 1C 00 AT+S.WIND:24:WiFi Up:<wifistate=Ready to TX>::fe80:0:0:0:280:e1ff:febd:39

now, just to be sure, here the entire config printout:

TX:02 00 02 09 00 //AT+S.GCFG

nv_manuf=STMicroelectronics Inc.

nv_model=SPWF04SA

nv_serial=17111984

nv_wifi_macaddr=00:80:E1:BD:00:39

standby_time=10

standby_enabled=0

sleep_enabled=0

etf_mode=0

blink_led=1

ext_volume=3

ramdisk_memsize=16

aes128_key=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

user_desc=anonymous

python_script=3:/uPython_test.py

python_memsize=32

console_enabled=1

console_speed=115200

console_hwfc=0

console_echo=1

console_errs=2

console_winds=2

console_verbose=1

console_repeater=0x21

console_delimiter=0x2C

console_wind_off_low=0x00000000

console_wind_off_medium=0x00000000

console_wind_off_high=0x00000000

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=74:65:73:74:5F:61:70: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=7

wifi_txfail_thresh=5

wifi_dtim_period=1

wifi_add_tim_ie=0

wifi_region=1

wifi_ht_mode=1

wifi_channelnum=6

wifi_opr_rate_mask=0x003FFFCF

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=1

wifi_wep_keys[0]=76:54:32:10:AB: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=05: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=

wifi_eap_identity=identity

wifi_eap_anon_identity=anonymous@identity.org

wifi_eap_passwd=password

wifi_eap_type=0

wifi_eap_skip_datechecks=0

wifi_wps_walk_time=120

wifi_wps_pin=1234567

ip_sock_memsize=1

ip_sock_threshold=0

ip_dhcp_lease_time=120

ip_macfilter=00:00:00:00:00:00

ip_num_clients=5

ip_allow_port_scans=1

ip_use_v6=1

ip_use_dhcpd=1

ip_use_httpd=1

ip_use_tftpd=1

ip_use_dhcpc=2

ip_hostname=iwm-BD-00-39

ip_apdomainname=captiveportal.net

ip_apredirect=firstset.html

ip_ipaddr=192.168.0.1

ip_netmask=255.255.255.0

ip_gw=192.168.0.1

ip_dns1=192.168.0.1

ip_dns2=208.67.220.220

ip_local=0:0:0:0:0:0:0:0

ip_dns1v6=0:0:0:0:0:0:0:0

ip_dns2v6=0:0:0:0:0:0:0:0

ip_dhcp_timeout=20

ip_ntp_server1=ptbtime1.ptb.de

ip_ntp_server2=ntp0.ipv6.fau.de

ip_ntp_refresh=3600

ip_ntp_startup=1

ip_mdns_domain_name=SPWF04S-Default

ip_mdns_device_name_ttl=120

ip_mdns_services_name=SPWF04S-WebSrv SPWF04S-TFTPSrv

ip_mdns_services_prot=_http._tcp _tftp._udp

ip_mdns_services_keys=dev1 dev2

ip_mdns_services_vals=number1 number2

ip_mdns_services_port=80 69

ip_mdns_services_ttl=120 60

ip_mdns_startup=01:01

now my problem is this: once I try to connect with my phones wifi f.e., it does recognize that a station gets associated, but it does not give out an IP, what do I have to setup for it to work?

RX:02 1A 1C 13 00 AT+S.WIND:28:Station Associated:<wifistate=Ready to TX>:00:16:EA:E5:89:FE:0

RX:02 1A 1C 13 00 AT+S.WIND:28:Station Associated:<wifistate=Ready to TX>:00:16:EA:E5:89:FE:0

RX:02 1A 48 13 00 AT+S.WIND:72:Station Disassociated:<wifistate=Ready to TX>:00:16:EA:E5:89:FE:1

PS: I see the 'Configuration Failure' but its non-halting and I dunno what HW pullup resistor is meant here. This all worked fine before I upgraded the firmware (SPWF04S-170726-b7ac1ba)

PPS: if I downgrade back (firmware SPWF04S-170216-fd39c59), it works but all the fixed problems (with SPI communication) are back, so this has to be a firmware issue

This topic has been closed for replies.

5 replies

Elio Cometti
Visitor II
August 10, 2017
Posted on August 10, 2017 at 19:20

Hi,

let me make some comments:

AT+S.WIFI=0  <-- swith off the radio

AT+S.FCFG  <-- load factory configuration in RAM *

AT+S.SSIDTXT=test_ap

AT+S.SCFG=wifi_priv_mode,1

AT+S.SCFG=wifi_mode,3

AT+S.SCFG=wifi_wep_keys[0],76543210ab

AT+S.SCFG=wifi_wep_key_lens,05

AT+S.SCFG=wifi_auth_type,0

AT+S.SCFG=ip_ipaddr,192.168.0.1

AT+S.SCFG=ip_use_dhcpc,2 <-- set DHCP client configuration **

AT+S.WIFI=1  <-- switch on the radio ***

AT+S.WCFG

AT+S.RESET

* Best practice is AT+S.FCFG -> AT+S.WCFG -> AT+S.RESET

** you should enable DHCP server here, by AT+S.SCFG=ip_use_dhcpd,1

*** since you reloaded the factory configuration, this should be moved after AT+S.RESET to take effect of FCFG + new configuration

I would use one of the following instead:

1) reload FCFG and program the radio with new params:

AT+S.WIFI=0

AT+S.FCFG

AT+S.SSIDTXT=test_ap

AT+S.SCFG=wifi_priv_mode,1

AT+S.SCFG=wifi_mode,3

AT+S.SCFG=wifi_wep_keys[0],76543210ab

AT+S.SCFG=wifi_wep_key_lens,05

AT+S.SCFG=wifi_auth_type,0

AT+S.SCFG=ip_ipaddr,192.168.0.1

AT+S.SCFG=ip_use_dhcpd,1

AT+S.WCFG

AT+S.RESET

It might be necessary to wait for WIND:38 after AT+S.WIFI=0

2) program the radio with new params, leaving everything else unchanged:

AT+S.WIFI=0

AT+S.SSIDTXT=test_ap

AT+S.SCFG=wifi_priv_mode,1

AT+S.SCFG=wifi_mode,3

AT+S.SCFG=wifi_wep_keys[0],76543210ab

AT+S.SCFG=wifi_wep_key_lens,05

AT+S.SCFG=wifi_auth_type,0

AT+S.SCFG=ip_ipaddr,192.168.0.1

AT+S.SCFG=ip_use_dhcpd,1

AT+S.WIFI=1

AT+S.WCFG

It might be necessary to wait for WIND:38 after AT+S.WIFI=0.

It might also be necessary to wait for WIND:24 after AT+S.WIFI=1 in order to save the 'radio on' state and have the radio automatically switched on at next reboot.

bernd sch�nlebe
Associate II
August 14, 2017
Posted on August 14, 2017 at 09:35

same result, also the RESET command wants some arguments it seems...

TX:02 00 02 03 00

RX:02 3A 02 00 00 AT+S.ERROR:2:Missing argument(s):<wifistate=Ready to TX>:

here the 3 variants I tried:

https://pastebin.com/R3xTwJqe

https://pastebin.com/LRnSsz7a

https://pastebin.com/MJjD4HMR

Best regards

Elio Cometti
Visitor II
August 14, 2017
Posted on August 14, 2017 at 15:56

>  TX:02 00 02 03 00

>  RX:02 3A 02 00 00 AT+S.ERROR:2:Missing argument(s):<wifistate=Ready to TX>:

in the RX stream, 3A means 'incoming data' + 'status 10=Ready to TX', while 02 is the indication message for RESET (it is not an error code).

In other words, it is the reply to AT+S.RESET message. On the UART console you would see WIND:2:Reset

brianshankland9
Associate III
May 23, 2018
Posted on May 23, 2018 at 11:54

I'm also seeing the same problem.

When using Mini-AP mode with the ip_use_dhcpd=1 I'm not seeing the Win29 DHCP Reply messages, only the Wind 28 Station Associated messages.

When connecting to an old XP machine it works every time, but with Win10 its less than 10%, and instead of getting a DHCP allocated IP address it uses its Alternative address instead.

Unable to tell if its Win10 not sending a DHCP request or the SPWF04 not servicing the request correctly.

Maybe Win10 is not being told that a DHCP server is available in the device so it doesn't make a request.

All very frustrating so any insight appreciated.

Elio Cometti
Visitor II
May 23, 2018
Posted on May 23, 2018 at 17:16

Hello,

if you are not sure about Win10 DHCP settings, please verify that 'Obtain an IP address automatically' is checked in IPV4 dialog of your wireless network adapter.

Then, if not already done, please reboot the SPWF04 (either AT+S.RESET or HW reset) and then try associating the PC again.

If this does not make the things better, please attach your module's configuration (AT+S.GCFG) and status (AT+S.STS) to this topic.

brianshankland9
Associate III
May 24, 2018
Posted on May 24, 2018 at 10:32

Thanks for getting back to me so quickly.

Yes the Win10 machines are all looking for DHCP allocated addresses across wifi.

I've loaded Wireshark onto one laptop so I can see if a message is not being handled, unfortunately since that time I've not had a failure on that computer (sometimes can work for hours at a time then fail for equally long times).

Since the firmware is not changing in this time I'm sure it must be a timing and/or network thing.

I'll add in option to dump out the variable and status and post up soonest, and if I get a failure on wireshark will post this as well.

Thanks

brianshankland9
Associate III
May 25, 2018
Posted on May 25, 2018 at 11:54

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6oY&d=%2Fa%2F0X0000000bw5%2FTP.7qmpV2QxGxVqbZreDm2C7KLBeO7p6860CeCRjk8o&asPdf=false