Merge branch 'publish' into pysense2-pytrack2

This commit is contained in:
gijsio
2020-10-02 14:54:57 +02:00
committed by GitHub
172 changed files with 2208 additions and 2135 deletions

View File

@@ -30,7 +30,7 @@ This step works the same for all our development boards and expansion boards. In
![](/gitbook/assets/expansion_board_3_lopy4.png)
>Note: If you do not have an expansion board, you are able to use a [USB-Serial converter](/gettinstarted/programming/usbserial/) or [WiFi](/gettingstarted/programming/ftp/) to connect.
>Note: If you do not have an expansion board, you are able to use a [USB-Serial converter](/gettingstarted/programming/usbserial/) or [WiFi](/gettingstarted/programming/ftp/) to connect.
## Step 2: Setting up your computer
@@ -143,11 +143,11 @@ From here on, you can continue to use the additional features of your expansionb
Now that we got the basic example running, you can continue with the links below.
* [More examples](/tutorials/)
* [Tutorials and examples](/tutorials/)
* [Documentation](/firmwareapi/)
* [Firmware API](/firmwareapi/)
* [Get started using the FTP and Telnet Server](/gettingstarted/programming/ftp/)
* [FTP and Telnet](/gettingstarted/programming/ftp/)
* [Connect using Pybytes](/pybytes/getstarted/)

View File

@@ -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.

View File

@@ -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
![](/gitbook/assets/filezilla-settings-2.png)

View File

@@ -30,7 +30,7 @@ If problems occur within the filesystem or you wish to factory reset your module
```python
>>> import os
>>> os.fsformat('flash')
>>> os.fsformat('/flash')
```
> Be aware, formatting the flash filesystem will delete all files inside the internal device storage (not the SD card) and they cannot be recovered.

View File

@@ -10,7 +10,7 @@ Some of our devices require registration before you can utilise specific feature
* [Objenious](/gettingstarted/registration/lora/objenious/)
## Other
* [SigFox](/gettingstarted/registration/sigfox/)
* [Cellular](/gettinsgtarted/registration/cellular/)
* [Cellular](/gettingstarted/registration/cellular/)
>**Not all Pycom devices require activation**; most features work immediately out of the box!

View File

@@ -27,11 +27,11 @@ The output will be a hex string like: `70B3D5499585FCA1`. Once you have this you
#### OTAA
If you wish to connect via OTAA (which is the recommended method) the network will provide you with an `Application EUI` and `Application Key`. The former identifies what application your device is connecting to, the latter is a shared secret key unique to your device to generate the session keys that prove its identity to the network. Once you have these you can use the [LoRaWAN OTAA example](/tutorials/lora/lorawan-otaa) code to connect to the network.
If you wish to connect via OTAA (which is the recommended method) the network will provide you with an `Application EUI` and `Application Key`. The former identifies what application your device is connecting to, the latter is a shared secret key unique to your device to generate the session keys that prove its identity to the network. Once you have these you can use the [LoRaWAN OTAA example](/tutorials/networks/lora/lorawan-otaa) code to connect to the network.
#### ABP
With ABP the encryption keys enabling communication with the network are preconfigured in the device. The network will need to provide you with a `Device Address`, `Network Session Key` and `Application Session Key`. Once you have these you can use the [LoRaWAN ABP example](/tutorials/lora/lorawan-abp) code to connect to the network.
With ABP the encryption keys enabling communication with the network are preconfigured in the device. The network will need to provide you with a `Device Address`, `Network Session Key` and `Application Session Key`. Once you have these you can use the [LoRaWAN ABP example](/tutorials/networks/lora/lorawan-abp) code to connect to the network.
### Networks

View File

@@ -58,9 +58,9 @@ If you are registering multiple devices you can generate more Applications Keys
Once you have the three identifiers for your device you need to register them on the Objenius portal.
Follow "Importer des capteurs" under "Statuc do Parc" and select "Provisioning Unitaire":
![](//gitbook/assets/objeniousprovision1.jpg)
![](/gitbook/assets/objeniousprovision1.jpg)
Once there give your device a name and enter the DevEUI, AppEUI, and AppKey obtained from the steps above:
![](//gitbook/assets/objeniousprovision2.jpg)
![](/gitbook/assets/objeniousprovision2.jpg)

View File

@@ -45,7 +45,7 @@ Once the device has been added, change the `Activation Method` between `OTAA` an
## Register a Nano-Gateway
You can also setup your Pycom module to act as a gateway with The Things Network. The code required to do this can be found [here](/tutorials/lora/lorawan-nano-gateway).
You can also setup your Pycom module to act as a gateway with The Things Network. The code required to do this can be found [here](/tutorials/networks/lora/lorawan-nano-gateway).
Inside the TTN Console, there are two options, `Applications` and `Gateways`. Select `Gateways` and then click on `register Gateway`. This will allow for the set up and registration of a new nano-gateway.

View File

@@ -39,7 +39,7 @@ print(binascii.hexlify(sigfox.pac()))
## Creating account at Sigfox backend
You need to register to the Sigfox Backend. Navigate to [https://backend.sigfox.com/activate](https://backend.sigfox.com/activate)
You need to register to the Sigfox Backend. Navigate to [https://buy.sigfox.com/activate](https://buy.sigfox.com/activate)
![](/gitbook/assets/sigfoxactivate.png)
@@ -79,4 +79,4 @@ Now you can see your new Sigfox PAC.
![](/gitbook/assets/newsigfoxpac.png)
Once you know your new Sigfox PAC go to [https://backend.sigfox.com/activate](https://backend.sigfox.com/activate) and register device with different account.
Once you know your new Sigfox PAC go to [https://buy.sigfox.com/activate](https://buy.sigfox.com/activate) and register device with different account.