Skip to main content
Topic: Bus Pirate PIC programmer v0.1 (continued)... (Read 32365 times) previous topic - next topic

Bus Pirate PIC programmer v0.1 (continued)...

The other thread was getting a bit stale. Here's a new for the latest developments on the Pirate PIC Programmer.

There's a new Wiki page here:
http://dangerousprototypes.com/docs/Pir ... Programmer
Feel free to add to it.

The first release (v0.1) is attached. Usage examples for the PICs that work are on the wiki.
v0.1 has a few enhancements from the first test release (unnumbered):
*Checks for proper parameters instead of crashing
*Exits, not crash, when no COM port present
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #1
v0.2 is a new test release.

*v0.1 didn't work at all...
*supports 18F24J50 fully
*24fj64ga002 id/erase/program
*18F2550 id/erase/
*will probably crash with non-existing COM port
*improved 24fj read, but still needs work on addressing
*18F2550 flash definition is wrong
*24FJ read requires the updated firmware included in the .zip
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #2
Hello Ian,
First of all thanks for all you hard work on this project as well as everyone else's. I downloaded the svn version of Pirate PIC Programer and compiled it successfully on my Linux machine. I tried to use it to program the bootloader onto a 18F24J50(OLS) ang got this back

Code: [Select]
./picprog -p buspirate -u /dev/ttyUSB0 buspirate -s115200 -c 18F24J50 -t HEX -w ./OLSv1-bootloader-v2-16MHz.hex
(Bus) Pirate PIC Programer v0.1

Initializing interface
115200
Entering binary mode
BP: Setup mode...
Setup peripherals...
(OK)
Found '18F24J50' in programming database :) index = 1
Checking for 18F24J50 attached to programmer...
Found 18F24J50 (0X4C02, ID: 0X260 REV: 0X2)
Reading HEX file './OLSv1-bootloader-v2-16MHz.hex' ... Read binary size = 16384
Writing page 0, 0000...
Writing page 1, 0040...
......... and so on

It all completed successfully, but from looking at the output, it says that it is version V0.1, so I was wondering if you have uploaded the new code and just didn't change the version string, or if currently the svn copy is an older version. Another thing that  I noticed is that it seems to have trouble setting something up at the begining when running on linux,( going into binary mode?). It worked fine for me once, and all the times afterwards, and then I unplugged and plugged in and it didn't wanna work giving me this :
Code: [Select]
./picprog -p buspirate -u /dev/ttyUSB0 buspirate -s115200 -c 18F24J50 -t HEX -w ./OLSv1-firmware-v06-16MHz.hex 
(Bus) Pirate PIC Programer v0.1

Initializing interface
115200
Entering binary mode
Error sending data

I'll try to figure out whats going on later this week when I have time.

Also, don't want to hijack your thread,  but is OLSv1-bootloader-v2-16MHz.hex the right file to use to load the bootloader onto a 16MHZ OLS? mine won't go into bootloader mode by shorting, and currently I don't have the OSL firmware on. Tried loading OLSv1-firmware-v06-16MHz.hex but it doesn't show up a connected device either.

Thanks

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #3
Hi Fernando - Thanks so much for testing the app and reporting your results.

I looks like I just forgot to commit the main.c with the updated version string, everything else is the same as v0.2.

I'm not sure about the error, it seems like the serial port on the operating system had a problem after the initial use, maybe an improper exit or disconnect? It could be the Bus Private or app, but I'm not sure why it wouldn;t work after a reset.

Yes, if you have a 'later' OLS with a 16MHZ crystal on the PIC, then use the v2-16MHz bootloader. It should go into bootloader mode when you short PGC and PGD and then press the reset button.

The firmware also has jump instructions, so it can be programmed and used as a normal firmware without the bootloader. It should show up and enumerate as a serial port, even without the bootloader installed. Maybe there's a problem with the write algorithm, or maybe it's a delay (sleep) problem under linux?
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #4
I was trying to add some support for other chips, but I noticed that the app doesn't power down the buspirate. I don't see functions to support this either.

Perhaps after I added the binmode change and a pic I'll add buspirate.close() to the app. It is not urgent, but imho it should be fixed in the final.

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #5
I made some changes in the SVN. It makes the BP enter and exit raw1 mode more successfully. Moves the buspirate buffer into the private structure, and adds allocation for the BP structure (which should not be static and global).

