diff --git a/content/firmwareapi/pycom/network/lte.md b/content/firmwareapi/pycom/network/lte.md index 2d29443..9807931 100644 --- a/content/firmwareapi/pycom/network/lte.md +++ b/content/firmwareapi/pycom/network/lte.md @@ -37,8 +37,8 @@ The Sequans modem used on Pycom's cellular enabled modules can only work in one ## AT Commands -The AT commands for the Sequans Monarch modem on the GPy/FiPy are available in a PDF file. - AT Commands for Sequans +The AT commands for the Sequans Monarch modem on the GPy/FiPy are available in a [PDF file](/gitbook/assets/Monarch-LR5110-ATCmdRefMan-rev6_noConfidential.pdf). + ## Constructors diff --git a/content/tutorials/basic/print.md b/content/tutorials/basic/print.md index 72f3a7e..6491aba 100644 --- a/content/tutorials/basic/print.md +++ b/content/tutorials/basic/print.md @@ -21,4 +21,7 @@ print("\t tabbed in") print("hello world: " + str(machine.rng()) + " random number" ) #or use format print("hello world: {} {}".format(machine.rng(), " random number")) +#you can also ask for user input +result = input("what's up?\n") +print(result) ``` \ No newline at end of file diff --git a/content/tutorials/expansionboards/pygate.md b/content/tutorials/expansionboards/pygate.md index 3fbb269..ec9e5b2 100644 --- a/content/tutorials/expansionboards/pygate.md +++ b/content/tutorials/expansionboards/pygate.md @@ -102,7 +102,8 @@ buf = fp.read() # Start the Pygate machine.pygate_init(buf) - +# disable degub messages +# machine.pygate_debug_level(1) ``` A sample `config.json` file for gateway configuration in EU868 region: diff --git a/content/tutorials/networkprotocols/http.md b/content/tutorials/networkprotocols/http.md new file mode 100644 index 0000000..e69de29 diff --git a/content/tutorials/networkprotocols/https.md b/content/tutorials/networkprotocols/https.md index 38b2d8f..8928ad7 100644 --- a/content/tutorials/networkprotocols/https.md +++ b/content/tutorials/networkprotocols/https.md @@ -5,7 +5,30 @@ aliases: - tutorials/all/https.md - chapter/tutorials/all/https --- +Using HTTPS adds Transport Layer Security (TLS) to your network traffic. The advantage is an encrypted connection between your device and the server. +## Basic example +```python +from network import WLAN #note that you can also use LTE +import socket +import ssl +import time + +wlan = WLAN() +wlan.init(mode=WLAN.STA, ssid='your ssid', auth=(WLAN.WPA2, 'your password')) +print("connecting", end='') +while not wlan.isconnected(): + time.sleep(0.25) + print(".", end='') + +print("connected") +print(wlan.ifconfig()) +s = socket.socket(usocket.AF_INET, usocket.SOCK_STREAM) +ss = ssl.wrap_socket(s) #adds TLS +ss.connect(socket.getaddrinfo('pycom.io', 443)[0][-1]) +rec = ss.recv(4096) +print(rec) +``` Basic connection using `ssl.wrap_socket()`. ```python @@ -15,6 +38,7 @@ import ssl s = socket.socket() ss = ssl.wrap_socket(s) ss.connect(socket.getaddrinfo('www.google.com', 443)[0][-1]) +ss.se ``` Below is an example using certificates with the blynk cloud. diff --git a/content/tutorials/networks/lte/_index.md b/content/tutorials/networks/lte/_index.md index f5d27b4..7adf71a 100644 --- a/content/tutorials/networks/lte/_index.md +++ b/content/tutorials/networks/lte/_index.md @@ -28,7 +28,7 @@ lte.attach(band=20, apn="your apn") while not lte.isattached() time.delay(0.25) print('.') - print(lte.send_at_cmd('AT!="fsm"') # get the System FSM + print(lte.send_at_cmd('AT!="fsm"')) # get the System FSM print("LTE modem attached!") lte.connect() while not lte.isconnected(): diff --git a/content/updatefirmware/expansionboard.md b/content/updatefirmware/expansionboard.md index ab39728..8c6426d 100644 --- a/content/updatefirmware/expansionboard.md +++ b/content/updatefirmware/expansionboard.md @@ -8,9 +8,8 @@ aliases: To update the firmware on the Pysense/Pytrack/Pyscan/Expansion Board v3, please see the following instructions. The firmware of Pysense/Pytrack/Pyscan/Expansion Board v3 can be updated via the USB port using the terminal tool, `DFU-util`. -{{% hint style="danger" %}} -There is currently **no firmware update** released for the new **Pytrack 2.0 X** and **Pysense 2.0 X**. Please do not try to flash these boards with firmware released for the old Version 1 hardware revision. The hardware revision is printed on the bottom of the shield. -{{% /hint %}} +> There is currently **no firmware update** released for the new **Pytrack 2.0 X** and **Pysense 2.0 X**. Please do not try to flash these boards with firmware released for the old Version 1 hardware revision. The hardware revision is printed on the bottom of the shield. + The latest firmware DFU file can be downloaded from the links below: @@ -20,10 +19,9 @@ The latest firmware DFU file can be downloaded from the links below: * [Expansion Board DFU v3.1](https://software.pycom.io/findupgrade?key=expansion31.dfu&type=all&redirect=true) -{{% hint style="info" %}} - Make sure to choose the correct firmware version for your expansion board. both 3.0 and 3.1 versions have version numbers in the silkscreen on the back of the board. See the image below for examples highlighted in Red - ![](/gitbook/assets/expansion_board_version.png) -{{% /hint %}} + +> Make sure to choose the correct firmware version for your expansion board. both 3.0 and 3.1 versions have version numbers in the silkscreen on the back of the board. See the image below for examples highlighted in Red +>![](/gitbook/assets/expansion_board_version.png) While in the normal, application mode, the Pysense/Pytrack/Pyscan/Expansion Board v3 require a Serial USB CDC driver, in DFU, bootloader mode, the DFU driver is required. Below, the USB Product ID is depicted for each case. diff --git a/content/updatefirmware/ltemodem.md b/content/updatefirmware/ltemodem.md index e71df7b..b7491cf 100644 --- a/content/updatefirmware/ltemodem.md +++ b/content/updatefirmware/ltemodem.md @@ -25,26 +25,27 @@ The last 5 numbers define the firmware version. A higher number represents a new > Note: The prefered method for updating the LTE modem is using upgdiff- files, as these updates are faster. Check in the zip archive wheter a upgdiff- update for your version is available. When using a upgdiff- file, you do not need to use `updater.elf` There are several different ways to update the firmware of the LTE modem. -1. [Flash](/updatefirmware/ltemodem/#flash) -2. [SD card](/updatefirmware/ltemodem/#sd-card) -3. [USB](/updatefirmware/ltemodem/#usb) -4. [Wireless](/updatefirmware/ltemodem/#wireless) +1. [Flash](/updatefirmware/ltemodem/#flash) (slow) +2. [SD card](/updatefirmware/ltemodem/#sd-card) (fastest) +3. [USB](/updatefirmware/ltemodem/#usb) (medium) +4. [Wireless](/updatefirmware/ltemodem/#wireless) (slowest) >Note: In case of any failure or interruption to the process of LTE modem upgrade you can repeat the same steps **after doing a hard reset to the board (i.e disconnecting and reconnecting power), pressing the reset button is not enough.** The modem firmware files are password protected. In order to download them, head to https://forum.pycom.io and become a member (if you aren't already) and click on: -Announcements & News --> Announcements for members only --> the Firmware Files for the Sequans LTE modem are now secured or click [here](https://software.pycom.io/downloads/sequans2.html). +Announcements & News --> Announcements for members only --> the Firmware Files for the Sequans LTE modem are now secured to retrieve the credentials. You can find the firmwares listed [here](https://software.pycom.io/downloads/sequans2.html). ## Flash >Note: For Flash updates, we currently only support the use of upgdiff- files! If there is no upgdiff- file for your version available, try to use another method. -1. Copy the firmware update file you want to use in your project folder and click `upload to device` in the Pymakr plugin. Make sure the first 5 numbers match the current version of your modem firmware. +1. Copy the firmware update file you want to use in your project folder and click `upload to device` in the Pymakr plugin. Make sure the first 5 numbers match the current version of your modem firmware. Uploading might take a while because of the large filesize. + > Note: If the firmware does not sync to your device, open the Pymakr settings → project settings and add `"dup"` to the entry `"sync_file_types"`. This will create a `pymakr.conf` file in your project and allow you to sync `.dup` files to the device using pymakr. 2. After uploading the file, you can run the following commands - ```python - import sqnsupgrade - sqnsupgrade.run('upgdiff_old-to-new.dup') - ``` + ```python + import sqnsupgrade + sqnsupgrade.run('upgdiff_old-to-new.dup') + ``` 3. The update takes about 5 minutes. Note that the update may seem to 'stall' around 7-10% and again at 99%. This is completely normal. >Note: **Do not disconnect power to the module during the updating process** 4. The updater will show the new `SYSTEM VERSION` when it is done, and return control to REPL. @@ -71,9 +72,9 @@ Announcements & News --> Announcements for members only --> the Firmware Files f ```python import sqnsupgrade sqnsupgrade.run('/sd/upgdiff_old-to-new.dup') - #if this is not available, run the following instead + #if no upgdiff is available, run the following instead #sqnsupgrade.run('/sd/name.dup') - #If you are updating from version 33080, use this + #WARNING! If you are updating from version 33080, use the .elf file as well #sqnsupgrade.run('/sd/name.dup', '/sd/updater.elf') ``` @@ -116,7 +117,7 @@ If you do not have an SD card available, you can use the existing USB-UART inter To update the modem firmware wirelessly, you can follow the [Flash](/updatefirmware/ltemodem/#flash) guide. Upload the files through the [FTP Server and communicate throught Telnet](/gettingstarted/programming/ftp/), or use [Pybytes Pymakr](https://pybytes.pycom.io/pymakr) - +