mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 10:05:56 +01:00
Merge pull request #330 from pycom/wifionboot
added ap on boot information
This commit is contained in:
@@ -89,11 +89,18 @@ Allows you permanently disable or enable the heartbeat LED. Once this setting is
|
||||
### pycom.lte_modem_on_boot([boolean])
|
||||
|
||||
Get or set the LTE modem on boot flag. When this flag is set to `True`, the LTE modem will be enabled.
|
||||
|
||||
### pycom.wifi_on_boot([boolean])
|
||||
|
||||
Get or set the WiFi on boot flag. When this flag is set to `True`, The WiFi will be enabled according to the other WiFi settings. when `False` the WiFi module will be disabled untill enabled directly via WLAN class.
|
||||
Get or set the WiFi on boot flag. When this flag is set to `True`, The WiFi will be enabled according to the other WiFi settings. when `False` the WiFi module will be disabled until enabled directly via WLAN class. This setting is stored in the non-volatile memory which preserves it across resets and power cycles. See [FTP & Telnet](/gettingstarted/programming/ftp/) for more information on possible usage.
|
||||
|
||||
This setting is stored in non-volatile memory which preserves it across resets and power cycles.
|
||||
### pycom.wifi_mode_on_boot(mode)
|
||||
|
||||
Set or get the Wifi Mode at startup, valid options are:
|
||||
* `WLAN.STA`
|
||||
* `WLAN.AP`
|
||||
* `WLAN.APSTA`
|
||||
This setting is stored in non-volatile memory which preserves it across resets and power cycles
|
||||
|
||||
### pycom.wifi_ssid_sta([ssid])
|
||||
|
||||
@@ -102,7 +109,7 @@ This setting is stored in non-volatile memory which preserves it across resets a
|
||||
|
||||
### pycom.wifi_ssid_ap([ssid])
|
||||
|
||||
Get or set the ssid of the Access point that should be started by the device at startup, if not set and startup Wifi mode is AP the default AP name (`Board_Name>-wlan-<last_4_digits_mac`) will be used.This setting is stored in non-volatile memory which preserves it across resets and power cycles
|
||||
Get or set the ssid of the Access point that should be started by the device at startup, if not set and startup Wifi mode is AP the default AP name (`xxpy-wlan-####`) will be used. This setting is stored in non-volatile memory which preserves it across resets and power cycles.
|
||||
|
||||
### pycom.wifi_pwd_sta([key])
|
||||
|
||||
@@ -120,10 +127,6 @@ Read or (Enable/Disable) SmartConfig functionality on startup, this flag will be
|
||||
|
||||
Read or (Enable/Disable) SmartConfig functionality on startup, this flag will be reset after successful completion of the smartConfig process after startup.This setting is stored in non-volatile memory which preserves it across resets and power cycles
|
||||
|
||||
### pycom.wifi_mode_on_boot([boolean])
|
||||
|
||||
Set or get the Wifi Mode at startup , `WLAN.STA`, `WLAN.AP` or `WLAN.APSTA`.This setting is stored in non-volatile memory which preserves it across resets and power cycles
|
||||
|
||||
### pycom.wdt_on_boot_timeout([timeout])
|
||||
|
||||
Sets or gets the WDT on boot timeout in milliseconds. The minimum value is 5000 ms.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
There are several ways to upload Python code to your device. On the following pages, we highlight the alternative (e.g. not using an expansion board) methods:
|
||||
|
||||
* [USB Serial](usbserial/)
|
||||
* [FTP & Telnet](ftp/)
|
||||
|
||||
And lastly, we discuss the [Safe boot](safeboot/) feature.
|
||||
@@ -6,36 +6,70 @@ aliases:
|
||||
- chapter/gettingstarted/programming/ftp
|
||||
---
|
||||
|
||||
There is a small internal file system accessible with each Pycom device, called `/flash`. This is stored within the external serial flash memory. If a microSD card is also connected and mounted, it will be available as well. When the device starts up, it will always boot from the `boot.py` located in the `/flash` file system.
|
||||
This page discusses the possibility to upload files through the internal FTP server and access the REPL through a Telnet connection.
|
||||
|
||||
The first time(s), your device will create an Access Point (AP) you can connect to using your computer's WiFi.
|
||||
On each Pycom device, there is a small internal filesystem called `/flash`, to which the Python code is uploaded. We can access this filesystem through an internally running FTP server, that allows us to make changes to the files. Next to that, a Telnet connection can be made to communicate with the device through the REPL.
|
||||
## Connecting
|
||||
1. **Connect through the Access Point**
|
||||
|
||||
By default, the device will create a WiFi access point with the following credentials:
|
||||
* SSID: `xxpy-wlan-####`
|
||||
* Password: `www.pycom.io`
|
||||
By default, the Pycom device will create a WiFi access point with the following default credentials:
|
||||
* SSID: `xxpy-wlan-####`
|
||||
* Password: `www.pycom.io`
|
||||
|
||||
>Note: This method of connection is not recommended for first time users. It is possible to lock yourself out of the device, requiring a USB connection.
|
||||
The last 4 characters of the broadcast SSID are equal to the last 4 characters of the `unique_id()`:
|
||||
```python
|
||||
import machine
|
||||
import ubinascii
|
||||
ubinascii.hexlify(machine.unique_id())
|
||||
```
|
||||
|
||||
Once connected to this network you will be able to access the telnet and FTP servers running on the LoPy4.
|
||||
Note that if you made changes to the WiFi settings, the AP might not show up by default. You can use the following to get it back up and running:
|
||||
```python
|
||||
import pycom
|
||||
from network import WLAN
|
||||
pycom.wifi_on_boot(True)
|
||||
pycom.wifi_mode_on_boot(WLAN.AP)
|
||||
```
|
||||
|
||||
The file system is accessible via the native FTP server running on each Pycom device. Open an FTP client and connect to:
|
||||
> You can find the methods to change the default settings [here](/firmwareapi/pycom/pycom/#boot-methods)
|
||||
|
||||
2. **Connect through A WiFi Network**
|
||||
|
||||
It is also possible to connect your pycom device to a WiFi network first, and then connect to its IP address. Note that you will have to figure out its IP address before you can access the FTP server. For that, you can use the following command. This will return a tuple with four items, where the first item will contain the assigned IP address.
|
||||
```python
|
||||
wlan.ifconfig()
|
||||
```
|
||||
> Note that if you make changes to the WLAN Configuration in the uploaded Python code, the connection might drop. Moreover, if your program contains continuous reboot loops, sleep cycles or coredumps, you might not be able to recover the wireless connection without [safe booting](../safeboot/)
|
||||
## FTP Server
|
||||
The file system is accessible via the native FTP server running on each Pycom device. Open a FTP client and connect to:
|
||||
|
||||
* url: `ftp://192.168.4.1`
|
||||
* username: `micro`
|
||||
* password: `python`
|
||||
|
||||
See [network.server](/firmwareapi/pycom/network/server/) for information on how to change the defaults. The recommended clients are:
|
||||
> See [network.server](/firmwareapi/pycom/network/server/) for information on how to change the default credentials.
|
||||
|
||||
* macOS/Linux: default FTP client
|
||||
|
||||
## Telnet server
|
||||
You can use the same credentials to connect to the telnet server to bring up the REPL:
|
||||
```bash
|
||||
telnet 192.168.4.1
|
||||
```
|
||||
Note that the REPL works exactly the same over Telnet as it does through Pymakr.
|
||||
|
||||
## Clients
|
||||
The recommended clients are:
|
||||
* macOS/Linux: default FTP / Telnet client
|
||||
* Windows: Filezilla and FireFTP
|
||||
|
||||
For example, from a macOS/Linux terminal:
|
||||
|
||||
```bash
|
||||
$ ftp 192.168.4.1
|
||||
ftp 192.168.4.1
|
||||
telnet 192.168.4.1
|
||||
```
|
||||
|
||||
The FTP server doesn't support active mode, only passive mode. Therefore, if using the native unix FTP client, immediately after logging in, run the following command:
|
||||
The FTP server doesn't support active mode, only passive mode. Therefore, if you are using the native unix FTP client, run the following command after logging in:
|
||||
|
||||
```bash
|
||||
ftp> passive
|
||||
@@ -43,7 +77,7 @@ ftp> passive
|
||||
|
||||
The FTP server only supports one connection at a time. If using other FTP clients, please check their documentation for how to limit the maximum allowed connections to one at a time.
|
||||
|
||||
## FileZilla
|
||||
### FileZilla
|
||||
|
||||
If using FileZilla, it's important to configure the settings correctly.
|
||||
|
||||
@@ -55,3 +89,7 @@ In the `Transfer Settings` tab, limit the max number of connections to one. Othe
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user