Monday, April 9, 2012


I would like to win one of the elusive free PCB coupons from Dangerous Prototypes. Finish one, get another! How can you beat that deal? Haven't won yet, but it is only a matter of time.

I have to admit, I was one of the people who requested the opportunity to buy PCBs from the PCB drawer. When I saw Ian's breakdown of first year sales of the Bus Pirate, I felt twinges of guilt because I had not yet purchased. I plunked down my $10 and received two DIY Bus Pirates PCBs. I sent in a Mouser order for the parts (plus extra SMD resistors because they are easy to lose).

All told, the PCBs, components, plus shipping/handling came out to about $50 for the two Bus Pirates. Considering Seeed Studio will sell you one for $27, assembled, programmed, and shipped, this was starting to look like a losing proposition. Did I mention the twinges of guilt driving the purchase?

I soldered up the boards in an evening. This was my first time assembling SMD parts but after watching the HOWTO videos on Dangerous Prototypes, it wasn't so bad. Patience, flux, and desoldering braid.

When I plugged in a USB cable, the PWR LED came on and the computer recognized the FT232 chips. So far so good. Now I needed to program the PIC24 chips but I don't have a PIC programmer. I didn't want buy a PicKit because that would really make for a losing proposition. I saw that Jozef had devised a way to program the devices using a AVR microcontroller. He was kind enough to share source, precompiled binaries, and firmware. Great! But I don't have a AVR programmer. Talk about bootstrapping problems!

I do have a MSP430 Launchpad and I figured I could have the MSP430 emulate the AVR. I modified the firmware code to run on a MSP430G2553. I picked this part because it has a built in UART. You can probably modify the code to run on MSP430s with software UART but I am not going there.

Here is a picture of the programmer hooked up. PGC is on P2.0, PGD on P2.1 (through a 1K resistor), and MCLR on P2.2. The Launchpad runs at 3.6V but this is within the electrical specs for the PIC24 so I figured why not. Fortunately, it works just fine.

I programmed the v4.4 bootloader using ApProg using the Launchpad running the modified firmware. The firmware came next using the ds30 loader GUI. This is much faster than trying to program the combined bootloader/firmware using ApProg. The ApProg binary is available here.

And it works! I have two functional Bus Pirates. No more twinges of guilt. So the final cost for the two Bus Pirates (PCBs, parts, Launchpad) came out to almost exactly what I could have ordered from Seeed Studio. But mine have DIY silkscreened on the boards!

Here is the source code for the MSP430. It has been condensed into a single file. You can create a new project in code composer studio v5, copy and paste into main.c and compile. Some day, perhaps I will take the time to learn how to host files on github. Posted on github.


  1. Great. That's exactly what I was planning to do.
    I'll try it on the weekend. Thanks for sharing :D

  2. WOW. MSP430 to program pics. I can say "AWESOME".
    I have a launchpad from months but never had chance to play with it. It still has the preloaded temperature+led-blink firmware.
    Can you host the firmware for this in any file sharing website like rapidshare and link it here. Would be useful for people like me.

    1. Which file do you want? The source code can be copy/pasted. If you want the binary .out file, I can probably host that somewhere but you will have to have a project in CodeComposerStudio to upload it to the 430. The entire create new CodeComposerStudio project, copy above code, paste into main.c, build and debug takes about a minute or two.

  3. Is it posibble to use a MSP430G2231 or MSP430G2211 rather than the 2253? My launchpad came with the two above chips.


    1. TI gives example code for software UART for the 2231 so almost certainly it can be done but as I stated earlier, I am not going there. Probably can be done with a couple of hours of work. My suggestion would be to sample a couple of MSP430G2553 chips from TI. Another option is to use the free shipping option from Digikey-- they sell the 2553 in a 20 pin DIP for $2.30 in quantities of one. The free shipping trick is to mail them a check with tax included (see their terms of service). This adds two days to your order but still rather quick.
      Or order another 430 Launchpad-- I think all the currently shipping ones have the newer chips. This would cost you less than two 2553 chips from Digikey.

    2. Okay thanks. Samples from TI are currently on back order until the end of July :( Thanks for the suggestions.

  4. Neat. I wonder if this could do the pic32 chips that pickit2 won't support.

    1. Might work. Jozef wrote the computer side program to the PIC24 serial flash programming specs ( The PIC32s have both a JTAG as well as serial flash interface (

      I have never owned a PIC32 device to try so I don't know for sure, but it might work as is or with a bit of code twiddling.

  5. Even though I could have purchased an assembled BP 3 from seeed I am the type who takes great prde in doing things myself as well.

    I was lucky enough to get a PCB coupon code so I got the PCB free, but the parts from mouser Push the price a lot closer to the retail price.

    The parts were all still available excepth the FT232RL which is on bacjk order for a few weeks and one of the more expensive parts at $4.50 but I can wait.

    What I cannot abbide is the cost of the R603 1k1 resistors. I know it is a common part, but the minimum order for the resistor from Mouser is a roll of 10,000 for $40 bucks. I don't think I could ever use that many resistors ... EVER ... I only need 4 1k Ohm R603 resistors to build the BP 3,8 (if I don't lose any).

    I know this is an old post but can any of you spare 4 or 5 1k Ohm R603 resistors for a good cause?

    Thanks in advance. You guys aregreat! -kdr