background image

Introduction

The SPWF04Sx series of Wi-Fi modules integrate a complete TCP/IP protocol stack and a rich set of applications including, but
not limited to, web server, web client RESTful API, TFTP, MQTT and SMTP.

Security is added in the multiple layers of Wi-Fi and peer-to-peer protocols. The stack implements the WPS protocol, WPA2 in
both the Personal and Enterprise options, and the TLS for end-to-end secure transactions.

Users access the features of the SPWF04Sx modules via UART using the simple AT command syntax, or via SPI using a
custom packet format and protocol.

To enable a complete customization of the application on the module, the SPWF04Sx software integrates a MicroPython
interpreter that provides the user with MicroPython standard libraries and a customized set of classes to export the specific
SPWF04Sx features.

The diagram below summarizes the possible integrations of an SPWF04Sx module in a target application.

Figure 1. 

SPWF04Sx user integration modes

This user manual is intended as a guide to the set of commands available on the UART or the SPI console. A description and
explanation of the configuration variables, status variables and asynchronous indication messages is available in the Appendix
of the manual.

This manual is not intended as a technical guide of Wi-Fi and TCP/IP, or other technologies available in the module.

TCP/IP protocol stack for SPWF04Sx Wi-Fi modules 

UM2114

User manual

UM2114

 - 

Rev 3

 - 

November 2018

For further information contact your local STMicroelectronics sales office.

www.st.com

Содержание SPWF04S Series

Страница 1: ...tes a MicroPython interpreter that provides the user with MicroPython standard libraries and a customized set of classes to export the specific SPWF04Sx features The diagram below summarizes the possi...

Страница 2: ...itecture of SPWF04S is shown in the diagram below Figure 2 SPWF04Sx software architecture A block diagram of the SPWF04Sx protocol stack is provided in Figure 3 SPWF04Sx protocol stack diagram UM2114...

Страница 3: ...Figure 3 SPWF04Sx protocol stack diagram UM2114 SPWF04Sx software architecture description UM2114 Rev 3 page 3 66...

Страница 4: ...interpreter MicroPython scripts can map a target application making it unnecessary to integrate the device with an external processor The following four message types represent the type of data exchan...

Страница 5: ...data 0x25 AT S FSD Delete file 0x26 AT S FSR Rename file 0x27 AT S FSL List existing files 0x28 AT S FSP Print file content 0x29 AT S HASH Compute digest Security commands to interact with the securit...

Страница 6: ...S WSOCKW Write data to a web socket client 0x65 AT S WSOCKR Read data from web socket client 0x66 AT S WSOCKL List open web socket client Trivial FTP 0x51 AT S TFTPGET Get request to a TFTP server 0x5...

Страница 7: ...unique The descriptive string may be safely ignored Note that error_code and error_string are shown depending on the console_errs configuration variable value 0 to 2 Command parameters A command can...

Страница 8: ...ly data are filled into payload field Table 3 Indication number field Event type Bits 4 7 Indication number 0x01 Refer to Table 14 WIND messages 0x02 Refer to Table 10 AT S ERROR ERROR ID ERROR String...

Страница 9: ...rameter 0x09 scan txt 3 Full message payload length 0x0D Result SPI Message 0x02 0x00 0x0D 0x33 0x02 0x01 d 0x09 scan txt Third example AT command AT S SOCKW 0 5 Cr hello 1 Command ID 0x44 2 Number of...

Страница 10: ...purposes it is activated by the AT S Python Python command launched without parameters The REPL is exited by using a CTRL D escape character Run Time Script execution Activated with the Python comman...

Страница 11: ...ul for testing the module interface for readiness Usage AT cr Parameters None 6 2 AT S HELP AT S HELP prints the list of all the AT commands supported with a brief help text for each of them Refer to...

Страница 12: ...additional information about the module connected to the AP or about the client connected to the module when it is configured in Mini AP mode Usage 1 AT S PEERS cr returns the list of peers variable...

Страница 13: ...ower states and configuration Module state Mode option value STM32 state WLAN state AT variable default values Active 0 Run Rx Idle Rx Active Tx Active AT S SCFG sleep_enabled 0 AT S SCFG wifi_powersa...

