1

empowering creative people

Pycom Pysense & Pytrack: How to Update Firmware

UPDATE: This documentation now also applies to Pyscan and Expansion Board 3.0

Pysense and Pytrack boards have a “firmware update mode”. Unlike the Pycom microcontrollers you don’t add a jumper to the board to access this mode, you hold down the on-board button when you plug it in. The board appears to Windows as two completely different devices. In “normal” mode the board looks like a serial port and is automatically installed by Windows under Ports (COM & LPT) in Device Manager. In “firmware update” mode the device can’t be automatically installed, so we have a manual process to get a device driver installed so we can push the firmware update onto the board. Not complicated enough? What if there was a time limit? There is: 7 seconds. Thankfully you can restart the time limit as many times as you need to complete the process.

The Pysense and Pytrack firmware update process is documented in 4.2.1 Updating Firmware under 4. Pysense and Pytrack. I have written this procedure as a slower, more deliberate, walk-through of the update process after making many mistakes following the Pycom documentation. I’ll assume all downloaded files are in your Downloads folder. All the below is done with the Pysense/Pytrack board alone; no Pycom microcontroller board should be mounted on it.

From now on I’ll refer to Pysense or Pytrack boards as just “the board”.

Preparation

Downloads folder files listing

  1. from the links provided at the top of the documentation, download:
    1. Pytrack DFU
    2. Pysense DFU.
  2. Scroll down to the Windows heading and download:
    1. DFU-util v0.9
    2. Zadig. http://zadig.akeo.ie/ click Zadig 2.3 (or latest)
  3. Organise the download files. The documentation says “Open the command prompt and navigate to the directory where the DFU-util and the firmware was downloaded (must be in same directory)” so let’s get the files in the same folder.
    1. Extract the zip file: dfu-util-0.9-win64.zip
    2. Open the Downloads\dfu-util-0.9-win64\dfu-util-0.9-win64 folder, select all files and move them back to the Downloads folder.
  4. Have open on the screen:
    1. The Pycom documentation
    2. This documentation
    3. Device Manager
    4. The Zadig app you just downloaded
    5. A Command Prompt in the Downloads folder

Preparation complete.

Dry Run

Device Manager showing USB Serial Device

The board will be in update mode for 7 seconds and then revert to “normal” mode. So that you stand a chance at getting the update to work, you need to get familiar with the timing, so we’ll do a dry run.

First, let’s see what happens when we’re not using firmware update mode.

  1. Plug your board into your PC
  2. Look at Device Manager
  3. After Windows installs it you should see, under Ports (COM & LPT), a new USB Serial Device (COMx) where x is some number.
  4. Disconnect the board
  5. The new USB Serial Device (COMx) should disappear from Ports

Device Manager showing Unknown Device

Now we’ll see what firmware update mode does:

  1. Hold down the button on the board
  2. Keep holding the button down and plug the USB cable in
  3. Watch Device Manager. You should see a category pop up in the list called Other devices and there should be a new device under that category called Unknown device.
  4. After 7 seconds the Unknown device disappears from Device Manager and the USB Serial Device (COMx) reappears.

So now you see that we have a short time window in which to get the update started. Do the dry run again, this time watching the Zadig app. The top box (darker grey) should display Unknown Device #1 when Windows can see the board in firmware update mode. When the board reverts to normal mode, the top box goes back to blank.

Driver Installation

Zadig app showing Unknown Device #1

Now we need to install the hardware driver for the board’s firmware update mode.

  1. Ensure your board is unplugged from the computer
  2. Look at the Zadig app. By default the selected driver (pointed at by the green arrow) will be WinUSB (v6.1.7600.16385). We do not want to install this. Use the up/down buttons at the end of that text box to change the driver to libusbK (v3.0.7.0)
  3. Hover your mouse over the Install WCID Driver button and leave it there
  4. Now hold down the button on the board while you plug it in. Seven seconds and counting
  5. When the top box of the Zadig app shows Unknown Device #1 hit the Install WCID Driver button
  6. You’ll get a progress bar, then a dialog saying, “The driver was installed successfully”. Hit the Close button.
  7. The Zadig app will now display some other device in the top box. Don’t worry about it. But if you need to try this step again, it’s best to close and re-open the Zadig app so you can start with a blank box again.

Device Manager showing Unknown Device #1

Strangely, Zadig gives you a “successful” message regardless of whether you did this part right or not. We need to invoke firmware update mode again and look at Device Manager to see if we did it right.

  1. Unplug the board. Hold down the button. Plug it back in.
  2. Look at where the device appears in Device Manager.
    1. If you see USB Serial Device (COMx) under Ports, you don’t have the board in firmware update mode
    2. If you see Unknown Device under Other devices then the board is in firmware update mode and the driver is not installed
    3. If you see Unknown Device #1 under libusbK USB Devices then the board is in firmware update mode and the driver is correctly installed.

Regardless of the options above, after 7 seconds the board will revert to normal mode and you’ll only see the first option. Don’t be concerned if you fail to get it right. You can try the Driver Installation as many times as you need to. Close and re-start the Zadig app each time you start again.

Once Device Manager shows Unknown Device #1 under libusbK USB Devices, you can go on.

Firmware Update

Command line ready

WARNING: Unplugging and reconnecting the board is used to restart firmware update mode. Do not unplug the board while the firmware update is in progress.

Now Windows has the driver for the board when it’s in firmware update mode we can now push the new firmware to the device. For this we need to use the command prompt we opened earlier.

  1. If you type dfu-util-static.exe -d pys and hit the TAB key it will auto complete the name of the DFU file. If you’re upgrading a Pytrack then replace pys with pyt in the above. Don’t hit the ENTER key yet!
  2. We now need to get the board back into firmware update mode before we run dfu-util-static.exe.
  3. Unplug the board. Hold down the button. Plug it back in.
  4. Watch Device Manager. When you see Unknown Device #1 under libusbK USB Devices, go to the command prompt and hit ENTER.
  5. A page of text is dumped on the screen and, near the bottom, a progress bar quickly advances to 100%.

Command line success

If the second last line reads “… No error condition is present” then we’re done! If the last line reads “No DFU capable USB device available” then either you were too slow starting the update in the command prompt or you don’t have the correct driver installed.

Resetting and Retrying

It’s possible to go down any of several rabbit holes. Once you’ve gotten lost (installed the wrong driver, for example) you need to reverse out and start again. This procedure is designed to get you back to where you started:

  1. Unplug the board. Hold down the button. Plug it back in.
  2. Look at Device Manager. The device should be called Unknown Device #1 under libusbK USB Devices. If it’s not we need to uninstall it.
  3. Unplug the board. Hold down the button. Plug it back in.
  4. In Device Manager, locate the device that “pops up”.
  5. Right-click on the device and select Uninstall device
  6. Device Manager will freeze, so you don’t have to rush now.
  7. Check the box for Delete the driver software for this device. Click Uninstall.
  8. When that completes, unplug the board. Hold down the button. Plug it back in.
  9. The device should appear as Unknown Device under Other devices. Good.
  10. Close and reopen the Zadig app. The top box (darker grey) should now be empty.

You’re good to go. Start again from the top.

UPDATE: This documentation now also applies to Pyscan and Expansion Board 3.0 Pysense and Pytrack boards have a &ldqu...

Have a question? Ask the Author of this guide today!