Hi everyone.
I got the Bus Pirate v4 board this Christmas. I wanted it mainly for SPI programming with
avrdude (under Linux). I might be doing something wrong, but it seems that SPI is not working as it should (or not at all).
As I try running arvdude with
avrdude -c buspirate -P /dev/ttyACM0 -p m128 -v -v, it halts at
Detecting BusPirate...
avrdude: buspirate_send_bin():
0x23 0x0a
and at that moment, I see from the logs that the device disconnects and immediately reconnects, this time as
/dev/ttyACM1 (also, avrdude begins to consume 100% of one CPU core) . Reconnecting Bus Pirate does not help, since the device node
/dev/ttyACM0 does not get freed until avrdude exits/gets killed.
So I decided to test if everything is OK on the Bus Pirate's side and it seems it isn't. I'm not sure if that is the cause, but BPv4 does not bring 5V and 3.3V lines up. Here's the terminal communication log:
i
Bus Pirate v4
Firmware v6.0-a3
DEVID:0x1019 REVID:0x0003 (24FJ256GB106 A5)
http://dangerousprototypes.com
HiZ>m4
...
(using all the defaults and output type "Open drain")
...
Ready
SPI>W
VREG too low, is there a short?
Power supplies OFF
SPI>P
Pull-up resistors ON
Warning: no voltage on Vpullup pin
SPI>W
VREG too low, is there a short?
Power supplies OFF
When I check the voltages, they are at 0. If I select "Normal" output type instead of "Open drain", VPU goes to
0.42V after switching on the pull-up resistors, but all the rest is the same.
Should I get Vreg up by some other command or hardware intervention? Or maybe this is an expected behavior? If so, how do I get SPI to work with avrdude?
Have you upgraded to fw v6? It solves a bunch of SPI and avrdude issues.
I haven't upgraded the FW, but as you can see from my terminal log, it got shipped with v6.0-a3. Is that recent enough?
Opps, sorry I missed that on my mobile device. No, a3 was a development firmware we shipped with the first batch of v4, it is almost totally worthless besides basic functions. Please upgrade to v6 final and let me know. Still there it is highly likely that things won't work in v6, but Brent and I did fixes and testing specifically for SPI and AVRdude with v4.
http://dangerousprototypes.com/docs/Bus_Pirate#Download (http://dangerousprototypes.com/docs/Bus_Pirate#Download)
OK, I've just upgraded the firmware to v6.0 r1625 (linked from the today's site news). I can now get Vreg up :D
I'll check with avrdude now.
BTW, as per request in the news, I attach a compiled version of firmware loader (32-bit, GCC 4.4.5, glibc-2.12.2). Also, I've found a minor bug in the build-unix.sh script (invalid paths) - corrected version attached as well.
Oh yesss, avrdude works fine now :]
Thank you very much for the quick response and a working firmware :)
P.S. I can't see the attachments in my previous post - are they waiting for moderator's acceptance or did I do it wrong (or is this feature disabled)?
[quote author="jankes"]Oh yesss, avrdude works fine now :]
Thank you very much for the quick response and a working firmware :)
[/quote]
[quote author="jankes"]
P.S. I can't see the attachments in my previous post - are they waiting for moderator's acceptance or did I do it wrong (or is this feature disabled)?[/quote]
I guess something went wrong... there isn't a moderator ueue to approve attachments. After 1 successful post you should be capable of posting without restrictions. Could you please try again?
[quote author="jankes"]BTW, as per request in the news, I attach a compiled version of firmware loader (32-bit, GCC 4.4.5, glibc-2.12.2). Also, I've found a minor bug in the build-unix.sh script (invalid paths) - corrected version attached as well.[/quote]
I have already updated the build-unix.sh for v4, you had to change sources/pirate-loader.c to pirate-loader.c, right?
Also as I remember I uploaded the Linux version (pirate-loader_lnx). Can you check out if that one works for you?
I'm glad you got it going, thanks for the update.
[quote author="tayken"]
I have already updated the build-unix.sh for v4, you had to change sources/pirate-loader.c to pirate-loader.c, right?[/quote]
Yes, the
sources directory is not there, so all the occurrences should be removed. I'm attaching a version that worked for me. (Actually not really attaching, since I now saw a "The extension sh is not allowed." message - pasting below.)
#!/bin/bash
OS=`uname`
echo -n "Building for $OS..."
case $OS in
Darwin )
gcc -O2 -Wall -force_cpusubtype_ALL -arch i386 -arch ppc pirate-loader.c -DOS=$OS -o pirate-loader_mac || exit -1
;;
Linux )
gcc -O2 -Wall pirate-loader.c -DOS=$OS -o pirate-loader_lnx || exit -1
;;
FreeBSD )
gcc -O2 -Wall pirate-loader.c -DOS=$OS -o pirate-loader_fbsd || exit -1
;;
*)
echo "ERROR"
echo "Unsupported operating system $OS"
exit -1
;;
esac
echo "DONE"
exit 0
[quote author="tayken"]
Also as I remember I uploaded the Linux version (pirate-loader_lnx). Can you check out if that one works for you?[/quote]
And where shall I find it? Is it packaged in an updated
BusPirate.package.v6.0.zip file available from google code, or some place in the SVN tree?
[quote author="jankes"]And where shall I find it? Is it packaged in an updated BusPirate.package.v6.0.zip file available from google code, or some place in the SVN tree?[/quote]
It is in SVN, here is a link (http://http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/#svn%2Ftrunk%2FBus_Pirate%2FBPv4-bootloader%2Fpirate-loader) to the directory.
Thank you both for the build scripts. One issue is that in some copies of pirate loader the source is actually still in the /source directory. I made a bit of a mess when I prepped this release package, I'll try to get it cleaned up by the next release.
A really nice thing (that may already be done!) would be if one pirate-loader supported both chips. I think it may already. Even cooler would be if it could recognize the version by the chip ID and choose a firmware based on an ini file or something. I plan to work on this eventually.
[quote author="tayken"][quote author="jankes"]And where shall I find it? Is it packaged in an updated BusPirate.package.v6.0.zip file available from google code, or some place in the SVN tree?[/quote]
It is in SVN, here is a link (http://http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/#svn%2Ftrunk%2FBus_Pirate%2FBPv4-bootloader%2Fpirate-loader) to the directory.[/quote]
I've just tested that file and it seems to work fine.
BTW, I'd forgotten to mention this previously: there is an inconsistency in naming of the ICSP pins:
- the loader says that "PGND and PGC" should be connected,
- on the board, there are pins labelled PGC, PGD and GND which causes a little confusion and
- the on-site flashing instructions (http://http://dangerousprototypes.com/docs/Bus_Pirate_v4_firmware_updates) contain a typo, suggesting to "Connect PGC and PGC pins".
Also, it took me a while to come across an information indicating that on Linux, the kernel module required for v4 is cdc_acm. I did not find it written explicitly anywhere, but had to figure it out after reading the v3 vs v4 comparison (http://http://dangerousprototypes.com/docs/Bus_Pirate_v4_vs_v3_comparison), which at some point mentioned CDC-ACM. Furthermore, the above mentioned flashing instructions talk about "USB-CDC" which should probably be changed to "CDC-ACM" (at least on Linux, the driver used in both situations is the same).
Thanks for the report. I updated the instructions on the wiki and will update pirate-loader when I am next messing with it.