66% or better

Using an ATmega8 to program PIC24FJ chips

[Fezoj] likes to play around with microcontrollers and decided that he wanted to try a Bus Pirate as a new tool in his adventures. Since it’s open hardware he had his own board made and populated it himself. The trouble is, he works only with AVR chips and doesn’t have a PIC programmer. No problem, he figured out how to flash the PIC24FJ using an ATmega8.

To get started, he grabbed a copy of the flash programming specifications from Microchip. Once he had implemented the protocol in the AVR code, it was just a matter of getting the downloaded PIC firmware to the AVR. An RS232 chip gives him the serial connection he needs, with the help of his own programming software written with Visual Studio.

It’s not a robust solution for prototyping on the PIC platform, but maybe it could be developed for that purpose. For now, all he needed was a bootloader so that he could flash the Bus Pirate via a USB connection.

[via Dangerous Prototypes]

Comments

  1. Microguy says:

    I like Visual Studio, I have an old version. But would not have thought to use it for programming Microsoft, cool!

  2. kirill says:

    That a great idea. I think it could be easily implemented into the arduino so it could some pics.

  3. grant says:

    so…would this work on an arduino as well? would make it nice and easy to switch to pics.

  4. nexekho says:

    Could I program an ATMega48 using my 328P Nano? I’ve seen examples of people using the bigger Arduinos to program ATMegas, but it usually involves removing the IC which is impossible on a Nano.

  5. I did something similar with for a PIC12 a while bac.

  6. peter says:

    it’s like microcontroller sex

  7. kernelcode says:

    This is pretty awesome – been looking for an AVR-based PIC programmer for a while.
    Perhaps you could use this to bootstrap one of the many PIC-based PIC programmers using an AVR

  8. someonecool says:

    I should try this on those new pic32′s, specifically the DIP versions. :P

    PICkit2 does not support them, only pickit3, and I don’t want to shell out 30 bucks, so this is worth a shot I presume.

    • Xyf says:

      I am going to use the new pic32 ( mx1xx ) in the near future, and I only have a pickit2 also. Could you not program it by selecting a supported chip (mx3xx/mx4xx) of the same flash size? The flash programming specs seem to be the same for the entire pic32 family.

  9. Goldscott says:

    I’d also like to see an arduino program a pic32.

  10. sascha says:

    I’m now thinking if this would be something that could be used to dynamically re-programm the PIC chip… *inspirationstrikes*

  11. Gragg says:

    Note that he is using 3v3 for both the AVR and the pic. A 5v arduino could probably be used with 5V pics, but a separate supply or a translation would be needed for arduino -> 3v3 pic.

  12. cgimark says:

    While good for the one off programming of a pic I wouldn’t recommend it as a full time method. Believe me I tried all the cheap routes, the serial port programmers, the parallel port programmers, every proto board and breadboard circuit I saw and nothing compares to using the microchip pickit. The problem you run into with pics is there are so many variations between chips that your software has to support them and not a lot of the pic program software is kept up to date anymore. Spend the $40 , it is well worth it for the pickit.

  13. wLinux says:

    Update, the code on their repo no longer compiles, so I updated it! The new repo is at https://github.com/weblinux/ApProg.

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