I came across the Bus Pirate in a wiki and I was so fascinated about its capabilities that i could not resist to build one.
Unfortunately I just noticed that I cannot upload a firmware because i have access to "high voltage" pic programmer only.
According to information on this forum and I guess I have to build/buy some PicKit2 programmer as well. Am i correct?
I cannot wait to see the awesome Pirate in action :)
The Pirate in progress:
Maybe buy PicKit3 it is the latest PicProgrammer replacing PicKit2 and supporting more PICxxx chipset.
Actually I have found an old Max232 and ATMega8 chip among my spare parts and I still do have access to the COM port so I changed my mind a bit. Now i have a crazy idea. I am going to build a one shot programmer on breadboard because I only want to upload a bootloader to my BusPirate.
I saw that some people are working on PIC programmer application for the Bus Pirate. Unfortunately the code is not documented very well so I think that it will be faster if I learn the PIC24F programming specification and create another one.
[quote author="TitanMKD"]Maybe buy PicKit3 it is the latest PicProgrammer replacing PicKit2 and supporting more PICxxx chipset.[/quote]
Be aware of the PICkit3's shortcomings compared with the PICkit2 - see http://dangerousprototypes.com/docs/PIC ... rogrammers (http://dangerousprototypes.com/docs/PIC_Resources#Programmers)
I wouldn't recommend a PICkit3 to my worst enemy... unless it was the PICkit2 didn't support the device(s) for which it was needed (latest Microchip device file update for the PICkit2 was earlier this month).
I finished a simple AVR based PIC24FJ programmer. If anybody has a same problem like I had feel free to ping me. I will upload firmware, application incl. sources somewhere.
It would be great to see your code for this, I'd like to do a post about it on the blog. Which 24Fs does it support/have been tested?
I cant wait to see this; I want to make my own PIC programemr! Or Ian needs to FREAKIN STOCK THE BP PROGRAMEMR FOR FUDGE SAKE..... GAWL.
comon ian, the programmers interface is beyond proof of concept. lets start providing the hardware and i bet we will see new developers come out the wood works sharing and helping develop the software!
Agreed, would be great to have a avr based pic programmer, would reduce the cost of starting pic development, especially for those which use AVR before-hand.
like me! im fluent in AVRs and have tons laying around but want to get into PICS and AVRs. So this solution is perfect for me.
Yes, exactly the same problem. Free PCB built Bus Pirate waits until I manage to get or do the PIC programmer and I thought about some JDM-like circuit through the FT232 convertor IC, but AVR based programmer would save a lot of time, since I have already an Arduino and several AVR chips as well. Please, share your work, if you have such an intention.
frozj disappeared.... sucks I wanted that circuit.. I knew it was to good to be true; I doubt its real; he made it awful fast... I would need more time researching let alone building in that time.
"awful fast" was 3 weeks...
Anyway, did you contact him as he suggested?
I suppose it was faster then I originally thought; now that I double checked the post dates.
And yes, no reply.
Yoohoo! Jozef has replied in PM that he will post something soon. Great!
I uploaded firmware for ATMEGA8 and software at github: https://github.com/JoKr2/ApProg (https://github.com/JoKr2/ApProg)
I created this programmer according to following spec. http://ww1.microchip.com/downloads/en/D ... 39768d.pdf (http://ww1.microchip.com/downloads/en/DeviceDoc/39768d.pdf)
My goal was to burn in bootloader into my homemade BusPirate. I never worked with PICs before so all I can tell is that programmer works for PIC24FJXXXGAXXX devices.
The PCB is not necessary - I used just few wires on BreadBoard:
Note that MCLR wire is hidden under the BusPirate PCB. This wire is connected to PORTB pin 2.
I created a schematics because circuit is not clear from above picture:
Thank you very much for sharing, Jozef!
Just to be sure:
1. Atmega8 VCC = +5V? Wouldn't it be wise to use voltage level convertor to 3.3V then? (According to specs, PIC24 tolerates 5V on digital pins, but requires 3.3V on MCLR pin)
2. Button connected to GND?
3. green wire from pin 1 (RST) just forgotten and doesn't play?
4. XTAL is 16.0 and connected with capacitors of 18pF each?
5. Value of pin15 (PORTB1) to ICSP PGD resistor is 15K?
6. And there is no more hidden connections from ICSP pins?
I updated my post with circuit schematic. Please check.
Here are some answers:
1. ATMEGA operates from 2,7V to 5,5V so everything is powered from 3,3V supply.
2. Yes, it is a standard reset button - reset circuit is optional. Second pin of button is connected to Vcc via 10K resistor.
3. you are correct, this wire does not play any role here. I did not notice it somehow.
4. correct. Capacitors are 22pF but 18pF would be ok as well I guess.
5. Actually it is 1k. I use it because PGD pin changes to output state from time to time. Direct connection may lead to short circuit.
Thanks for update, Jozef
Circuit was very clear with your description. I have drawn it exactly as in your update. Only few values were uncertain.
That's interesting how Atmega8 works from 3.3V at 16MHz.
According to specs it shouldn't :) That's why there were my questions, but if it possible to push limits that much, then it may be useful.
Quote from specs:
• Operating Voltages
– 2.7V - 5.5V (ATmega8L)
– 4.5V - 5.5V (ATmega8)
• Speed Grades
– 0 - 8MHz (ATmega8L)
– 0 - 16MHz (ATmega8)
Unfortunately, it happened that I have no Atmega8 chips and my Atmega16 wouldn't work stable at 3.3V. So I will try to update the code and schematics for Arduino and will share it also if it work.
it is good to hear that code may be useful for someone else.
ATmega8A should work stable at 16MHz/3,3V.
Nevertheless 16MHz is not mandatory. I used it because it was the first crystal I found... Feel free to use any other frequency just do not forget to match baudrate tolerance. When you go for lower frequency than 10MHz, you can safely remove all nop() instructions from code.
I am going to create a connection configuration dialog as I realized that other people may naturally use it :)
Sadly could not get it work with Arduino.
But, I have managed to make my Atmega16 work stable at 3,3V and at 1MHz internal oscillator and 4800 baud rate.
Changed the settings in AVR Studio, compiled programmer firmware and it worked.
A bit fiddling with your C# GUI program (at first did not noticed, that it programs block by block and interrupted it after 1st block programmed :D ), and now I have working Bus Pirate!
However selftest showed, that I have soldered ADC1 and ADC2 pins together. Will fix that soon and post a photo to get the next free PCB :)
Thanks a lot Jozef for your help.
This is great!
I'm quite busy right now for writing a Processing library for Little-Wire (http://http://dangerousprototypes.com/forum/viewtopic.php?f=19&t=3238) but as soon as possible, i'll try to port this to Little-Wire! You clearly wrote the functions seperate, and i will try to use v-usb as an interface rather than UART. I'll keep updated if there will be any developement!
Thanks for the project!
Where did you program the software? I tried to open it with visual studio express with no success
Thanks for the project, it was just what I was looking for
I'm quite busy right now for writing a Processing library for Little-Wire but as soon as possible, i'll try to port this to Little-Wire![/quote]
That would be fantastic. I'll add an extension point to simplify this work.
[quote author="ricros"] I tried to open it with visual studio express with no success[/quote]
What version of VS do you have? VS 2010 Express should work.
I have vs 2010 express too, if I double click on the .csproj file it gives me an error, if i open it inside VS it works, don't know why but that part is working now...
does the program show any message when it finishes to write the .hex?
I am not Jozef, but I think I can help.
VS 2010 Express gave me an error also. I have directed to MS website, registered C# part of VS for free, got the serial, entered it and voila - no more errors. Perhaps you have the same error.
For the second question, I cannot remember the exact successful string, but the program should issue a couple of "poll..." strings after each block written and then should stop at the new empty line. Then you will know, that the processing stopped. If you have lots of repeating "poll..." strings, then something is wrong in your wiring between AVR and PIC.
[quote author="dmmedia"]VS 2010 Express gave me an error also. I have directed to MS website, registered C# part of VS for free, got the serial, entered it and voila - no more errors. Perhaps you have the same error.[/quote]
I forgot that...
[quote author="dmmedia"]For the second question, I cannot remember the exact successful string, but the program should issue a couple of "poll..." strings after each block written and then should stop at the new empty line. Then you will know, that the processing stopped. If you have lots of repeating "poll..." strings, then something is wrong in your wiring between AVR and PIC.[/quote]
I got those "poll poll done", I can erase, read the pic ID (0x4207)...
I've double checked the connections, they're all good, I think the program finishes to write the firmware...
I've tried several terminals, with the right configs but I got no answer from the BP...
Does anyone have a blink example to see if the pic is dead?
[quote author="ricros"]I got those "poll poll done", I can erase, read the pic ID (0x4207)...[/quote]
If you can read DeviceId and those "Writing 64 instructions at XY poll poll done." strings everything works as expected. So it looks like you are burning wrong hex file into device. The hex file shall contain configuration words at the end. For example, if you are trying to burn in BusPirate, you have to burn in bootloader hex instead of firmware hex because only bootloader hex file contains configuration words at the end. After that you can load firmware via bootloader.
if you are trying to burn in BusPirate, you have to burn in bootloader hex instead of firmware hex because only bootloader hex file contains configuration words at the end. After that you can load firmware via bootloader.
I'm trying to burn the production firmware package:
http://code.google.com/p/the-bus-pirate ... ufacturing (http://code.google.com/p/the-bus-pirate/source/browse/#svn%2Ftrunk%2Ffirmware%2Fv5-nightly%2FBPv3%26v2go%2Fmanufacturing)
as far as I know this package includes the bootloader and firmware...
Yes, that is exactly what you want.
where can I find just the bootloader 4.4?
[quote author="ricros"]I can erase, read the pic ID (0x4207)[/quote]
I have checked PIC24FJXXGAXXX programming specification and it does not contain device with id 0x4207...
My BusPirate reports 0x0447 this means that it contains PIC24FJ64GA002 device. Did you write wrong device id by mistake?
Please check http://ww1.microchip.com/downloads/en/D ... 39768d.pdf (http://ww1.microchip.com/downloads/en/DeviceDoc/39768d.pdf) page 64. In addition to that, different devices have different configuration word address. Hex file and device must match.
mystery solved, microchip sent me the wrong pic, this one is the XXXGBXXX and I just noticed that now, I'll have to order a new one
Thank you all for the help
Since few people have found programmer useful, I decided to update it a bit. According to responses in this thread, UI was enhanced so that it feels more intuitive.
There are some known issues waiting for solution:
- does not export flash memory to a hex file
- does not check memory range yet. Assumption is that user loads correct hex file for PIC device.
- several ToDo(s) in source code
If you find a bug, please let me know or fix it :)
did you ever make a compiled one? i cant find it compiled.
[quote author="BrentBXR"]did you ever make a compiled one? i cant find it compiled.[/quote]
You can find it here: http://https://github.com/JoKr2/ApProg/tree/master/Release
awesome! im gonna have to port this to a 168 or 813 i do not have any mega8's. I have not looked at the source yet but i bet it will fit on an attiny2313 or even just attiny 8pin (85, 25 or whatever) what do you think?
edit: I got it up and modified it a bit so its easier for me to read. at the moment its 3.7k; I bet we could get this down to the attiny2313 no problem.
edit2: actually I looked at the source and relised there was NO WAY theres 3k there; so I noticed I had some linkers and some librarys enabled. So I disabled all thouse and its only like 300b.
Man I have the perfect peice of hardware for this! Its a little USBASP AVR programmer. Just a simple board USB with an Atmega8 and some pins broken out on a shourded header... :D but I would need to get the vertiual com port USB on that atmega8.
edit3: I setup the pins adjustable in shared.h and added the 'standard' setbit clear bit defines and used those to set the clear the pins for readability. Im just doing this for myself; once I get those PICS so I can actually test it (editing it without testing it is just usless) Im doing it for myself so later I can easier port this to an attiny2313. But if anyone is interested in moving the MCLR, PGC, and PGD pins here it is. nothing special.
Does any PIC experts know what PICS this will work with? I know the BP one; but what do you have to look for in the datasheet or whatever to determain if the PIC has the same programming ability? I really want to make myself one of these but I only have:
[quote author="BrentBXR"]I setup the pins adjustable in shared.h and added the 'standard' setbit clear bit defines and used those to set the clear the pins for readability.[/quote]
I like your changes. Can I upload them to git repository? Also, I was thinking that we could enhance a communication protocol a bit to enable user to assign Port and Pins directly in application in addition to communication parameters. What do you think?
Bootloader v4.4 is in the bus pirate download I think.
This programming algorithm is good for many 24f maybe 30 and 33. Memory setup for each is required and some may have quirks that need special instructions
[quote author="Fezoj"][quote author="BrentBXR"]I setup the pins adjustable in shared.h and added the 'standard' setbit clear bit defines and used those to set the clear the pins for readability.[/quote]
I like your changes. Can I upload them to git repository? Also, I was thinking that we could enhance a communication protocol a bit to enable user to assign Port and Pins directly in application in addition to communication parameters. What do you think?[/quote]
Its for sure doable, i don't know how useful that is though. Personally the only major thing I want when I get the PICs needed to try it, is to put it on an attiny2313. That wont be tough at all; hell we could put this on an attiny13 and use software UART (which I have already done).
Great project! An elegant and simple solution to getting started with a Bus Pirate built from scratch.
I'm attempting to program the bootloader for a Bus Pirate version 4. The programmer I built makes contact with the PIC24FJ256 on the BPv4, but reports that the chip did not respond properly. It still attempts to program the chip however.
Here are a couple of questions:
1. How long should it take to program the PIC? It's maybe 1/4 done after 1 hour. Seems awfully long?
2. Is the PIC24FJ256 being properly programmed even though it doesn't respond properly to the initial probe?
3. If the PIC24FJ256 is not supported currently, is there a plan to support it since it's on the BPv4?
Thanks - and thanks for this truly creative project.
Some of you may have already seen this but I wanted to post this in case someone found themselves in the same situation I was in, i.e. needed to program the bootloader on the Bus Pirate but don't have a PIC or AVR programmer. I modified the Jozef's AVR firmware to run on a MSP430G2553 on the Launchpad. At $4.30 delivered, I think this is the cheapest programming solution. Here is a link
http://dangerousprototypes.com/2012/04/ ... he-msp430/ (http://dangerousprototypes.com/2012/04/10/programing-your-diy-bus-pirate-v3-5-soic-build-with-the-msp430/)
And thank you Jozef for the work you put into this and making it available to us.
And another thing about how long the PIC programming takes. Do not try to burn the combined bootloader/firmware using the ICSP programmer! Burn the bootloader only-- it only takes a minute or two vs the ~45 minutes that the combined bootloader/firmware takes to program. Once the bootloader is burned, connect PGC and PGD to force the board into bootloader mode and then use the ds30 program to burn the firmware-- this should only take a minute or two. Total of 3-4 minutes for bootloader followed by ds30 vs 45 minutes for the combo.
Also for some reason, my Bus Pirate did not even work after the combo bootloader/firmware.
I came across basically the same problem as the topic starter, but for a different PIC. I needed to program a PIC16F630. I tried the serial port style programmer that Jaakko Hyvätti's Picprog (http://http://hyvatti.iki.fi/~jaakko/pic/picprog.html) is written for, but I couldn't get it to work. So I made a simple AVR program and a quick-and-dirty patch to Picprog to flash me a PIC16F630. I'm releasing the program (http://http://digitalbrains.com/2012/avr-picprog) under the GPLv3. The included README does suppose you are well versed in working with AVR's, avr-libc and avr-gcc. As an afterthought, I've tried to make it a little easier by including a firmware for an ATmega88 @ 20 MHz.
The firmware only uses one 8-bit timer and an external interrupt, all other functions are completely implemented in software. So it should be possible to run it on any AVR with enough memory and 6 I/O pins available.
I suspect the programmer might work for all PIC12 and PIC16 chips supported by Picprog, but I didn't investigate much.
I used a simple USB to serial converter with 5V logic lines. Don't connect the AVR straight to a serial port of your PC :).
I'm providing this as-is. It did it's job for me, I added some documentation and functionality in the hope that it is useful for other people. I don't intend to do any more work on it, but others are encouraged to add all the bells and whistles they want! :)
I submitted the ugly, ugly patch for Picprog to the author of that program. Perhaps he or someone else wants to add proper support for this programmer to it. Or something alike.
This is my first post, and as such I can't create links to my program or Picprog. In 24 hours or so, I will come back and post this again with URL's.
<edit>Added URL's. But see next post for added content!</edit>
Sorry about the spam filter. Please do post an update :)
[quote author="ian"]Sorry about the spam filter.[/quote]
No problem. I understand it.
I've released a new version. The original one contained a bug that might have deteriorated serial communication robustness, so that one is fixed. But I've also added a second target, including pre-built binary: the ATtiny25. While it is of course nice to use the smallest AVR possible for the task, using 6 I/O pins on an 8-pin device means there have to be some compromises. The ATtiny25 is definitely not first choice when you're new to AVR's, because it is easy to screw up and waste an ATtiny25 during programming, and it also might be necessary to calibrate the internal oscillator if the factory calibration isn't good enough.
Oh, and I found a PIC16C84 and PIC16F84 in a box, so I also tested that those worked with the programmer. And yes, they did.
The software folder in github seems to be some wierd language (unmentioned and non-obvious)
Why do you need that software for ?
( My 1'st post.... forgive if a bit dumb... also i'm not a PIC guy)
Sorry for the dead-awakening.
Either I'm not doing something right, or the code is broken.
I loaded everything up in the AVR Studio, had some errors - I think I managed to fix them, compiled, burned hex, and something is still not working. Is there a pre-compiled hex somewhere?