[BusPirate v4] Flashrom hangs because BP disconnects

Bus Pirate support for the Flashrom project

[BusPirate v4] Flashrom hangs because BP disconnects

Postby FlasherGirl » Mon Nov 16, 2015 2:07 am

Dear friends, I got a new Bus Pirate v4 device - to use it with a Flashrom for SOIC8 SPI chips flashing!
However, while I am trying to use flashrom together with BP v4 , BP v4 device disconnects by itself
( I see a message in dmesg Linux kernel log, like that: "usb 4-1: USB disconnect, device number 21" )

And because of this Bus Pirate problem, flashrom hangs after telling "Baud rate is 115200 now"
and it can't read the image from SOIC8 chip :( Full log is below:

Code: Select all
sudo ./flashrom -p buspirate_spi:dev=/dev/ttyACM0 -V -f -r output.bin
flashrom v0.9.8-r1899 on Linux 3.13.0-68-lowlatency (x86_64)
flashrom is free software, get the source code at [link removed]
flashrom was built with libpci 3.2.1, GCC 4.8.4, little endian
Command line (6 args): ./flashrom -p buspirate_spi:dev=/dev/ttyACM0 -V -f -r output.bin
Calibrating delay loop... OS timer resolution is 1 usecs, 974M loops per second, 10 myus = 16 us, 100 myus = 156 us, 1000 myus = 1572 us, 10000 myus = 15693 us, 4 myus = 6 us, OK.
Initializing buspirate_spi programmer
Baud rate is 115200 now
<--- because Bus Pirate disconnected by itself there, flashrom hangs

It disconnects after being /dev/ttyACM0 , and connects back as /dev/ttyACM1 , while flashrom is hanging...

Initially, I thought that it is a hardware problem... Then I discovered a Bus Pirate v4 self testing guide,
connected to BP using " picocom --baud 115200 --parity none --databits 8 /dev/ttyACM1 " command,
ran a self test, and everything appears to be OK! (if I follow "Connect (ADC to +3.3V)" instruction)

My firmware version is "Firmware v6.0-a3", it was pre-installed by Seeed Studio.
Should I try upgrading the firmware, or there is something else that I am doing wrong?
How to fix that flashrom problem?
FlasherGirl
Newbie
Newbie
 
Posts: 6
Joined: Mon Nov 16, 2015 1:44 am

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby Sjaak » Mon Nov 16, 2015 10:23 am

Do you use the powersupply of the buspirate or an external one? If the requested power is more then the (USB) powersupply can supply a voltage dip would brown ou the processor. The max is should be able to supply is approx 150mA (assuming a motherboard port)
User avatar
Sjaak
Fellow
Fellow
 
Posts: 3297
Joined: Sun Jan 03, 2010 2:45 pm
Location: Hiero

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby FlasherGirl » Mon Nov 16, 2015 12:57 pm

Sjaak wrote:Do you use the powersupply of the buspirate or an external one? If the requested power is more then the (USB) powersupply can supply a voltage dip would brown ou the processor. The max is should be able to supply is approx 150mA (assuming a motherboard port)


The power was supplied through USB port of my laptop. Just tried using Bus Pirate through 4 USB adapter which has its own power supply, but unfortunately the results are the same: still disconnects :( I am open to the new suggestions
FlasherGirl
Newbie
Newbie
 
Posts: 6
Joined: Mon Nov 16, 2015 1:44 am

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby FlasherGirl » Mon Nov 16, 2015 3:17 pm

Finally I fixed my dear BP v4 , by upgrading the firmware from v6.0-a3 to v6.1 :-) Using the instructions below:
http://dangerousprototypes.com/docs/Pirate-Loader_console_upgrade_application_(GNU/Linux,_Mac,_Windows)

However, the firmware upgrade process was really painful!

1) I could not reset into Bootloader mode just by pressing $ at the Hi-Z mode prompt and confirming it.
Although the Bus Pirate closes the term automatically ("FATAL: term closed") , pirate-loader fails every time with this output:

Code: Select all
Sending Hello to the Bootloader...ERROR
No reply from the bootloader, or invalid reply received: 4
Please make sure that PGND and PGC are connected, replug the devide and try again

I had to trigger a bootloader in the "old way", by shortening the PGC and PGD pins with the remains of a copper wire.

