Update firmware using mac

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
gianrisa
Posts: 6
Joined: Sun Jul 20, 2014 9:27 am
Location: Nürnberg

Update firmware using mac

Post by gianrisa » Sun Jul 20, 2014 9:52 am

Hi @all,

I'm a mac user, and I'm really happy to play with MicroPython and try the latest micro python firmware image.
Using the dfu-util and a paper clip it is possible to update the firmware also with Mac.

Here we go how to do it:
As a prerequisite you need to have mac port installed ( to install: download from here https://guide.macports.org/chunked/inst ... ports.html ) and install it.
Xcode command line Tools most ports will likely fail to build if Xcode is not installed.

Once you have macport installed, open a console and type:

gianmac:~$ sudo port dfu-util install dfu-util
# once the installation is completed test with this command line

gianmac:~$ dfu-util -V
# this is the result
dfu-util 0.7

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Now flash the new firmware:
put in dfu mode the micro python ( short cut the 3.3v and the Boot pin as shown in the user guide http://micropython.org/static/doc/Micro ... -setup.pdf ) press reset or connect the micro python to the Mac
then from command console type:

gianmac:~$ dfu-util -l

# this is the result
dfu-util 0.7

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg"
Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=1, name="@Option Bytes /0x1FFFC000/01*016 e"
Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e"
Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=3, name="@Device Feature/0xFFFF0000/01*004 e"

this means that your micro python board can "communicate" to dfu-util and vice versa.

to update it, download the flash image from the download area then flash it with this command :

gianmac:~$ dfu-util -c 1 -i 0 -a 0 -D pybv10-2014-07-20-v1.2-13-gcb66f41.dfu
dfu-util 0.7

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Opening DFU capable USB device... ID 0483:df11
Run-time device DFU version 011a
Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
Dfu suffix version 11a
DfuSe interface name: "Internal Flash "
file contains 1 DFU images
parsing DFU image 1
image for alternate setting 0, (2 elements, total size = 251892)
parsing element 1, address = 0x08000000, size = 392
.
parsing element 2, address = 0x08020000, size = 251484
...........................................................................................................................
done parsing DfuSe file

gianmac:~$

This means that the flash went flawless and you can use the latest micro python firmware !

Hope this helps.

Cheers Gian

User avatar
UltraBob
Posts: 43
Joined: Mon Jul 28, 2014 1:18 pm
Location: Zushi, Japan
Contact:

Re: Update firmware using mac

Post by UltraBob » Tue Jul 29, 2014 1:48 pm

Thanks for the guide Gian, I installed dfu-util using homebrew, for those who might be on that package manager, and want to install it.

Code: Select all

brew install dfu-util
I think the instructions for downloading the original firmware off the board before flashing it that were on the github wiki page are also useful, but I don't have the time to grab it just at the moment.

robbie
Posts: 3
Joined: Sat Aug 16, 2014 12:25 am

Re: Update firmware using mac

Post by robbie » Sat Aug 16, 2014 1:36 pm

A small gotcha for the instructions above. The Apple Magic Mouse also presents itself as a DFU capable device, causing the following error message:

Code: Select all

More than one DFU capable USB device found, you might try `--list' and then disconnect all but one device
To avoid this you can either disconnect the mouse, or specify the pyboard explicitly using the –-device (or -d) option. The correct vendor:product ID can be found using dfu-util –-list but I assume it'll be constant for all release pyboards, so the below should work for most people.

Code: Select all

dfu-util -d 0483 -c 1 -i 0 -a 0 -D pybv10.dfu
This should also work if you have devices other than the Magic Mouse that lead to a similar error.

Post Reply