Страница 14: ...be executed After the execution of the script the command returns to the AT console 6 8 AT S GCFG This command lists all the configuration variables together with their current value Usage 1 AT S GCFG...

Страница 15: ...ariables from the Flash It is mandatory to run a reset HW or SW after a factory restore Usage AT S FCFG cr Note HW factory restore of the variables is performed by pulling the pin GPIO0 high at power...

Страница 16: ...secured 1 autodetect 2 TLS username Default none passwd Default none 6 14 AT S FWUPDATE This command downloads an updated firmware image located at the named host and path The downloaded image is temp...

Страница 17: ...interrupt when the state changes that can be configured on the signal edge Usage 1 AT S GPIOC number out cr to configure a gpio as an output 2 AT S GPIOC number in interrupt cr to configure a gpio as...

Страница 18: ...value 0 1 for the specified GPIO 6 18 AT S DAC The DAC command enables DAC on GPIO15 Usage AT S DAC value cr Parameters value must be set in mV between 1 and 3300 The value 0 disables DAC on GPIO15 6...

Страница 19: ...100 range 6 21 AT S TIME Command to get or set the time date time Usage 1 AT S TIME cr returns the current date in the format AT S Date yy mm dd nn and the current time in the format AT S Time hh mm s...

Страница 20: ...d external SD card volume The command creates a file in the selected volume or appends the data following the command in case the file already exists The space available in the file system in RAM can...

Страница 21: ...names together with their prefix that indicates where they are stored and the size X External Flash Volume ID 0 E User Flash stored at STM32F439 address 0x08110000 Volume ID 1 D RAM Volume ID 2 I Appl...

Страница 22: ...len cr Note that Volume ID 1 Application Flash when protected app_fs status variable set to 2 does not allow print on selected file Parameters filename name of the file to be printed offset Default V...

Страница 23: ...AT S SHA224 digest or AT S SHA256 digest or AT S MD5 digest digest Specifies the digest of given file 6 31 AT S WPAECERT To manage WPA certificates in the module Flash memory Usage AT S WPAECERT cont...

Страница 24: ...type of certificate format loaded DER or PEM the subject key identifier is automatically found by the module itself The auth parameter is only required when loading PEM format Usage AT S TLSCERT conte...

Страница 25: ...WIFI AT S WIFI allows the radio to be enabled or disabled at run time Please note that the configuration variable wifi_mode controls the state of the radio at power up Usage AT S WIFI action cr Parame...

Страница 26: ...n Parameters ssidtxt SSID in textual format Result AT S Network SSID SSID Specifies the SSID of current configured network 6 37 AT S PING Send a single ICMP ECHO request to a specified remote host Whe...

Страница 27: ...meter can assume the values t tcp u udp s TLS socket using Hostname as domain name TLS Server Domain Name Common name of the server URL or the CN field reported into server certificate for TLS socket...

Страница 28: ...shing pending data using the AT S SOCKR command is mandatory before closing the socket connection AT S SOCKC If the buffer is not empty the ERROR Pending data is raised 6 41 AT S SOCKW To write data t...

Страница 29: ...socket client len Specifies the number of bytes in socket client buffer IP Specifies the server IP address port Specifies the client port 6 44 AT S SOCKDON To open a socket server The device can mana...

Страница 30: ...to disconnect a client Usage AT S SOCKDC sid to close the specified socket server and disconnect all clients AT S SOCKDC sid cid to disconnect the specified client if client_id is given If not all cl...

Страница 31: ...DR To read data from a socket server Usage AT S SOCKDR sid cid len cr Parameters sid socket server identifier cid socket client identifier len Default 0 length in bytes of the buffer to read The value...

Страница 32: ...r Usage AT S TFTPGET hostname port filename local_filename cr Parameters hostname DNS resolvable name or IP address of the TFTP remote server port Default 69 Socket UDP port filename filename to get f...

Страница 33: ...he SMTP server passwd Password of the SMTP server ID Default nv_model used during Helo address Email address on the SMTP server to Email recipients Multiple emails are separated by a semicolon A recip...