2) After triggering a bootloader, my first attempt to upgrade a firmware has failed epicly:

Code: Select all
pirate-loader-v4-source$ sudo ./pirate-loader_lnx --dev=/dev/ttyACM0 --hex=BPv4-frimware-v6.1.hex
+++++++++++++++++++++++++++++++++++++++++++
  Pirate-Loader for BP with Bootloader v4+ 
  Loader version: 1.0.2  OS: S
+++++++++++++++++++++++++++++++++++++++++++

Parsing HEX file [BPv4-frimware-v6.1.hex]
Found 87552 words (262656 bytes)
Opening serial device /dev/ttyACM0...OK
Configuring serial port settings...OK
Sending Hello to the Bootloader...OK

Bootloader version: 4,06
Device ID [f1]:PIC24FJ256GB106
Erasing page 0, 0000...OK
Writing page 0 row 0, 0000...OK
Writing page 0 row 1, 0080...ERROR

Error updating firmware :(

Some of my next desperate attempts have failed too:

Code: Select all
Sending Hello to the Bootloader...ERROR
No reply from the bootloader, or invalid reply received: 0
Please make sure that PGND and PGC are connected, replug the devide and try again

3) Finally, after dozens of unsuccessful tries, in the moment of a great frustration,
the following wonderful trick has helped me to upgrade Bus Pirate v4 successfully :

I plugged a Bus Pirate v4 (with shortened PGC and PGD pins) to laptop USB port. Then I have been pressing two buttons of BP v4 - "Normal" and "Reset" - many times randomly! If I remember it right, my last action was: pressing "Reset" button three or four times in a sequence, with about 5-10 seconds interval time between the pressings

After doing all that, I tried repeating the upgrade procedure with a pirate-loader (Linux version as usual),
and this time it was successful

Code: Select all
Firmware updated successfully :)!

I already tried using a flashrom with upgraded BP v4 , and now flashrom works OK ! ;-)
Well, at least it goes beyond the "Baud rate is 115200 now" message: it starts probing for the chips, etc...

P.S. I cannot understand, why Seeed Studio ships Bus Pirate v4 with such an buggy firmware v6.0-a3 .
This pre-installed firmware seems to be really faulty, and I believe that many people who are less patient than me, they asked Seeed Studio to give a refund because their Bus Pirate v4 was not working out-of-the-box and because of such firmware upgrade problems
FlasherGirl
Newbie
Newbie
 
Posts: 6
Joined: Mon Nov 16, 2015 1:44 am

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby tayken » Sun Nov 22, 2015 10:15 am

Glad that you got it working!

FlasherGirl wrote:P.S. I cannot understand, why Seeed Studio ships Bus Pirate v4 with such an buggy firmware v6.0-a3 .
This pre-installed firmware seems to be really faulty, and I believe that many people who are less patient than me, they asked Seeed Studio to give a refund because their Bus Pirate v4 was not working out-of-the-box and because of such firmware upgrade problems


This is a logistics issue. They manufactured the last BPv4 a long time ago and they were programmed and tested with firmware v6.0 on them. Now if they want to reflash them they have to open all the packages, reflash and then retest them which is a nightmare. That's why I download and flash the latest firmware on all boards I buy.
User avatar
tayken
Developer
Developer
 
Posts: 1520
Joined: Sat Dec 12, 2009 10:58 am
Location: Tokyo, Japan

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby FlasherGirl » Mon Nov 23, 2015 3:06 pm

tayken wrote:Glad that you got it working!

FlasherGirl wrote:P.S. I cannot understand, why Seeed Studio ships Bus Pirate v4 with such an buggy firmware v6.0-a3 .
This pre-installed firmware seems to be really faulty, and I believe that many people who are less patient than me, they asked Seeed Studio to give a refund because their Bus Pirate v4 was not working out-of-the-box and because of such firmware upgrade problems


This is a logistics issue. They manufactured the last BPv4 a long time ago and they were programmed and tested with firmware v6.0 on them. Now if they want to reflash them they have to open all the packages, reflash and then retest them which is a nightmare. That's why I download and flash the latest firmware on all boards I buy.


