First experiences (firmware upgrade & hardware design issue/mitigation)

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
Jurjen
Posts: 5
Joined: Sun Apr 19, 2020 10:54 am

First experiences (firmware upgrade & hardware design issue/mitigation)

Post by Jurjen » Sun Apr 19, 2020 6:31 pm

Hello,

First poster here, thanks for developing the hardware and this forum! I am new to (micro)python as well, so I use the Pyb-D and the ESP8266 as vehicles to learn an enjoy ... .

The two PYBD_SF6W devices I have had firmware revision 1.11 so I wanted to upgrade to 1.12. Since the upgrade process is not entirely trivial (as it emerged from some posts) I decided to write down all steps for the first device upgrade. In the end I was able to successfully upgrade it (indeed it took quite some time and some research / trial-and-error) and following these steps exactly the second device followed successfully without issues. Therefore I hope the following detailed description serves other users of the D-series as well:

Detailed procedure using Dfutils for upgrading PyB-D SF6W from 1.11 to 1.12

Hardware used:
Pyboard-D model SF6W, mounted on WBUS-DIP28 and accessed through the latter's USB-port
PC: Surface Pro 6 and/or the much older Surface 3 (both Windows 10)

Preparation:
1. Install PyUSB (I ran "pip install pyusb" from PowerShell in Admin mode)
2. Download Zadig ( https://zadig.akeo.ie/ )
3. Donwload DFUtils, unpack the zipped file ( http://dfu-util.sourceforge.net/ ) and then go to the directory with the unpacked files. This directory should contain several files/executables, including the "dfu-util-static" executable
4. Download a recent firmware DFU file (http://micropython.org/download/pybd/ ) into the same directory as the Dfutils executables from step 3. I used the PYBD-SF6-20191220-v1.12.dfu baseline file, but the latest dfu build works as well.

Execution:

1. Install PyUSB (I ran "pip install pyusb" from PowerShell in Admin mode)

2. Get the PyBoard-D in bootloader mode. There are several ways, but a very easy one was as suggested by Jimmo, direct from REPL (I use Thonny for that, but anything goes):
>>> import machine
>>> machine.bootloader()
As a consequence the Repl (or editor using it) gets disconnected and the red led starts flashing each second, indicating the board is in bootloader mode. Also around this time Windows *might* signal that it has found and will install a new driver, just let this happen, this will be overridden in the next step. Keep the PyB-D connected physically.

3. Now install the proper driver by running Zadig (Libusbk works for me as a device driver (as recommended by Jimmo somewhere else on this forum), but WinUSB does appear to work equally well, as tested on my second board to be upgraded) :
a. Start up Zadig (it is a standalone program that does not require installation)
b. From the main menu in Zadig, select Options -> List all devices
c. Select the PyBoard DFU as the device (be careful not to accidently select anything else. Furthermore, if you do not see the Pyboard DFU as an option then your device is not in bootloader mode)
d. Upgrade the driver to WinUSB or Libusbk

4. Start up Powershell (Administrator) and go to the dir with the unpacked Difutils files. Run Difutils in PowerShell with the following command (correct the dfu file name for the latest version you have downloaded, and mark the .\ at the start of the command):
.\dfu-util-static.exe -D PYBD-SF6-20191220-v1.12.dfu

5. Now you should see a stream of messages, ending with the message "Download Done. Done parsing DfuSe file"

That is it, you can now disconnect the PybD physically. Next time you start connecting to REPL or your favorite editor, the PyBoard will greet you with the updated firmware version!

Using pydfu (python script) instead of dfutils
Using pydfu (python script) instead of dfutils (replacing step 4) did not work for me, a timeout error was reported and I was not able to fix that in any way … .

Jurjen
Posts: 5
Joined: Sun Apr 19, 2020 10:54 am

Re: First experiences (firmware upgrade & hardware design issue/mitigation)

Post by Jurjen » Sun Apr 19, 2020 7:03 pm

I also noted that I ran into a hardware design issue due to the placement of the SD-card reader, when mounting it to the WBUS-DIP28 if the latter has strip connector pins soldered. In that case the VIN and 3V3 pins of the WBUS-DIP28 easily touch the SD-Card reader outer metal, causing the PybD not to work (and I got a report form my PC that a USB-port was drawing excess current, indicating some short-circuit issue ...). The two pictures below show the issue:
Image
Image

This however can be easily solved by wirecutting away the top part of those pins (and the GND pin near to it), as shown here:
Image

Regards,
Jurjen

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: First experiences (firmware upgrade & hardware design issue/mitigation)

Post by jimmo » Sun Apr 19, 2020 11:42 pm

Jurjen wrote:
Sun Apr 19, 2020 6:31 pm
Detailed procedure using Dfutils for upgrading PyB-D SF6W from 1.11 to 1.12
Thank you for doing this, I look forward to being able to link to this post in the future! :)

I should note that this is entirely a Windows-specific issue. I don't really understand what the whole Zadig driver thing is doing and why it's necessary. One thing I've heard is that if you use the ST tools instead of dfu-util and avoid this problem.

There's also a less well known way that you can firmware update the PYBD by copying a gzipped dfu file to the filesystem -- no dfu-util or drivers required.
The steps are roughly:
- gzip the .dfu file to firmware.dfu.gz, copy to the device filesystem
- copy fwupdate.py from https://github.com/micropython/micropyt ... wupdate.py to the device filesystem

Then at the REPL:
>>> import fwupdate
>>> fwupdate.update_mpy('firmware.dfu.gz', 0x80000000, 0x200000)

(I haven't tested this in a long time, but I have definitely done it before) (Edit, I just tested this on an SF2, works great -- note the filesystem needs to be FAT though, which is still the default).
Jurjen wrote:
Sun Apr 19, 2020 7:03 pm
This however can be easily solved by wirecutting away the top part of those pins (and the GND pin near to it)
Yup, my DIP28 looks exactly the same :)

kbrenner
Posts: 46
Joined: Mon Jan 20, 2020 8:05 pm

Re: First experiences (firmware upgrade & hardware design issue/mitigation)

Post by kbrenner » Mon Jun 08, 2020 3:28 pm

Jurjen wrote:
Sun Apr 19, 2020 6:31 pm
Jurjen, this post was extremely helpful. I would love to see this level of simplicity/detail for simple tasks like firmware updates for those of us who are not as familiar with the environment coming from the MicroPython team (if possible).

First poster here, thanks for developing the hardware and this forum! I am new to (micro)python as well, so I use the Pyb-D and the ESP8266 as vehicles to learn an enjoy ... .

The two PYBD_SF6W devices I have had firmware revision 1.11 so I wanted to upgrade to 1.12. Since the upgrade process is not entirely trivial (as it emerged from some posts) I decided to write down all steps for the first device upgrade. In the end I was able to successfully upgrade it (indeed it took quite some time and some research / trial-and-error) and following these steps exactly the second device followed successfully without issues. Therefore I hope the following detailed description serves other users of the D-series as well:

Detailed procedure using Dfutils for upgrading PyB-D SF6W from 1.11 to 1.12

Hardware used:
Pyboard-D model SF6W, mounted on WBUS-DIP28 and accessed through the latter's USB-port
PC: Surface Pro 6 and/or the much older Surface 3 (both Windows 10)

Preparation:
1. Install PyUSB (I ran "pip install pyusb" from PowerShell in Admin mode)
2. Download Zadig ( https://zadig.akeo.ie/ )
3. Donwload DFUtils, unpack the zipped file ( http://dfu-util.sourceforge.net/ ) and then go to the directory with the unpacked files. This directory should contain several files/executables, including the "dfu-util-static" executable
4. Download a recent firmware DFU file (http://micropython.org/download/pybd/ ) into the same directory as the Dfutils executables from step 3. I used the PYBD-SF6-20191220-v1.12.dfu baseline file, but the latest dfu build works as well.

Execution:

1. Install PyUSB (I ran "pip install pyusb" from PowerShell in Admin mode)

2. Get the PyBoard-D in bootloader mode. There are several ways, but a very easy one was as suggested by Jimmo, direct from REPL (I use Thonny for that, but anything goes):
>>> import machine
>>> machine.bootloader()
As a consequence the Repl (or editor using it) gets disconnected and the red led starts flashing each second, indicating the board is in bootloader mode. Also around this time Windows *might* signal that it has found and will install a new driver, just let this happen, this will be overridden in the next step. Keep the PyB-D connected physically.

3. Now install the proper driver by running Zadig (Libusbk works for me as a device driver (as recommended by Jimmo somewhere else on this forum), but WinUSB does appear to work equally well, as tested on my second board to be upgraded) :
a. Start up Zadig (it is a standalone program that does not require installation)
b. From the main menu in Zadig, select Options -> List all devices
c. Select the PyBoard DFU as the device (be careful not to accidently select anything else. Furthermore, if you do not see the Pyboard DFU as an option then your device is not in bootloader mode)
d. Upgrade the driver to WinUSB or Libusbk

4. Start up Powershell (Administrator) and go to the dir with the unpacked Difutils files. Run Difutils in PowerShell with the following command (correct the dfu file name for the latest version you have downloaded, and mark the .\ at the start of the command):
.\dfu-util-static.exe -D PYBD-SF6-20191220-v1.12.dfu

5. Now you should see a stream of messages, ending with the message "Download Done. Done parsing DfuSe file"

That is it, you can now disconnect the PybD physically. Next time you start connecting to REPL or your favorite editor, the PyBoard will greet you with the updated firmware version!

Using pydfu (python script) instead of dfutils
Using pydfu (python script) instead of dfutils (replacing step 4) did not work for me, a timeout error was reported and I was not able to fix that in any way … .

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: First experiences (firmware upgrade & hardware design issue/mitigation)

Post by rcolistete » Fri Jun 12, 2020 12:21 am

There are shorter male headers so that they don't touch the Pyboard D.

Anyway, it would be better to have a note about this issue in :
https://pybd.io/hw/wbus_dip28.html
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: First experiences (firmware upgrade & hardware design issue/mitigation)

Post by kevinkk525 » Tue Jul 21, 2020 5:12 am

I wish I had found this thread before spending a few hours trying to get everything working correctly.. It would be nice if this could either be included in a Wiki or directly linked to this thread on the pyboard D download page.

Getting the pyboard D to work was a more painful experience than using ESPxx.
And I still don't get to use dfu-utils over ubuntu wsl but that's probably a different problem.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: First experiences (firmware upgrade & hardware design issue/mitigation)

Post by dhylands » Tue Jul 21, 2020 8:19 pm

Yeah - WSL only supports usb serial. You can't use any of the DFU programming. You'll need to do that using regular windows utilities.

So what I do is to put my source tree some place windows has access to it. When I use my windows laptop I build using WSL and program using regular windows.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Windows issues

Post by pythoncoder » Wed Jul 22, 2020 8:22 am

I keep reading reports of problems with Windows and - to a lesser extent - OSX. Why not run a Linux VM?
Peter Hinch
Index to my micropython libraries.

Post Reply