Bounty on Bus Pirate features, get a free v2 PCB

bpv2

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.

The latest Bus Pirate code and compiled firmware can be checked-out from Google Code SVN. Submit your code via the comments below or buspirate@hackaday.com.

UPDATE: Both issues were resolved. Thanks for your suggestions.

Comments

  1. cail says:

    Are you willing to sell some of those spare boards? I’d love to buy just one at a price that costs me less than having to setup and fab a whole panel through any other PCB house.

  2. alexfox says:

    using a bounty for these features is an excellent way to get the community to help the community!

    btw — beta-layout and batchpcb are both excellent places to get small runs of PCBs for cheap

  3. Ian Lesnet says:

    Additional opportunities: we’ll also send out PCBs for the first two bug-reports related to our implementation of the bootloader.

  4. Crazor says:

    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

    Hope my writing helps. Feel free to ask if anything is unclear!

  5. Crazor says:

    Actual linker script examples are in appendix c of the app note, not in the download (maybe also there, don’t know).

    Don’t know if I made it clear enough in the last post: the only change necessary would be in the linker script. The code won’t need to be touched!

  6. esden says:

    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. :(

    Cheers Esden

  7. @esden – previous bus pirate posts mentioned that it’s public domain, but the closest option on google was BSD.

  8. esden says:

    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. :(

  9. neutered says:

    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:

    long( defined(__u1rxinterrupt) ? absolute(__u1rxinterrupt) :
    absolute(__defaultinterrupt));

    which translates to:

    allocate space for a long word whose value is the address of the symbol named __u1rxinterrupt if it is defined and __defaultinterrupt otherwise.

    the spi/uart2 interrupt handlers are basically the same deal.

  10. dex says:

    Up Up Down Down Left Right Left Right B A

  11. Ian Lesnet says:

    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.

  12. Roman D says:

    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.

  13. Ian Lesnet says:

    @esden – If you make these changes and submit a patch, I’ll apply it to the code.

  14. esden says:

    @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.

  15. blizzarddemon says:

    Nothings better then a time sensitive test of skill, amoungst hackers and all craftsmen. : P

  16. clint says:

    @ian:

    That V2 board looks like it’s got a USB port. (SWEET!) Are you going with the FTDI chip?

    Please consider selling the new boards, or at least pointing to a place we can buy ‘em. The more the merrier!

    Thanks for all your hard work and great posts!

    -Clint

  17. clint says:

    @ian:

    Any word on the v2 boards? You’ve got at least one person chompin’ at the bit to order one!

    Thanks!

    -Clint

  18. mike says:

    @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.

    Any help would be appreciated. Thanks,

    Mike

  19. clint says:

    @ian:

    “what mike said”

    :-)

    Thanks!

  20. Your weblog is very nice! The post has a rich content but you could do better.

  21. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,596 other followers