Skip to main content
Topic: How do I program a PIC with Bus Pirate? (Read 7952 times) previous topic - next topic

How do I program a PIC with Bus Pirate?

Okay first off I am new to programming PIC's and was looking at using the bus Pirate as a PIC programmer.  I have a handfull of questions that I can't seem to find the answer to.

1. can I program newer PIC's without the bus pirate pic programmer board (the extra board that sits on top)

2. Can I write code in C with MPLAB and then compile and send it to my PIC using the bus pirate?

3. If so how do I go about doing this, do I need to download drivers or something like that?

In short I want to write C code, and send it to my PIC chips with the bus pirate.  I just don't know how or even if I can.

Thanks in advance.

(I apologize if this is already addressed, I have been looking for a couple days now and can't seem to find an answer)

Re: How do I program a PIC with Bus Pirate?

Reply #1
here is the pic prog's wiki: http://dangerousprototypes.com/docs/Bus ... ng_adapter

and more information can be found browsing the forums. But as I understand it; at the moment its still (For the most part?) being developed. I do know it has quite a few PICs that are compatible but .

1. X

2. Yes; you can write code in MPLAB; compile it; then upload the hex. Like you would with the Pickit2 standalone application. Once you compile an application; in that projects folder there should be a <project name>.hex file. So really just write it; ensure to properlly link it with its PIC MCU support files and use the correct compiler; and hit the build button. Simple as that to generate a .hex file. I also think there is a 'Export Hex' in the file menu; i could be wrong about that.

3. There is a picProg application package which needs to be used with the Bus Pirate and the pic programmer adapter.

Re: How do I program a PIC with Bus Pirate?

Reply #2
Thanks I did know of that link.  I was just confused if the adapter was needed or if I could program without it (which it seems I can on several PIC's)  the other part that was confusing me was if you could program directly from MPLAB (or possibly an opensource solution) like you might do with the pickit 2 or 3.

What it seems like, I use MPLAB and generate a hex (from C or whatever language) and then use another program to load this hex into the PIC.  I thought I downloaded the correct program for this from the link above but whenever I launch it is just disappears instantly.

Could I be using the wrong download, I don't know if there is an IDE or something I should be using for this?  Would there happen to be a tutorial that might cover this somewhere?

Thanks for your hello, sorry about being such a noob.

Re: How do I program a PIC with Bus Pirate?

Reply #3
You need to understand that PiratePIcProg does not have GUI. It is command-line only application.

Launch the application from "cmd" and you will see the output.

Re: How do I program a PIC with Bus Pirate?

Reply #4
For answer to 1: Currently a few PIC microcontrollers are supported and you can see them here: http://dangerousprototypes.com/docs/Pir ... orted_PICs

Some of them require a high voltage 13V on MCLR pin while programming, those are shown on that table. Basically the rule is: 24F or so is fine without an adapter, but 12F, 16F and 18F ones do need the adapter (there are/may be some extraordinary cases)

The same link I sent you has some usage examples. Wiki is your friend.

Re: How do I program a PIC with Bus Pirate?

Reply #5
Hi ammas09,

The Bus Pirate PIC programmer is a stand-alone application, it does not integrate with the MPLAB IDE. It's a fun hack, but no substitute for a PICkit or ICD.

The app is used from the command line, you tell it where the Bus Pirate is, what chip to program, and what HEX to use. This can also be saved in a .bat file for one-click programming.

Code: [Select]
picprog -p buspirate -u COM12 -s 115200 -c 18F24J50 -t HEX -w OLSv1-bootloader-v1-20MHz.hex -E -V

This is an example of using it from the wiki Tayken linked.
Got a question? Please ask in the forum for the fastest answers.

Re: How do I program a PIC with Bus Pirate?

Reply #6
Okay this is making allot more sense now.  Thanks!  I wanted to get into programming PIC's and was thinking about using it instead of a PIC Programmer, but am rethinking that now.

I know this is a little off topic but is this the same case for AVR?

Re: How do I program a PIC with Bus Pirate?

Reply #7
The Bus Pirate fully integrates into the AVR IDE as an STK500 (alternate firmware). It works in Arduino IDE as a native Bus Pirate device with the AVRdude used by the IDE.

If you just need to program a PIC or rescue a project, Bus Pirate is a useful solution. Once you want to get into development then a real programmer is your best bet.
Got a question? Please ask in the forum for the fastest answers.

Re: How do I program a PIC with Bus Pirate?

Reply #8
Thank you all so much for your advice and sharing.  It helps me out allot!