ATTENTION:
this are obsolete products.
No longer support from STM.
- Introduction
- How to connect X-NUCLEO-IDW04A1 evaluation board to the PC
- uPython Interactive Console
- Configuration Variables
- GPIO
Introduction
The X-NUCLEO-IDW04A1 Wi-Fi evaluation board is based on the SPWF04SA module. The SPWF04SA module has an embedded STM32 MCU, a low-power Wi-Fi b/g/n SoC with integrated power amplifier and power management, and an SMD antenna.
The SPWF04SA module relies on 2 MB MCU internal Flash. 1 MB of the internal Flash is for storing the user file system and to perform secure firmware update over the air (FOTA).
A hardware interface allows the use of external memory to extend file system storage capability with no size limit.
The firmware includes a complete IP stack, dynamic web pages with SSI to interact with the module and a REST API (get & post) for conveniently transferring files to and from servers in the cloud.
The module can simultaneously behave as a socket server and socket client.
The firmware supports secure sockets with TLS encryption, ensuring secure end-to-end communications with the cloud.
The X-NUCLEO-IDW04A1 interfaces with the MCU on the STM32 Nucleo board via the UART serial port and/or SPI interface.
Go on TOP
How to connect SPWF04Sx evaluation board to the PC
For connect SPWF04Sx evaluation board to the PC, I suggest to use the STM Serial to USB bridge (STEVAL-PCC018V1) see the image below.
On PC we use TeraTerm.
Please install on your PC:
The TeraTerm must be configured as shown below.
For test the connection between PC/TeraTerm and the WiFi evaboard type, in Tera Term, the command: AT
You must see the response: OK
See below.
Go on TOP
uPython Interactive Console
• REPL- MicroPython Interactive Console
REPL stands for Read Evaluation Print Loop and it is the std name given to the interactive MicroPython Prompt that is also enabled on SPWF04S.
Typically used for debugging purposes, it is by far the easiest way to test interactively the code and run commands.
On SPWF04S, AT+S.python command launched without parameters and the CTRL-D escape character are respectively used to enter and to leave the REPL.
• Run Time Script execution
When the UART console is set on the module a python script can be launched by using the AT+S.python command with the script specified as its parameter.
MicroPython scripts are developed using a standard offline text editor, and then moved for execution on SPWF04S Wi-Fi module.
After the script execution, the control returns to the UART AT Console.
• Hard Script Execution
By using the GPIO(8) set to high at the boot time, or when console_enabled is set to 3, the module automatically enters the execution of the script specified by the configuration variable “python_script”.
This mode allows to use the module without a connected host.
Note that console_enabled is not changed by GPIO(8) access:
this means that on following reboot, to access again the python mode, GPIO(8) must be high again.
The Figure below summarizes the MicroPython modes described above.
Go on TOP
Configuration Variables
_
console_enabled
This variable is defined to set the console on SPWF04S.
The values that enable the usage of Micropython are two as it is summarized in the Table below
console_enabled=2 (aka UART_PYTHON Mode)
This setting allows using MicroPython together with the UART console and by referring to the MicroPython modes it enables both the REPL and the Run time script modes.
console_enabled=3” (aka PYTHON_ONLY Mode)
this setting allows only a MicroPython preloaded script to be executed.
No UART/SPI communication is allowed to/from an Host processor when this mode is enabled.
Setting | Mode | Notes | |
Console-enabled=1 | UART_ONLY | Default at shipment | Enable the usage of the UART console |
Console-enabled=0 | SPI_ONLY | – | Enable the usage of the SPI console |
Console_enabled=2 | UART_PYTHON | – | Enable the activation of REPL and Micropython scripts via an AT Command |
Console_enabled=3 | PYTHON_ONLY | – | Activate the execution of a python script at the boot time |
python_memsize
To choose the amount of memory to reserve for MicroPython script/REPL execution.
The default value is 32 (in unit of 1024 bytes).
python_script
Identifies the script to be executed when console_enabled is set to 3 (PYTHON_ONLY).
The default value is “3:/uPython_test.py” (a ROM resident example script).
Go on TOP
GPIO
GPIO(8)
This GPIO has been reserved to enter PYTHON_ONLY mode via HW, no matter console_enabled configuration variable value is set to.
If GPIO(8) level is high at startup, than MicroPython script pointed by python_script configuration variable is executed, and AT command/SPI protocol cannot be used.
GPIO(14)
(aka PWR_LED).
When Micropython is active the GPIO(14), PWR_LED, is driven to make some execution steps visible with a LED connected to that GPIO.
See Table below for specific behaviors in the different use modes.
Note.
This function is disabled when GPIO(14) is used as the MOSI signal in a SPI connection.
mode |
device setting |
to enter the mode |
pwr_led |
UART_PYTHON, REPL USAGE |
AT+S.SCFG=console_enabled,2 AT+S.SCFG =python_memsize,32 GPIO(8) : low |
AT+S.PYTHON
Note 1. The command will return the string: “AT-S.OK MicroPython v0.0.1-84-g7f202fb-dirty on 2016-07-13; SPWF04Sx with STM32F439 >>>” Note 2. See paragraph 2.2 for a list of possible REPL commands. |
The PWR_LED is on when REPL is active |
UART_PYTHON , SCRIPT Execution |
AT+S.SCFG=console_enabled,2 AT+S.SCFG =python_memsize,32 GPIO(8): low |
AT+S.PYTHON=LED.py Note 1. The command will result into: “AT-S.Launching script:2:LED.py AT-S.OK …script output here… +WIND:0:Console active” Note2. When an error is detected by MicroPython engine, than execution is stopped, and error is displayed on REPL prompt, before closing it, and coming back to AT commands shell. Example: |
The PWR_LED is on when the scripts is running. |
PYTHON_ONLY , HW Driven |
AT+S.SCFG =python_memsize,32 AT+S.SCFG =python_script, 3:/uPython_test.py GPIO(8): high |
At every reboot , the GPIO(8) is checked. If high, the scripts pointed by the python_script variable is executed no matter the value of console_enabled is |
The PWR_Led is ON at the startup, OFF when the script starts, TOGGLE when the script finish (if any) |
PYTHON_ONLY , variable driven |
AT+S.SCFG=console_enabled,3 AT+S.SCFG =python_memsize,32 AT+S.SCFG =python_script, 3:/uPython_test.py GPIO(8): low |
At every reboot the script pointed by the python_script variable is executed. |
The PWR_Led is ON at the startup, OFF when the script starts, TOGGLE when the script finish (if any) |
Go on TOP