Страница 34: ...document path optional query arguments port Default 80 if TLS 0 or 443 if TLS 0 TLS Default 0 Values range 0 unsecured 1 autodetect 2 TLS username Default none passwd Default none in_filename Default...

Страница 35: ...byte is used as a token splitter so use this special character to fill the buffer with multiple tokens Every token can be directly referred remotely by SSI indexes contained inside the HTML page For e...

Страница 36: ...ished on the Last Will Topic Result AT S On id session id Specifies the MQTT client identifier session 0 new session or 1 session restored 6 57 AT S MQTTPUB To publish a message to an MQTT broker Usag...

Страница 37: ...usage of two web socket clients The command returns the ID that is used in the corresponding commands The MQTT layer is built on top of web sockets This means that when an MQTT broker has been connect...

Страница 38: ...efault none Header Field Extensions Result AT S On id id Specifies the Web Socket client identifier 6 62 AT S WSOCKQ To query web socket client for pending data Usage AT S WSOCKQ id cr Parameters id W...

Страница 39: ...AT S WSOCKC If the buffer is not empty the ERROR Pending data is raised 6 64 AT S WSOCKW To write data to a web socket Usage AT S WSOCKW id last_frame last_frag binary len cr data Parameters id Web so...

Страница 40: ...Specifies the Web Socket client identifier connected Specifies wheter Web Socket client is connected to Web socket server len Specifies the number of bytes in Web Socket client buffer port Specifies...

Страница 41: ...Table 6 Technology partners Partner Device description Part number MACRONIX 8 Mbit CMOS Serial Flash memory MX25L8006E MACRONIX 64 Mbit CMOS Serial Flash memory MX25L6433F UM2114 Technology partners U...

Страница 42: ...disk_memsize 16 INT Heap size dedicated to RAM disk in unit of 1024 byte aes128_key 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 HEX 16 AES 128 key used to encrypt FOTA image user_desc anonymous TE...

Страница 43: ...eshold 3000 INT Frame size over which RTS CTS is used Limit from 0 to 3000 wifi_ssid 53 54 54 65 73 74 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 HEX 32 Can be get s...

Страница 44: ...9 5Mbps BIT17 MCS3 26Mbps BIT18 MCS4 39Mbps BIT19 MCS5 52Mbps BIT20 MCS6 58 5Mbps BIT21 MCS7 65Mbps wifi_bas_rate_mask 0x0000000F INT Basic data rate mask 0x0000000f is 1 2 5 5 11 wifi_mode 1 INT Radi...

Страница 45: ...ns 00 00 00 00 HEX 4 Four octets specifying the length of the actual key data in each WEP key buffer wifi_wep_default_key 0 INT WEP key index wifi_wpa_psk_raw 00 00 00 00 00 00 00 00 00 00 00 00 00 00...

Страница 46: ...TEXT 32 Domain name in Mini AP mode If the AP domain name is not quickly opened it s suggested to turn off an eventual proxy server check the connection settings of the device or the browser preferen...

Страница 47: ...s is generated by the command AT S STS Table 8 Status variables Status variable Value Note build 170216 fd39c59 SPWF04S SW Build Version fw_version 1 0 0 SW Major Version boot_version 1 0 Boot Version...

Страница 48: ...ax_tx_power 18 max allowed transmit power for the defined regdomain wifi_gf_mode 0 Greenfield high throughput mode wifi_reg_country IT Current regulatory domain wifi_dtim_period 1 AP reported DTIM per...

Страница 49: ...pkts 24 Count of transmitted frames tx_errs 0 Count of errors detected during frame transmit rate_mask 0x00003FCF AP reported Operational data rate mask cur_rate_idx 3 Most significant byte of the rat...

Страница 50: ...d value 9 Reserved 10 Reserved 11 Reserved 12 Reserved 13 Reserved 14 Reserved 15 Reserved 16 Cannot switch to Python shell 17 Radio enabled 18 Radio not running 19 Direction must be in or out 20 Inva...

Страница 51: ...n file 52 Unable to seek file 53 Unable to read file 54 Unable to close file 55 Unable to rename file 56 Unable to delete file 57 Unable to open directory 58 Unable to read directory 59 Unable to un m...