Dear tayken, they do not need to upgrade them all in once, they could upgrade them one-by-one for incoming orders, and it would take only a couple of minutes to upgrade a firmware of this product before packing and shipping (which is much less time than its needed for dealing with customer complains). I suggested this idea to Seeedstudio and they redirected it to technical department, so maybe new customers will receive their BPs with a fresh firmware, if my voice would be heard ;-)

By the way, my Bus Pirate v4 is not that old: it was manufactured at the middle of 2014 year. I don't know why they continued installing this old v6.0 firmware, while there were more stable firmwares v6.1 and v6.2 beta available for a long time before this
FlasherGirl
Newbie
Newbie
 
Posts: 6
Joined: Mon Nov 16, 2015 1:44 am

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby Sjaak » Tue Nov 24, 2015 7:59 am

FlasherGirl wrote:
tayken wrote:Glad that you got it working!

FlasherGirl wrote:P.S. I cannot understand, why Seeed Studio ships Bus Pirate v4 with such an buggy firmware v6.0-a3 .
This pre-installed firmware seems to be really faulty, and I believe that many people who are less patient than me, they asked Seeed Studio to give a refund because their Bus Pirate v4 was not working out-of-the-box and because of such firmware upgrade problems


This is a logistics issue. They manufactured the last BPv4 a long time ago and they were programmed and tested with firmware v6.0 on them. Now if they want to reflash them they have to open all the packages, reflash and then retest them which is a nightmare. That's why I download and flash the latest firmware on all boards I buy.


Dear tayken, they do not need to upgrade them all in once, they could upgrade them one-by-one for incoming orders, and it would take only a couple of minutes to upgrade a firmware of this product before packing and shipping (which is much less time than its needed for dealing with customer complains). I suggested this idea to Seeedstudio and they redirected it to technical department, so maybe new customers will receive their BPs with a fresh firmware, if my voice would be heard ;-)

By the way, my Bus Pirate v4 is not that old: it was manufactured at the middle of 2014 year. I don't know why they continued installing this old v6.0 firmware, while there were more stable firmwares v6.1 and v6.2 beta available for a long time before this


Sounds nice but it is unmanagable. This will make the process for seeed too complicated and prolly introduces more errors in the endproduct. The item aren't programmed like you just did, they have a testing/programming rig where they put the device in program it and run the test. With all the products they sell they have a shitload of testing rigs. Also the guy that packs your stuff into a larger box is prolly not capable of doing a firmware upgrade of every product.. Using a dedicated firmwareupgradeontexitguy will add to the cost of a product substantially.

We design stuff to be easily upgraded by the enduser without specialized tools, as they are more capable of doing that then a chinese orderpicker. I'm sorry you got a buggy firmware installed on your device and the process was bumpy.

The reason it is programmed with an old version is the manafacturer got a complete firmware (bootloader+firmware) to programm with a uC programmer after assembly. this one differs from a regular firmware (no bootloader). We prolly (I'm assumign it as I'm not involved in this production) only provided v6.0 to him.
User avatar
Sjaak
Fellow
Fellow
 
Posts: 3297
Joined: Sun Jan 03, 2010 2:45 pm
Location: Hiero

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby tayken » Sun Dec 06, 2015 6:34 am

Sjaak wrote:The reason it is programmed with an old version is the manafacturer got a complete firmware (bootloader+firmware) to programm with a uC programmer after assembly. this one differs from a regular firmware (no bootloader). We prolly (I'm assumign it as I'm not involved in this production) only provided v6.0 to him.

Most probably the manufacturing package was the same. As changing it between batches can cause problems, have to verify new things, Oh-the-output-message-is-not-the-same-so-something-is-wrong moments on their side etc. If the first manufacturing package is working fine, go with it. Unless your product costs more than 100$ (and not an open hardware project).
User avatar
tayken
Developer
Developer
 
Posts: 1520
Joined: Sat Dec 12, 2009 10:58 am
Location: Tokyo, Japan

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Postby mikeb » Fri Sep 09, 2016 9:22 am

Hi! Just want to inform you friends, new Firmware v7.0 is available
http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=8498
Hopefully it could fix all the BP v4 problems regarding flashrom, and much more
mikeb
Newbie
Newbie
 
Posts: 39
Joined: Fri Sep 09, 2016 2:50 am


Return to Flashrom