From cd9ecc865c727fe4d7cd2c0246cecc63824bdf5b Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 28 Aug 2020 13:24:41 +0200 Subject: [PATCH 1/3] updated the expansionboard firmware update page --- content/updatefirmware/expansionboard.md | 127 +++++++++++------------ 1 file changed, 58 insertions(+), 69 deletions(-) diff --git a/content/updatefirmware/expansionboard.md b/content/updatefirmware/expansionboard.md index 218e974..34c3419 100644 --- a/content/updatefirmware/expansionboard.md +++ b/content/updatefirmware/expansionboard.md @@ -12,14 +12,13 @@ To update the firmware on the Pysense/Pytrack/Pyscan/Expansion Board v3, please The latest firmware DFU file can be downloaded from the links below: - +* [Pygate](https://software.pycom.io/findupgrade?key=pygate.dfu&type=all&redirect=true) * [Pytrack 1 DFU](https://software.pycom.io/findupgrade?key=pytrack.dfu&type=all&redirect=true) * [Pysense 1 DFU](https://software.pycom.io/findupgrade?key=pysense.dfu&type=all&redirect=true) * [Expansion Board DFU v3.0](https://software.pycom.io/findupgrade?key=expansion3.dfu&type=all&redirect=true) * [Expansion Board DFU v3.1](https://software.pycom.io/findupgrade?key=expansion31.dfu&type=all&redirect=true) - > 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) @@ -27,6 +26,7 @@ While in the normal, application mode, the Pysense/Pytrack/Pyscan/Expansion Boar | Board | DFU bootloader (update mode) | Application firmware (normal mode) | | :--- | :--- | :--- | +| Pygate | | | Pytrack | `0xF014` | `0xF013` | | Pysense | `0xF011` | `0xF012` | | Pyscan | `0xEF37` | `0xEF38` | @@ -34,94 +34,83 @@ While in the normal, application mode, the Pysense/Pytrack/Pyscan/Expansion Boar _Note: USB Vendor ID is always_ `0x04D8`_._ -## Installing the DFU-util Tools +To update the firmware of your expansionboard, -### macOS +1. Installing the DFU-util Tools -If using `homebrew`: + * MacOS -```bash -brew install dfu-util -``` + * If using `homebrew`: -If using `MacPorts`: + ```bash + $ brew install dfu-util + ``` + * If using `MacPorts`: -```bash -port install libusb dfu-util -``` + ```bash + port install libusb dfu-util + ``` + * Linux -### Linux + ```bash + $ sudo apt-get install dfu-util + ``` -Ubuntu or Debian: + * Windows -```bash -sudo apt-get install dfu-util -``` + Download and install [DFU-util v0.9](http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip) + + For Windows, we will need to install separate drivers for the board to recognized as a Pycom board in DFU mode. + 1. Disconnect the USB cable to your expansion board + 2. Hold down the DFU mode button on the shield -Fedora: + * [Zadig](http://zadig.akeo.ie/) – Installer tool for the Pytrack/Pysense board DFU Firmware -```bash -sudo yum install dfu-util -``` + To install the drivers, the board must be in DFU-mode: -Arch: + 1. Disconnect the USB cable + 2. Remove the development module from the expansionboard. + 3. Hold down the button on the shield + 4. Connect the USB cable + 5. Keep the button pressed for at least one second + 6. Release the button. When the board is connected in DFU-mode, it will be in this state for 7 seconds. + 7. Click the`“Install Driver` button immediately. If the driver was unsuccessful, repeat from step 1. + If all went sucessfully, you will see the device show up in `Device Manager` as a LibusbK device. -```bash -sudo pacman -Sy dfu-util -``` + ![](/gitbook/assets/pytrack_dfu_mode_zadig.png) -### Windows -* [DFU-util v0.9](http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip) – Tool to upload the firmware to the Pytrack/Pysense -* [Zadig](http://zadig.akeo.ie/) – Installer tool for the Pytrack/Pysense board DFU Firmware -To uploaded the latest DFU firmware to the Pytrack/Pysense, **first install the DFU drivers** to the host computer. Open Zadig and select `libusbK` as the driver. +> If you accidentally installed the `libusbk` while the device was in Application mode, then the need to update the driver to the `Serial USB (CDC)` driver has to be installed for application mode. This will allow Windows to allocate a COM port, which is required for REPL console. +> ![](/gitbook/assets/pytrack_app_mode_zadig.png) -To install the drivers, the Pytrack/Pysense board must be in DFU-mode: - -1. Disconnect the USB cable -2. Hold down the button on the shield -3. Connect the USB cable -4. Keep the button pressed for at least one second -5. Release the button. When the board is connected in DFU-mode, it will be in this state for 7 seconds. -6. Click the`“Install Driver` button immediately. If the driver was unsuccessful, repeat from step 1. - * _Here the USB ID has to be the DFU-bootloader one (_`0xF014`_for Pytrack or_ `0xF011` _for Pysense)._ - * _This is a successful DFU driver installation for Pytrack:_ - -![](/gitbook/assets/pytrack_dfu_mode_zadig.png) - -Open the command prompt and navigate to the directory where the DFU-util and the firmware was downloaded (must be in same directory). Repeat the procedure to get the board in DFU-mode and run the command below but replace `X.X.X` with the firmware version and replace Pysense with Pytrack if it is the Pytrack that is to be updated (e.g: `pytrack_0.0.8.dfu`): - -```bash -dfu-util-static.exe -D pysense_X.X.X.dfu -``` - -If the update was successful, a message,"Done!" should appear in the bottom of the command prompt. - -**Double-check Serial USB (CDC) driver is installed in Application mode:** if, by mistake, the `libusbk` driver was installed while the USB ID is the Application mode (`0xF013` for Pytrack or `0xF012` for Pysense), then the `Serial USB (CDC)` driver has to be installed for application mode. This will allow Windows to allocate a COM port, which is required for REPL console. - -![](/gitbook/assets/pytrack_app_mode_zadig.png) - -## Using DFU-util with Pytrack, Pysense and Expansion Board v3 +## Using DFU-util To enter update mode follow these steps: -1. Unplug the device -2. Press the button and keep it held (on the Expansion Board the `S1` button) -3. Plug in the USB cable to the host computer and wait 1 second before releasing the button -4. After this you will have approximately 7 seconds to run the DFU-util tool +1. Navigate the terminal to the folder where you downloaded the `.dfu` file to +2. Unplug the device +3. Remove the development module +4. Press this button on your device: -### macOS and Linux: +| Pygate | Pysense / Pytrack | Pysense 2.0 X / Pytrack 2.0 X | Expansionboard | +|:------:|:-----------------:|:-----------------------------:|:--------------:| +| | | | | -```bash -dfu-util -D pytrack_0.0.8.dfu -``` -{{% hint style="info" %}} -You might need to run `dfu-util` as `sudo`. In that case, you will need to enter your password. -{{% /hint %}} +5. Plug in the USB cable to the host computer and wait 1 second before releasing the button +6. After this you will have approximately 7 seconds to run the DFU-util tool + * For MacOS and Linux: + ```bash + $ dfu-util -D pytrack_0.0.8.dfu + ``` + * For Windows: + ```bash + dfu-util-static.exe -D filename.dfu + ``` -An output, similar to the one below, will appear upon successful installation: +If the update was successful, "Done!" should appear in the bottom of the command prompt. +The output should look like the following: ```bash dfu-util 0.9 @@ -152,9 +141,9 @@ state(2) = dfuIDLE, status(0) = No error condition is present Done! ``` -#### Debugging +### Debugging -Using `lsusb` command, the Pytrack/Pysense device should be visible in both normal and bootloader modes. +Using `lsusb` command, the device should be visible in both normal and bootloader modes. For exemple, a Pytrack board is visible as either: From 0d354acf15805b3106d7f050914813bfb17e5bce Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 28 Aug 2020 13:36:08 +0200 Subject: [PATCH 2/3] textual and layout changes --- content/updatefirmware/expansionboard.md | 37 ++++++++++++------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/content/updatefirmware/expansionboard.md b/content/updatefirmware/expansionboard.md index 34c3419..22cafd6 100644 --- a/content/updatefirmware/expansionboard.md +++ b/content/updatefirmware/expansionboard.md @@ -6,7 +6,7 @@ aliases: - chapter/updatefirmware/expansionboard --- -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`. +To update the firmware on any of the expansionboards, please see the following instructions. The firmware of can be updated via the USB port using the terminal tool, `DFU-util`. > 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. @@ -22,7 +22,8 @@ The latest firmware DFU file can be downloaded from the links below: > 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. +## Product ID +In normal operation, the expansionboard is in Application mode. However when we want to update the firmware, we should put the board in DFU (Device Firmware Upgrade) mode. This is a special mode that allows us to alter the firmware of the device. Entering DFU mode changes the Product ID of the device, such that we will never accidentally update the firmware. To actually upgrade the firmware, we need to install the DFU-Util tool. Below, the USB Product ID is depicted for each case. You can check the Product ID for your board using `lsusb` on macOS and Linux, and checkin the device manager in Windows: | Board | DFU bootloader (update mode) | Application firmware (normal mode) | | :--- | :--- | :--- | @@ -32,11 +33,11 @@ While in the normal, application mode, the Pysense/Pytrack/Pyscan/Expansion Boar | Pyscan | `0xEF37` | `0xEF38` | | Expansion Board v3 | `0xEF99` | `0xEF98` | -_Note: USB Vendor ID is always_ `0x04D8`_._ +_Note: USB Vendor ID is always_ `0x04D8` -To update the firmware of your expansionboard, -1. Installing the DFU-util Tools + +## Installing DFU-Util * MacOS @@ -66,23 +67,21 @@ To update the firmware of your expansionboard, * [Zadig](http://zadig.akeo.ie/) – Installer tool for the Pytrack/Pysense board DFU Firmware - To install the drivers, the board must be in DFU-mode: + To install the drivers, the board must be in DFU-mode: - 1. Disconnect the USB cable - 2. Remove the development module from the expansionboard. - 3. Hold down the button on the shield - 4. Connect the USB cable - 5. Keep the button pressed for at least one second - 6. Release the button. When the board is connected in DFU-mode, it will be in this state for 7 seconds. - 7. Click the`“Install Driver` button immediately. If the driver was unsuccessful, repeat from step 1. - If all went sucessfully, you will see the device show up in `Device Manager` as a LibusbK device. + 1. Disconnect the USB cable + 2. Remove the development module from the expansionboard. + 3. Hold down the button on the shield + 4. Connect the USB cable + 5. Keep the button pressed for at least one second + 6. Release the button. When the board is connected in DFU-mode, it will be in this state for 7 seconds. + 7. Click the`“Install Driver` button immediately. If the driver was unsuccessful, repeat from step 1. + If all went sucessfully, you will see the device show up in `Device Manager` as a LibusbK device. - ![](/gitbook/assets/pytrack_dfu_mode_zadig.png) + ![](/gitbook/assets/pytrack_dfu_mode_zadig.png) - - -> If you accidentally installed the `libusbk` while the device was in Application mode, then the need to update the driver to the `Serial USB (CDC)` driver has to be installed for application mode. This will allow Windows to allocate a COM port, which is required for REPL console. -> ![](/gitbook/assets/pytrack_app_mode_zadig.png) + > If you accidentally installed the `libusbk` while the device was in Application mode, then the need to update the driver to the `Serial USB (CDC)` driver has to be installed for application mode. This will allow Windows to allocate a COM port, which is required for REPL console. + > ![](/gitbook/assets/pytrack_app_mode_zadig.png) ## Using DFU-util From 875b840eee955ed2cd78f37491ac25d6c41132ae Mon Sep 17 00:00:00 2001 From: gijsio <67470426+gijsio@users.noreply.github.com> Date: Fri, 28 Aug 2020 15:23:01 +0200 Subject: [PATCH 3/3] updates updated the pid of pygate, added machine.pygate_reset --- content/firmwareapi/pycom/machine/pygate.md | 8 ++++++-- content/updatefirmware/expansionboard.md | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/content/firmwareapi/pycom/machine/pygate.md b/content/firmwareapi/pycom/machine/pygate.md index da83178..e9d3d8b 100644 --- a/content/firmwareapi/pycom/machine/pygate.md +++ b/content/firmwareapi/pycom/machine/pygate.md @@ -10,16 +10,20 @@ The Pygate is an 8-channel LoRaWAN gateway. Connect a WiPy, Gpy or LoPy4 board t ## Methods -### machine.pygate_init(buff) +### machine.pygate_init(config) This function is used to initialize the Pygate -- `buff`: the data contents of the gateway global config json file +- `config`: the data contents of the gateway global config json file ### machine.pygate_deinit() This shuts down the concentrator. +### machine.pygate_reset() + +Resets the Pygate and inserted development module (including the LTE modem, if present). This actually power cycles the Pygate and the attached hardware and is **not** similar to `machine.reset()`. + ### machine.callback(trigger, [handler=None, arg=None]) - `trigger`: A trigger event(s) for invoking the callback function `handler`, the triggers/events are: diff --git a/content/updatefirmware/expansionboard.md b/content/updatefirmware/expansionboard.md index 22cafd6..865c3e5 100644 --- a/content/updatefirmware/expansionboard.md +++ b/content/updatefirmware/expansionboard.md @@ -27,7 +27,7 @@ In normal operation, the expansionboard is in Application mode. However when we | Board | DFU bootloader (update mode) | Application firmware (normal mode) | | :--- | :--- | :--- | -| Pygate | | +| Pygate | `0xED15` | `0xED14` | | Pytrack | `0xF014` | `0xF013` | | Pysense | `0xF011` | `0xF012` | | Pyscan | `0xEF37` | `0xEF38` |