Страница 52: ...85 Reserved 86 Reserved 87 Reserved 88 Reserved 89 Reserved 90 Reserved 91 Low Memory 92 Reserved 93 Reserved 94 Reserved 95 Reserved 96 Reserved 97 Reserved 98 Reserved 99 Scan Aborted 100 Failed to...

Страница 53: ...TCP Syn 2 Error or timeout while TCP Connect 3 HTTP Client refused connecting to server 4 Timeout while receiving TCP data 5 Received unexpected TCP Disconnect while sending 6 Error while sending TCP...

Страница 54: ...Id 16 Desired key usage is not permitted 17 Basic constraints are not good 18 Parsing the AuthorityKeyId extension failed 19 The certificate is not supported 20 The certificate has been revoked 21 The...

Страница 55: ...hen RAM disk cannot be created 8 Hard Fault s 08x 8 Task name STM32 registers content 9 StackOverflow s Task name 10 Malloc Failed s d d Task name Required Size Available Size 11 Radio Startup Failure...

Страница 56: ...0003 shown when cw1100 cannot be configured after join operation Shown when cw1100 reply status is evaluated as bad 21 WiFi Scanning 22 Scan Blew Up 23 Scan Failed 04x Cw1100 reply status 24 WiFi Up...

Страница 57: ...ng Data u u u u Server ID Client ID Received bytes cumulative bytes 56 Input to remote u Input ID Only printed when buffer for input request is empty Buffer is filled and cleared by AT S INPUTSSI comm...

Страница 58: ...tandby Time 68 Resuming from Standby 69 Going into DeepSleep 70 Resuming from DeepSleep 71 Reserved 72 Station Disassociated m u Peer MAC Address reason code 73 System Configuration Updated 74 Rejecte...

Страница 59: ...ease time smaller than 50s 6 Shown when DHCP Lease Time expired 86 MQTT Published u s u u u u u s Client ID topic QoS retain dupl msg siz tot siz msg 87 MQTT Closed u u Closure reason 0 connection lev...

Страница 60: ...v 2017 2 Added un maskable results for AT Commands Added FW1 1 0 new features Added part number in Table 6 Technology partners 27 Nov 2018 3 Update Section 1 SPWF04Sx software architecture description...

Страница 61: ...AT S STS 11 6 4 AT S PEERS 12 6 5 AT S RESET 13 6 6 AT S PMS 13 6 7 AT S PYTHON 14 6 8 AT S GCFG 14 6 9 AT S SCFG 14 6 10 AT S WCFG 15 6 11 AT S FCFG 15 6 12 AT S FSWRITE 15 6 13 AT S FSUPDATE 16 6 1...

Страница 62: ...S SCAN 25 6 36 AT S SSIDTXT 26 6 37 AT S PING 26 6 38 AT S SOCKON 26 6 39 AT S SOCKQ 27 6 40 AT S SOCKC 28 6 41 AT S SOCKW 28 6 42 AT S SOCKR 28 6 43 AT S SOCKL 29 6 44 AT S SOCKDON 29 6 45 AT S SOCKD...

Страница 63: ...UNSUB 37 6 61 AT S WSOCKON 37 6 62 AT S WSOCKQ 38 6 63 AT S WSOCKC 38 6 64 AT S WSOCKW 39 6 65 AT S WSOCKR 39 6 66 AT S WSOCKL 39 7 Technology partners 41 8 Variables and values 42 9 Synchronous error...

Страница 64: ...ERROR ID ERROR String 50 Table 11 AT S WebSocket Client Error Error ID 53 Table 12 AT S Http Client Error Error ID 53 Table 13 AT S Certificate Error Error ID 53 Table 14 WIND messages 54 Table 7 Con...

Страница 65: ...egration modes 1 Figure 2 SPWF04Sx software architecture 2 Figure 3 SPWF04Sx protocol stack diagram 3 Figure 4 SPI packet formats 8 Figure 5 MicroPython modes 10 Figure 6 AP capabilities list 25 UM211...

Страница 66: ...the choice selection and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products No license express or implied to any intellectual property righ...

Отзывы: