Updating Expansion Board Firmware

To update the firmware on any of the expansion boards, please see the following instructions. The firmware of can be updated via the USB port using the terminal tool, DFU-util.

The latest firmware DFU file can be downloaded from the links below:

  • Pygate
  • Pytrack 1 DFU
  • Pysense 1 DFU
  • Pytrack 2 DFU
  • Pysense 2 DFU
  • Expansion Board DFU v3.0
  • Expansion Board DFU v3.1

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.

Product ID

In normal operation, the expansion board 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)
Pygate 0xED15 0xED14
Pytrack 0xF014 0xF013
Pysense 0xF011 0xF012
Pyscan 0xEF37 0xEF38
Expansion Board v3 0xEF99 0xEF98

Note: USB Vendor ID is always 0x04D8

Installing DFU-Util

  • MacOS
    • If using homebrew:
$ brew install dfu-util
  • If using MacPorts:

port install libusb dfu-util
  • Linux
$ sudo apt-get install dfu-util

Windows

Download and install DFU-util v0.9

For Windows, we will need to install separate drivers for the board to recognized as a SG Wireless board in DFU mode.

  1. Disconnect the USB cable to your expansion board
  2. Hold down the DFU mode button on the shield
  • Zadig – Installer tool for the Pytrack/Pysense board DFU Firmware

To install the drivers, the board must be in DFU-mode:

  1. Disconnect the USB cable
  2. Remove the development module from the expansion board.
  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 successfully, you will see the device show up in Device Manager as a LibusbK device.

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.

Using DFU-util

To enter update mode follow these steps:

  1. Navigate the terminal to the folder where you downloaded the .dfu file to
  2. Unplug the device
  3. Remove the development module
  4. Plug in the USB cable to the host computer and wait 1 second before releasing the button
  5. After this you will have approximately 7 seconds to run the DFU-util tool
  • For MacOS and Linux:
sudo dfu-util -D pytrack_0.0.8.dfu
  • For Windows:
dfu-util-static.exe -D filename.dfu

If the update was successful, “Done!” should appear in the bottom of the command prompt. The output should look like the following:

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 04d8
Match product ID from file: f014
Opening DFU capable USB device...
ID 04d8:f014
Run-time device DFU version 0100
Claiming USB DFU Runtime Interface...
Determining device status: state = dfuIDLE, status = 0
dfu-util: WARNING: Runtime device already in DFU state ?!?
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0100
Device returned transfer size 64
Copying data from PC to DFU device
Download    [=========================] 100%        16384 bytes
Download done.
state(2) = dfuIDLE, status(0) = No error condition is present
Done!

Debugging

Using lsusb command, the device should be visible in both normal and bootloader modes.

For example, a Pytrack board is visible as either:

  • Bus 020 Device 004: ID 04d8:f014 Microchip Technology Inc. Application Specific Device
    • This is the bootloader mode (f014 is USB PID). It is active for just 7-8 seconds, if the MCLR button was pressed just before plugging in the USB connector.
  • Bus 020 Device 005: ID 04d8:f013 Microchip Technology Inc. Pytrack Serial: Pyabcde0
    • This is the normal, application mode (f013 is USB PID). This means the bootloader verified the firmware and it boot-up correctly.