From 7dfc57791bd1125af052c3bd82d2a9a4adb45635 Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Mon, 21 Sep 2020 12:01:34 +0200 Subject: [PATCH 1/6] added ap on boot information --- content/firmwareapi/pycom/pycom.md | 17 ++++++++++------- content/gettingstarted/programming/ftp.md | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/content/firmwareapi/pycom/pycom.md b/content/firmwareapi/pycom/pycom.md index ba929cd..92ed327 100644 --- a/content/firmwareapi/pycom/pycom.md +++ b/content/firmwareapi/pycom/pycom.md @@ -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- 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. + 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. The first time(s), your device will create an Access Point (AP) you can connect to using your computer's WiFi. @@ -14,7 +16,22 @@ By default, the device will create a WiFi access point with the following creden * 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. +> If the WiFi network does not show up by default, use the following: +>```python +> import pycom +> from network import WLAN +> pycom.wifi_on_boot(True) +> pycom.wifi_mode_on_boot(WLAN.AP) +> ``` +> The last 4 characters of the broadcast SSID are equal to the last 4 characters of the `unique_id()`: (Except if the AP SSID was set previously) +> ```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. From c8f1a52ee8a77608444d7e4fd62b48118e178992 Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 25 Sep 2020 10:31:44 +0200 Subject: [PATCH 2/6] Update ftp.md improved wording --- content/gettingstarted/programming/ftp.md | 41 +++++++++++------------ 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/content/gettingstarted/programming/ftp.md b/content/gettingstarted/programming/ftp.md index 92f3ee0..f894441 100644 --- a/content/gettingstarted/programming/ftp.md +++ b/content/gettingstarted/programming/ftp.md @@ -6,43 +6,40 @@ aliases: - chapter/gettingstarted/programming/ftp --- -> 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. +This page discusses the possibility to upload files through the internal FTP server and access the REPL through a Telnet connection. Using this method as the single option to connect to the device is not advisable, as unexpected crashes and changes in the wifi settings might lock you out. 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. -The first time(s), your device will create an Access Point (AP) you can connect to using your computer's WiFi. - By default, the device will create a WiFi access point with the following credentials: * SSID: `xxpy-wlan-####` * Password: `www.pycom.io` -> If the WiFi network does not show up by default, use the following: ->```python -> import pycom -> from network import WLAN -> pycom.wifi_on_boot(True) -> pycom.wifi_mode_on_boot(WLAN.AP) -> ``` -> The last 4 characters of the broadcast SSID are equal to the last 4 characters of the `unique_id()`: (Except if the AP SSID was set previously) -> ```python -> import machine -> import ubinascii -> ubinascii.hexlify(machine.unique_id()) -> ``` +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 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()) +``` + +> You can find the methods to change the default settings [here](/firmwareapi/pycom/pycom/#boot-methods) - - -Once connected to this network you will be able to access the telnet and FTP servers running on the LoPy4. - -The file system is accessible via the native FTP server running on each Pycom device. Open an FTP client and connect to: +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. +The recommended clients are: * macOS/Linux: default FTP client * Windows: Filezilla and FireFTP From 39da50c9eb3da6bfda07ee5d4315e8aba116f55d Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 2 Oct 2020 12:01:04 +0200 Subject: [PATCH 3/6] made changes to the FTP telnet page --- content/gettingstarted/programming/_index.md | 7 +++ content/gettingstarted/programming/ftp.md | 61 +++++++++++++------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/content/gettingstarted/programming/_index.md b/content/gettingstarted/programming/_index.md index e69de29..4463463 100644 --- a/content/gettingstarted/programming/_index.md +++ b/content/gettingstarted/programming/_index.md @@ -0,0 +1,7 @@ + +There are several ways to upload Python code to your device. On the following pages, we 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. \ No newline at end of file diff --git a/content/gettingstarted/programming/ftp.md b/content/gettingstarted/programming/ftp.md index f894441..9bdb69d 100644 --- a/content/gettingstarted/programming/ftp.md +++ b/content/gettingstarted/programming/ftp.md @@ -6,38 +6,48 @@ aliases: - chapter/gettingstarted/programming/ftp --- -This page discusses the possibility to upload files through the internal FTP server and access the REPL through a Telnet connection. Using this method as the single option to connect to the device is not advisable, as unexpected crashes and changes in the wifi settings might lock you out. +This page discusses the possibility to upload files through the internal FTP server and access the REPL through a Telnet connection. -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. +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` -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 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()) -``` + 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()) + ``` -> You can find the methods to change the default settings [here](/firmwareapi/pycom/pycom/#boot-methods) + 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) + ``` + > 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 default credentials. +> See [network.server](/firmwareapi/pycom/network/server/) for information on how to change the default credentials. The recommended clients are: * macOS/Linux: default FTP client @@ -46,10 +56,10 @@ The recommended clients are: For example, from a macOS/Linux terminal: ```bash -$ ftp 192.168.4.1 +ftp 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 @@ -57,6 +67,13 @@ 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. +## 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. + ## FileZilla If using FileZilla, it's important to configure the settings correctly. From 91d05655463715379f5b7621ddfd63cdd7392243 Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:54:13 +0200 Subject: [PATCH 4/6] Update _index.md fixed link --- content/gettingstarted/programming/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/gettingstarted/programming/_index.md b/content/gettingstarted/programming/_index.md index 4463463..a7d5a9d 100644 --- a/content/gettingstarted/programming/_index.md +++ b/content/gettingstarted/programming/_index.md @@ -4,4 +4,4 @@ There are several ways to upload Python code to your device. On the following pa * [USB Serial](usbserial/) * [FTP & Telnet](ftp/) -And lastly, we discuss the [Safe boot](../safeboot/) feature. \ No newline at end of file +And lastly, we discuss the [Safe boot](safeboot/) feature. \ No newline at end of file From 8edb4e49ae4ab41d31d9ce186538e60559fe518d Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:57:17 +0200 Subject: [PATCH 5/6] Update ftp.md re orderd information --- content/gettingstarted/programming/ftp.md | 25 +++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/content/gettingstarted/programming/ftp.md b/content/gettingstarted/programming/ftp.md index 9bdb69d..8d38ecd 100644 --- a/content/gettingstarted/programming/ftp.md +++ b/content/gettingstarted/programming/ftp.md @@ -49,14 +49,24 @@ The file system is accessible via the native FTP server running on each Pycom de > See [network.server](/firmwareapi/pycom/network/server/) for information on how to change the default credentials. + +## 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 client +* macOS/Linux: default FTP / Telnet client * Windows: Filezilla and FireFTP For example, from a macOS/Linux terminal: ```bash ftp 192.168.4.1 +telnet 192.168.4.1 ``` 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: @@ -67,14 +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. -## 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. - -## FileZilla +### FileZilla If using FileZilla, it's important to configure the settings correctly. @@ -86,3 +89,7 @@ In the `Transfer Settings` tab, limit the max number of connections to one. Othe ![](/gitbook/assets/filezilla-settings-2.png) + + + + From e3018b6b82fcda673389897c78b3d95e8078ffac Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 2 Oct 2020 14:36:36 +0200 Subject: [PATCH 6/6] Update _index.md fixed sentence --- content/gettingstarted/programming/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/gettingstarted/programming/_index.md b/content/gettingstarted/programming/_index.md index a7d5a9d..9164494 100644 --- a/content/gettingstarted/programming/_index.md +++ b/content/gettingstarted/programming/_index.md @@ -1,5 +1,5 @@ -There are several ways to upload Python code to your device. On the following pages, we the alternative (e.g. not using an expansion board) methods: +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/)