Some code for the WiPy board, facilitating setup network and running code from the SD card.
Assuming the ExpansionBoard is present.
- activate REPL on serial port
- try to connect to home network (in STA mode), fall back to AP mode if that fails.
- mount the SD card to
/sd - add
/sd/libtosys.pathand execute/sd/main.pyon SD card - a tool to sync files from the PC with the WiPy (via FTP)
Note
The default fallback to AP mode is a security risk as the netowork name and passwort may be known (unless they were changed in the source code here)
The wipy-ftp.py can be used to upload the files. For first time usage
(assuming the WiPy is in AP mode with default settings, PC connected to this
AP):
python3 wipy-ftp.py install INFO:FTP:put /flash/boot.py INFO:FTP:put /flash/main.py INFO:FTP:put /flash/lib/expansionboard.py INFO:FTP:put /flash/lib/autoconfig.py Connect to an access point? [Y/n]: y Enter SSID: <your SSID> Enter passphrase: <your password>
Warning
wipy-ftp.py install Overwrites files without asking. Backup The files
before running this tool when the WiPy was used before.
Once the WiPy connects to a router, its IP address must be updated in
wipy-ftp.ini.
wipy-ftp.py is a tool to upload/download files via FTP.
Usage: wipy-ftp.py [-v --defaults] ACTION [ARGS]
-v, --verbose print more diagnostic messages --defaults ignore .ini file and use defaults ACTIONS are:
write-inicreatewipy-ftp.iniwith default settingsinstallcopy boot.py, main.py and /lib from the PC to the WiPysync-libcopies only /libsync-topcopies only boot.py, main.pyconfig-wlanask for SSID/Password and write wlanconfig.py on WiPylswith optional path argument: list filescatwith filename: show text file contentsupgradewrite mcuimg.bin file to WiPy for firmware upgradehelpthis text
For configuration, a file called wipy-ftp.ini must be present with the
following contents:
[FTP] server = 192.168.1.1 user = micro pass = python
The default file can be created by running wipy-ftp.py write-ini.
These settings need to be changed, once the WiPy is connected to an access point.
The contents of device/flash goes to the WiPy internal flash memory. The
contents of device/sd goes onto the SD card.
The WLAN configuration for STA mode are stored in flash/wlanconfig.py on
the WiPy. This file is written by the config-wlan action. The security/WPA
mode have to be changed in /lib/autoconfig.py, the default is WPA2.
- WiPy (homepage)
- WiPy manual
WiPy Pins:
. _______________
| HB RST |
SAFEBOOT GP28 | | GP3
GP22 | | GP4
S1 GP17 | | GP0
LED GP16 | | GP3 VBATT
SD_DAT0 GP15 | | GP31
GP14 | | GP30
GP13 | | GP6 FT_CTS
GP12 | | GP7 FT_RTS
SD_CMD GP11 | | GP8
GP24 | | GP9
GP23 | | GP10 SD_CLK
FT_TXD GP1 | | +3V3
FT_RXD GP2 | | GND
RESET | | Vin
\ ##### /
\ ##### /
\ ##### /
---------