Skip to main content
Topic: [BusPirate v4] Flashrom hangs because BP disconnects (Read 7156 times) previous topic - next topic

[BusPirate v4] Flashrom hangs because BP disconnects

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]
 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?

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #1
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)

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #2
[quote author="Sjaak"]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)[/quote]

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

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #3
Finally I fixed my dear BP v4 , by upgrading the firmware from v6.0-a3 to v6.1 :-) Using the instructions below:
http://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]
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]
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]
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]
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

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #4
Glad that you got it working!

[quote author="FlasherGirl"]
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[/quote]

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.

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #5
[quote author="tayken"]Glad that you got it working!

[quote author="FlasherGirl"]
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[/quote]

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.[/quote]

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

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #6
[quote author="FlasherGirl"][quote author="tayken"]Glad that you got it working!

[quote author="FlasherGirl"]
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[/quote]

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.[/quote]

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[/quote]

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.

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #7
[quote author="Sjaak"]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.[/quote]
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).

Re: [BusPirate v4] Flashrom hangs because BP disconnects

Reply #8
Hi! Just want to inform you friends, new Firmware v7.0 is available
http://http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=8498
Hopefully it could fix all the BP v4 problems regarding flashrom, and much more