Flashing one of the 'other' controllers.

Hi all.

After receiving an OpenBench Logic Sniffer (1) i went on updating the firmware on the PIC and the bitstream of the FPGA. There my stupidity kicked in and i tried to flash the bootloader (instead of the firmware) of the pic. I used a windows gui program (2). The program did his thing and mentioned that everything went ok. It did not.

After my mistake the board doesn't register as an virtual serial port or HID device anymore. Here i realized i bricked it. Looking through the openBench forum(3) is learned that i did nuke the bootloader and have to flash a new one. Here is where i got stuck, i don't have a PIC programmer.

Now on to the actual question. Would it be a very difficult project to use an arduino (duemilanove or mega2560, i have those) as a PIC programmer?

There is an example of using a buspirate(4) on the openBench forum (5) to do the flashing but i don't have one of those and would prefer not to buy that one as well. The actual PIC in use is a "PIC18F24J50" that can be flashed in a low voltage way. It doesn't need 12V or so to flash. Well, that's what i understood after browsing the datasheet.

regards, Jeroen

Links: (1) http://gadgetforge.gadgetfactory.net/gf/project/butterflylogic/ (2) http://dangerousprototypes.com/forum/viewtopic.php?f=23&t=1636&sid=1890bfe1a09ced4fd0685d404d61c00f (3) http://dangerousprototypes.com/forum/viewforum.php?f=23 (4) http://dangerousprototypes.com/bus-pirate-manual/ (5) http://dangerousprototypes.com/forum/viewtopic.php?f=23&t=620

Hi Jeroen,

Found this datasheet - http://ww1.microchip.com/downloads/en/DeviceDoc/39687e.pdf - 32 pages - about programming the PIC18xxx series might be helpfull. especially from page 7 and up. From the picture bottom page 7 it becomes clear you need 4 lines - MCLR - VDD - PGD = data - PGC = clock

The latter 2 seems like a job for the SPI bus, for VDD and MCLR a digitalWrite() should suffice

Point of attention is that the commands are 4 bits followed by 16 bit operand (par 2.5) In chapter 3 the ICSP bulk erase is coded and it seems reasonably straightforward - not that its easy - but doable.

BTW I found this URL on - http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en534039#1

Thanks for the reply and thoughts Rob. I learned from that datasheet that this particular pic doesn't need high voltage programming.

I may be lucky as i've found someone on the sparkfun channel who's willing to reflash the pic with his bus pirate. It seems that this is going to happen on Saturday. Would be cool to do it with an arduino though.

The thing that's holding me back is that that would be yet another jak shaving session before i can actually start with the project i had in mind.

I'll update this thread when i got something new to tell.


ps. If someone has a solution for my problem that i could do by myself, i'm still very interested at that.

So it appeared to be an user error :blush: ...

I started with coping information from all over the dangerous prototypes wiki and forum into a text file. Than i saw that there was a trick i didn't try yet. Connecting PSC and PGD. That made the board appear again. With other words, i did not damage the bootloader after all.

I even managed to update the pic firmware and the fpga bitstream without bricking again, hurray. The board does seem picky about the combination of firmware/bitstream.

In hindsight, storm in a glass of water.

Thanks again Rob for the reply and nathan7 from sparkfun irc channel for the offer to reflash.