Bounty on Bus Pirate features, get a free v2 PCB

We’re putting a bounty on two high-priority Bus Pirate features. You can get a free PCB for the upcoming Bus Pirate V2 by writing a bit of code. Hack a Day has a varied and talented group of readers, and we know someone out there has the experience to make these changes with minimal difficulty.

The latest code integrates the PIC24F bootloader for easy updates without a programmer. We’d like to add a protocol snooper, but that requires interrupts. With the bootloader, however, interrupts are relocated and we’ve yet to fully grasp how that works. We’ll send a PCB and PIC 24F to the first person who modifies the code to demonstrate UART, SPI, or change notification interrupts with the boot loader. Microchip’s 24F bootloader app note is available here. Complete.

The current frequency measurement feature is a hack that uses a counter and a timer. Be the first to implement the input capture peripheral instead, and get a free PCB. See the function bpFreq(void) in base.c.Complete.

Sadly I don’t have a bus pirate yet and also I have no PIC prototyping board, so I can’t give any code. I’m bootstrapping a programmer right now.

Regarding the interrupts:
Reading the app note, the process is pretty straightforward. The Idea is that the interrupt vector table is in the same block as the reset vector. Because the bootloader needs the reset vector in place at any time, any safe operation would exclude writing to the first block of program memory (and also the bootloader code blocks, of course).
To allow the user applications to use interrupts, the first memory block containing the vector table will be programmed once. The reset vector will get a jump to the bootloader and the interrupt vectors will get jumps to their own offsets in the NEXT block of memory, essentially “relocating” the interrupt vector table to the second block of memory. This block will be safe to overwrite by the bootloader’s operations, since the reset vector is not in danger.

The interrupt vector table is usually populated by the linker, which puts jumps to the interrupt service routines at the right “magic” locations according to the code the user wrote. This can easily be modified by changing the linker’s script, i.e. tell the linker to put the jumps into the second block of memory, at the same offsets as before. An example linker script is included with the app note’s download.

So let’s say that interrupt 1 happens, whose vector would be located at 0x04 in the memory (0x00 being the reset vector). Let’s also assume a block size of 0x10. The linker is told that he should place the jump to the interrupt service routine at (0x10 + 0x04). This is exactly where the bootloader’s “protective interrupt vector table” points to. So the PIC jumps to 0x04 when the first interrupt happens and from there gets the instruction to jump to (0x10 + 0x04). There the linker put the instruction to jump to whereever the actual interrupt service routine is located.

Hope my writeup helps. I’d happily provide code, but as I said, I’m in the process of bootstrapping my PIC working environment. I first thought about porting the bus pirate to AVR (atmega32 or something the like), but then I thought it would be wiser to first build the supported platform and begin porting later, when I can test new code written for the PIC on the real device fist. So, getting an original PIC-based bus pirate would eventually speed things up a bit =D

What about the license of this thing. You are providing the source and board schematics what is really cool! Thumbs up!

The google code page states that this project is released under New BSD License. But there is no note about this in the source code nor in the schematics or board files.

Not that you get a wrong implession. I am not asking because I would want to produce it or something. I am myself developing open source hardware and am bit frustrated that other hardware projects just don’t release their stuff under proper licenses and/or do not apply them properly.

I just want to help here to point out the problems. ^^

On another note. I hope I can soon get one such board from you. Another useful thing in it would be usb interface. My laptop has no serial and I would need to use a usb to serial converter what in many cases provides problems. :(

That is very good to know! But even when it is public domain it has to be stated in the source. Otherwise the whole thing automatically falls under copyright and one can do with it basically nothing. :(

to follow up to crazor’s comment, the source in their svn repo already has the relevant bits. the .gld file is the linker script in question.

i cant demonstrate working code (no pic environment unless someone sends me a pcb :-), but to get the uart1 rx interrupt handler installed just define a function named __U1RxInterrupt. the linker script will fill in the interrupt vector for you via this snippet:

We added a function to help test interrupt implementations. The latest code has an undocumented menu command ‘i’ that configures and enables timer1 with interrupts. In main.c there’s a global variable irqFlag which prints ‘IRQ DETECTED’ into the terminal when set to one. At the bottom of main.c are three interrupt handling functions from Microchip’s examples. Both of Microchip’s examples cause the chip to reset. This should provide an easy framework for testing interrupts.

Just wanted to give a heads up, make sure that the linker script is actually for the chip your using. Foe example I think the one that is on MC’s site is for the 24FJ256GA110, if your using a GA1XX you may beed to check that the script is right. There are differences in same family depending on which of the pinout models your using.

@lesnet Ok I will create a patch for you. Still I have a little question. Do you want to use CC0 (which makes a more robust public domain release then just saying that the stuff is public domain) or not. If yes It would be very usefull if you would tell me the name of the group/person holding currently the copyright. Then I can create the appropriate header and make a patch.

@ian
I’ve been following the development of the Bus Pirate but everything seems to have gone quiet about a month ago. I see that you are still working on the software based on the the Google SVN but I can’t find anything on the refinements made to the hardware for the v.2go.

Do you have a BOM for the v.2go hardware you could post?

I think I have all the components based on what documentation there is on the web including the v.2a, schematics and comments. The last item I have a question on is the 4066D – what is the specific version that you have used?

I have purchased the v.2go board from Seeed Studio and want to place my Digi-Key order but would like to confirm the parts before I do.

My brother-in-law is originally from Mexico and still struggles to speak clear English. His ESL teacher suggested that he watch American television exhibits to pick up on idioms which can be commonly used. He loves to Get Free Diablo 2 Items Online. so, every chance he gets, he borrows our laptop to try and do just that. My husband and I prefer to see him succeed in this goal so we are considering purchasing him a laptop for his birthday. He would need to buy World wide web access, but I imagine they can afford that on their monthly budget. I haven’t addressed this with my sister yet, but hope to this weekend.