It also introduces few compiler warnings to iface.c, but it makes the buspirate.c code consistent. (which has higher priority) My first try made the interface model too abstract, and caused pointer mess :), sorry for that.

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #6
I have played with some different pics lately and noticed that some voltages are different among the different pics. Even some voltages are deadly for the PICs. MPLAB displays kindly a message when a potential risk is for the connected pic and silently lowers supply voltages without noticing.

Piratepicprog and the hvp adapter are more dumber then the pickit, and not as intelligent (not possible wiht the current HW). We could design a new HVP adapter but that will add significant to the costs. Alternatively we could use a simple baord with zeners to contrain the voltages and a warning system in the software. The board will have multiple zeners which are selectable through jumpers.

Any ideas how to store this easily in the piratepicprog? I think a value in the family struct to tell if the hvp adapter is needed, max voltage on vcc, pgc/pgd, and MCLR.

ANy ideas?

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #7
If the voltages are same for one family  then i would add it to family. If there are some pics different in the family, we could override the family settings, by adding the voltage to the specific pic.

Re: Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #8
SWEET!

Re: Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #9
Very nice, thank you. We'll post this up.

The adapter is not dead, and with all the work Tayken and robots put into the app lately we will probably manufacture a full production run soon.
Got a question? Please ask in the forum for the fastest answers.

Re: Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #10
I bought my BP PIC programmer a long time ago but never tested it because I bought my pickit2 a couple weeks after and they arrived near the same time (my order also had PCBs).

So how can I test it? Is there a quick start guide or something? The wiki for this project seems the most confusing and least complete. As I understand it the Bus Pirate itself does not need separate firmware (I think I asked this along time ago but forgot)? I should be able to just plug it in and go right? using the PicProg (should be called PirateProg or somthign :3) software?

I was planning on testing it with my IR TOY I built but I decided to spread the love on that one and sent it out to a forum member (my PC is a media center PC it already has a IR receiver and repeater included; it was fun to build though :3)

Re: Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #11
The firmware is the standard release.
The software is in the SVN as PiratePICprog/software, the executable produced is picprog.

The supported products/chips/families are IRTOY(pic18f2550) OLS(18F24J50) BP3(24FJ064GA002) BP4(24FJ256GB106)

I'll skip electrical testing and leave that for someone with a degree.

Perform a read test, "picprog -p buspirate -u COM12 -s 115200 -c 18F2550 -t HEX -r read_test.hex"
Compare with original, "diff -u irtoy_v22.hex read_test.hex", these should differ only on the last two lines where MPLAB puts the configuration data on multiple lines picprog will have them included on one line.

Perform an erase, "picprog -p buspirate -u COM12 -s 115200 -c 18F2550 -E"
Now blank check, "picprog -p buspirate -u COM12 -s 115200 -c 18F2550 -t HEX -r blank_test.hex"
And verify, "cat blank_test.hex", don't blink it should scroll past ALOT of F's, at the end it will have 7F don;'t worry about that it's a marker for the configuration data.

Perform a write, "picprog -p buspirate -u COM12 -s 115200 -c 18F2550 -t HEX -W irtoy_v22.hex"
Followed with read test(as above)

Perform erase write and verify, "picprog -p buspirate -u COM12 -s 115200 -c 18F2550 -t HEX -E -W irtoy_v22.hex -V"

Re: Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #12
[quote author="AndThen"]
Compare with original, "diff -u irtoy_v22.hex read_test.hex", these should differ only on the last two lines where MPLAB puts the configuration data on multiple lines picprog will have them included on one line.
[/quote]

You can use the "compare" program to compare 2 files (HEX or BIN).

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #13
Nice work :) I recently picked up a very cheap (less than $10) 5V/3V3 PIC Programmer (PICkit 2 compatible) but I'd still be interested in an alternative especially if it's open source. I'll see what I might be able to add to this project... I can at least do some testing...

Re: Bus Pirate PIC programmer v0.1 (continued)...

Reply #14
Hello

Is this project still active? I would like to use a BusPirate v4 to reflash a bricked BusPirate v3 but cannot get it past

Code: [Select]
Checking for 24FJ64GA002 attached to programmer...

Wrong device: 0 (ID: 0 REV: 0)
and I was wondering if that is simply user error (I normally don't flash PICs) or some soft-/hardware incompatibility.

Thanks for a quick update.