2017-08-01 02:31 AM
I have setup the module as miniAP with following script: (
)AT+S.WIFI=0
AT+S.FCFGAT+S.SSIDTXT=test_apAT+S.SCFG=wifi_priv_mode,1AT+S.SCFG=wifi_mode,3AT+S.SCFG=wifi_wep_keys[0],76543210abAT+S.SCFG=wifi_wep_key_lens,05AT+S.SCFG=wifi_auth_type,0AT+S.SCFG=ip_ipaddr,192.168.0.1AT+S.SCFG=ip_use_dhcpc,2AT+S.WIFI=1AT+S.WCFGAT+S.RESETonce 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>:10RX:02 10 01 16 00 AT+S.WIND:1:Poweron:<wifistate=Hardware power up>:170726-b7ac1ba-SPWF04SRX:02 10 0D 08 00 AT+S.WIND:13:Copyright:<wifistate=Hardware power up>:SPWF04SARX:02 10 03 02 00 AT+S.WIND:3:Watchdog Running:<wifistate=Hardware power up>:20RX: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_apRX:02 19 18 0D 00 AT+S.WIND:24:WiFi Up:<wifistate=802.11 handshake complete>:0:192.168.0.1RX:02 1A 18 1C 00 AT+S.WIND:24:WiFi Up:<wifistate=Ready to TX>::fe80:0:0:0:280:e1ff:febd:39now, just to be sure, here the entire config printout:
TX:02 00 02 09 00 //AT+S.GCFG
nv_manuf=STMicroelectronics Inc.nv_model=SPWF04SAnv_serial=17111984nv_wifi_macaddr=00:80:E1:BD:00:39standby_time=10standby_enabled=0sleep_enabled=0etf_mode=0blink_led=1ext_volume=3ramdisk_memsize=16aes128_key=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00user_desc=anonymouspython_script=3:/uPython_test.pypython_memsize=32console_enabled=1console_speed=115200console_hwfc=0console_echo=1console_errs=2console_winds=2console_verbose=1console_repeater=0x21console_delimiter=0x2Cconsole_wind_off_low=0x00000000console_wind_off_medium=0x00000000console_wind_off_high=0x00000000wifi_tx_msdu_lifetime=0wifi_rx_msdu_lifetime=0wifi_operational_mode=0x00000011wifi_beacon_wakeup=1wifi_beacon_interval=100wifi_listen_interval=0wifi_rts_threshold=3000wifi_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:00wifi_ssid_len=7wifi_txfail_thresh=5wifi_dtim_period=1wifi_add_tim_ie=0wifi_region=1wifi_ht_mode=1wifi_channelnum=6wifi_opr_rate_mask=0x003FFFCFwifi_bas_rate_mask=0x0000000Fwifi_mode=3wifi_auth_type=0wifi_atim_window=0wifi_powersave=0wifi_tx_power=18wifi_rssi_thresh=0wifi_rssi_hyst=0wifi_ap_idle_timeout=120wifi_beacon_loss_thresh=10wifi_priv_mode=1wifi_wep_keys[0]=76:54:32:10:AB:00:00:00:00:00:00:00:00:00:00:00wifi_wep_keys[1]=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00wifi_wep_keys[2]=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00wifi_wep_keys[3]=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00wifi_wep_key_lens=05:00:00:00wifi_wep_default_key=0wifi_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:00wifi_wpa_psk_text=wifi_eap_identity=identitywifi_eap_anon_identity=anonymous@identity.orgwifi_eap_passwd=passwordwifi_eap_type=0wifi_eap_skip_datechecks=0wifi_wps_walk_time=120wifi_wps_pin=1234567ip_sock_memsize=1ip_sock_threshold=0ip_dhcp_lease_time=120ip_macfilter=00:00:00:00:00:00ip_num_clients=5ip_allow_port_scans=1ip_use_v6=1ip_use_dhcpd=1ip_use_httpd=1ip_use_tftpd=1ip_use_dhcpc=2ip_hostname=iwm-BD-00-39ip_apdomainname=captiveportal.netip_apredirect=firstset.htmlip_ipaddr=192.168.0.1ip_netmask=255.255.255.0ip_gw=192.168.0.1ip_dns1=192.168.0.1ip_dns2=208.67.220.220ip_local=0:0:0:0:0:0:0:0ip_dns1v6=0:0:0:0:0:0:0:0ip_dns2v6=0:0:0:0:0:0:0:0ip_dhcp_timeout=20ip_ntp_server1=ptbtime1.ptb.deip_ntp_server2=ntp0.ipv6.fau.deip_ntp_refresh=3600ip_ntp_startup=1ip_mdns_domain_name=SPWF04S-Defaultip_mdns_device_name_ttl=120ip_mdns_services_name=SPWF04S-WebSrv SPWF04S-TFTPSrvip_mdns_services_prot=_http._tcp _tftp._udpip_mdns_services_keys=dev1 dev2ip_mdns_services_vals=number1 number2ip_mdns_services_port=80 69ip_mdns_services_ttl=120 60ip_mdns_startup=01:01now 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:0RX:02 1A 48 13 00 AT+S.WIND:72:Station Disassociated:<wifistate=Ready to TX>:00:16:EA:E5:89:FE:1PS: 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
2017-08-10 10:20 AM
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.
2017-08-14 02:35 AM
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:
Best regards
2017-08-14 08:56 AM
> 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
2017-08-15 03:48 AM
well this is not documented anywhere, also how is this intended to be read? do I read 5 header bytes anyway? shouldnt the module do something afterwards, like restarting? For me it only stops blinking and wont start until I reset it via the reset line (
X-NUCLEO-IDW04A1
CN5, PIN 3 'WAKEUP'), is that so intended? I also attached a wireshark log from the client side (WIN7, TPLink Adapter TL-WN722N), my source code from my arduino, a screenshot of how the pc side looks like (mainly just for byte generation and header decoding) and 2 photos of the module and its jumper location, I hope this helps you debuggingbest regards
________________ Attachments : wifi_dhcp.pcapng.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyVn&d=%2Fa%2F0X0000000b8v%2F0Rd1QPwx5nA0jaXvS8APqxzrAJtsuFaD5C_RgD9ocxA&asPdf=falsewifi_test.ino.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyVd&d=%2Fa%2F0X0000000b8r%2FDtpwo4wWs0sjqbasUp4_zzfdQYqZEDBVQ4opTttX5fk&asPdf=falsefront.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyVY&d=%2Fa%2F0X0000000b8q%2F1T3Lk7tEUbpaRLRMYgoUKDTjTnMX2TXNl2vcXPNbxFs&asPdf=falseback.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyVT&d=%2Fa%2F0X0000000b8p%2FePNiaAU4XWs1iHMOpf.L27bfS5T3RKafjd5rcr0ZCNs&asPdf=falsegui.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy9z&d=%2Fa%2F0X0000000b8o%2FzuUy5JXj65mOJai6eC4kKDXYKBbCaBdvjH.SyjioNVg&asPdf=false2017-08-18 10:12 AM
When you issue the reset command then you should expect an answer like for all others commands, so yes, you should wait for INT line low and read the answer.
The reason for the module to not reboot after AT+S.RESET might be the configuration of RSTpin. Please try setting it as
OUTPUT_OPEN_DRAIN instead of OUTPUT.
About the wireshark log, unfortunately it is not useful. The complete traffic is needed to verify if the SPWF04 answers to the Discover frames (that is what we expect) and if the PC is discarding some frame and why.
2017-08-22 01:30 AM
The reason for the module to not reboot after AT+S.RESET might be the configuration of RSTpin. Please try setting it as
OUTPUT_OPEN_DRAIN instead of OUTPUT.
there is no such thing as
OUTPUT_OPEN_DRAIN
in arduino world, but I solved this issue with following code:void ResetModule(){ digitalWrite(RSTpin, INPUT_PULLUP); pinMode(RSTpin, OUTPUT); Serial.println('Reset module...'); digitalWrite(RSTpin, LOW); delay(100); Serial.println('Start module...'); digitalWrite(RSTpin, HIGH); delay(100); Serial.println('Done.'); pinMode(RSTpin, INPUT);}it makes the pin only output for the time it needs to reset the modul (at start or on command) and then reverts it back to an input. now the module starts again after replying with 02 32 02 00 00 (hex) but I guess all it does is toggle that pin itself, no?
About the wireshark log, unfortunately it is not useful. The complete traffic is needed to verify if the SPWF04 answers to the Discover frames (that is what we expect) and if the PC is discarding some frame and why.
what do you mean?! this IS the entire traffic! what am I supposed to record elsewise? this is wireshark recording how a TP-LINK TP-WN722N WLAN stick attempts to connect, there are no packets coming in otherwise, even in monitor mode. I also gave you a log of 3 variants of what the module says over SPI and it clearly sees the station, associates it and then doesnt even tell it send some dhcp reply or got a request. again, when I downgrade the firmware to the old version it all works fine, but then I can not send replys because those spi commands (AT+S.SOCKDW f.e.) need their special format for the appended data (please add this to the datasheet, I only guessed it!) and that doesnt work in the old firmware. So im stuck either way
2017-09-04 12:27 AM
hello again,
is there any update on this yet? if I dont get this to work, we cant use this in our products
Best regards
2017-09-04 06:10 AM
Hi.
If you have socket write problem it might be related to same issue i had:
https://community.st.com/0D50X00009XkYRKSA3
The Cube driver assumes only string payload (unlike the old SPWFSA01) and I think the SPWF04 side assumes same thing too. I've heard about revised driver to be upcoming since end of July. Dunno what year though
:)
.2017-09-04 06:21 AM
thanks, but my problem is the DHCP server, I dont even get an IP assigned, it sees, yes someone wants to connect to the AP, (associates it) but no IP is given out (DHCP not doing its job). So no way to get to sockets yet (except ofc I used the downgraded firmware again with all it bugs, like not beeing able to write to sockets). I guess we simply have to look for a module from another vendor, this is not usable in products this way (maybe on the slower UART protocol, but we dont use that if faster SPI exists)
thanks anyway