[Solved] Use of class Pin crash the pyboard

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
tontonisback
Posts: 1
Joined: Sun May 04, 2014 2:33 pm

[Solved] Use of class Pin crash the pyboard

Post by tontonisback » Sun May 04, 2014 3:02 pm

Hi all,

I have just received the board so I'm doing some easy things to begin.
I read the page with the class pin http://micropython.org/doc/module/pyb/Pin
I'm connecting to the board and running live commands.
This command for example make the board crash

Code: Select all

g = pyb.Pin('X1', pyb.Pin.OUT_PP)
I put the new dfu firmware in the board (http://micropython.org/download/) and it solve my problem.
Don't forget to link the P1 PIN to 3v3
I saw on the forum how to do in windows, for linux you just have to download dfu-util and run to save the original:

Code: Select all

dfu-util -a 0 -U pybv10-v1.0-original.dfu
The following will update with the firmware found on the download part of the site:

Code: Select all

dfu-util -a 0 -D thenewfirmware.dfu

I hope it will help :)

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: [Solved] Use of class Pin crash the pyboard

Post by fma » Thu May 15, 2014 11:41 am

Thanks for the tips.

I tried to backup the original firmware, using the command above, but I only get a 16384 bytes long file. Is it normal?

Code: Select all

$ dfu-util -a 0 -U pybv10-v1.0-original.dfu
dfu-util 0.5

(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY

dfu-util does currently only support DFU version 1.0

Opening DFU 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 = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
Limiting default upload to 16384 bytes
bytes_per_hash=2048
Starting upload: [#######] finished!

$ ls -l
total 16
-rw-r--r-- 1 root root 16384 mai   15 13:38 pybv10-v1.0-original.dfu
Frédéric

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

Re: [Solved] Use of class Pin crash the pyboard

Post by dhylands » Thu May 15, 2014 3:31 pm

The firmware is split into 2 pieces. 16k plus the rest.

This is because the lower flash blocks are smaller and better to use for the mass storage device.

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: [Solved] Use of class Pin crash the pyboard

Post by fma » Thu May 15, 2014 3:46 pm

So the firmware is longer that 16k, right? How do I backup it with dfu-utils, then?
Frédéric

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

Re: [Solved] Use of class Pin crash the pyboard

Post by dhylands » Thu May 15, 2014 4:19 pm

So the 16K winds up being what dfu-util uploads by default.

So the firmware is laid out as 16K vectors + 112K MSD area + firmware.

I did:

Code: Select all

336 >dfu-util -a 0 --upload firmware.bin -s:524288
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
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
Limiting default upload to 524288 bytes
Upload	[=========================] 100%       524288 bytes
Upload done.
That would grab 384K of firmware + the contents of the MSD. The flash size is 1Mb, so you could specify upto 1048576 to grab the entire flash area.

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: [Solved] Use of class Pin crash the pyboard

Post by fma » Thu May 15, 2014 4:27 pm

Ok, thanks!
Frédéric

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

Re: [Solved] Use of class Pin crash the pyboard

Post by dhylands » Thu May 15, 2014 4:48 pm

I'm also using the latest dfu-util, built from source. I just thought I'd mention that in case you run into any differences.

The latest dfu-util supports -s:leave properly when flashing, which is why I'm using it (just an FYI)

fma
Posts: 164
Joined: Wed Jan 01, 2014 5:38 pm
Location: France

Re: [Solved] Use of class Pin crash the pyboard

Post by fma » Thu May 15, 2014 5:00 pm

I see... I don't think I need latest features of dfu-utils; I only want to flash new releases of micropython firmware...
Frédéric

duncan
Posts: 2
Joined: Sat Aug 09, 2014 1:47 pm

Re: [Solved] Use of class Pin crash the pyboard

Post by duncan » Sat Aug 09, 2014 4:07 pm

I am able to flash new firmware onto my micropython using:

Code: Select all

sudo dfu-util --alt 0 -D newfirmwareIdownloaded.dfu
Unfortunately I can't get original firmware off of my micropython:
This command:

Code: Select all

sudo dfu-util -a 0 --upload firmware.bin -s:524288
gives me a complaint, "invalid dfuse address: : 524288"
I get some success with (note I removed the colon):

Code: Select all

sudo dfu-util -a 0 --upload firmware.bin -s 524288
But this halts at "Error: Page at 0x00080000 is not readable"

Not sure why it's not working for me, but given I have overwritten my original firmware, and it now turns out I really need it back! Could some very kind soul please provide me with the original DFU firmware that they managed to flash from their PYBv1.0? I would be very grateful! :D (time sensitive application, lost 20% speed with firmware update and I was on the edge of acceptable as it was)

Post Reply