Dangerous Prototypes

In development => Project logs => Topic started by: schazamp on October 30, 2011, 09:15:00 pm

Title: Bootstrapping a PICqueno32
Post by: schazamp on October 30, 2011, 09:15:00 pm
I posted a while back about trouble I was having programming my bare-bones PICqueno32 Free PCB with my ICD3 ( viewtopic.php?f=56&t=2715 (http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=2715) ).  I concluded that my ICD3 was bad, and so set out preparing to replace it.

I have heard a lot of good things about the PICkit2, and the many clones that are available, so I decided I wanted to give that a go.  Of course, to program the processor in the PICkit2, I needed some other programmer.  I settled on a JDM2-style programmer.  I have successfully completed these projects, and wanted to post a start-to-finish guide, since I had seen bits and pieces around, but never everything all in one place.

I started with the schematic for the JDM2 Programmer in this instructable by Ian ( http://www.instructables.com/id/JDM2-ba ... rogrammer/ (http://www.instructables.com/id/JDM2-based-PIC-Programmer/) ).  I chose this one because I knew it would support the PIC18F2550 that the PICkit2 needed.  The schematic was pretty straightforward.  I implemented in on perfboard because it was a pretty simple design, and I didn't feel like digging out my etching equipment.

[attachment=1]

It's kind of messy, but I really enjoy the challenge of going from a schematic right to perfboard a few components at a time, without any real planning.  It's a good spacial problem-solving exercise, and I can certainly use the practice.  Anyway, this technique always turns out messy, but usually works okay, if I'm careful.

[attachment=0]

I changed the original design by combining the pinouts for 28-pin and 40-pin sockets, and leaving off the 18-pin socket, which I didn't anticipate using.  I had all the parts (except for the 8v2 zener) in my drawer, so I only had to wait around for that to arrive before I could finish it.

To program the PIC18F2550, I had to find a PC with an old-school serial port.  I thought my main PC had one, but I was wrong, I ended up programming it with the old Thinkpad Pentium III laptop I use for looking up datasheets in the workshop.  I use the SliTaz linux distribution on it, which works pretty well considering the hardware limitations.  After digging around a while, I found the PICPgm programming software package ( http://members.aon.at/electronics/pic/picpgm/ (http://members.aon.at/electronics/pic/picpgm/) ), which supports the JDM2 serial programmer and distributes binaries for Windows and Linux.  The latter was very important, since this laptop doesn't have a compiler installed on it, and I was worried that the binaries would not work, but luck was with me, and I was able to program the PICkit2 firmware onto the PIC18F2550 with the JDM2 programmer.

It took for-ev-er, and I made the mistake of browsing the web on the laptop while it was programming the first time, and there were errors.  After trying again without using the laptop at all, it was successful.  On to the PICkit2 build!
Title: Re: Bootstrapping a PICqueno32
Post by: schazamp on October 30, 2011, 09:33:02 pm
There are many PICkit2 clones out there, but after looking around for a while, I finally settled on this one, http://www.micros-designs.com.ar/pickit2-clone-5v3-3v/ (http://www.micros-designs.com.ar/pickit2-clone-5v3-3v/) , recommended in this other forum thread ( viewtopic.php?f=56&t=2934 (http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=2934) ).  I liked this one because it looked fairly simple, I had the parts on hand (no fancy MOSFETs or op-amps), and because it supported both 5V and 3V3 targets, the latter of which I knew I needed for the PICqueno32.

Again, I went with the perfboard.  I was less confident in doing this one without a custom PCB, but I figured it was worth a shot, the parts were cheap, and I didn't want to wait.

[attachment=2]

The only differences from the original design was that I substitued 2N3906 PNP transistors for the BC558A PNP transistors specified in the schematic, and I used a 3V3 regulator (MCP1700-3302) in place of the regulator circuit, since I had one handy.  This whole circuit was obviously a lot trickier to do on perfboard, but by using 0805 SMD passives where space was tight, I was able to fit everything in.  You can see some of them toward the programming header at the top left.  The 0805s can be really handy, because they fit perfectly between two pads.  They are perfect for bypass capacitors on the PIC because the VCC and GND pins are usually adjacent.  In most cases, though, I still used the through-hole passives because the leads are handy for making the connections from one part of the board to the other.  Someday I'll get bold and try to do a SOT-23 transistor that way.

[attachment=1]

After I finished the soldering, I programmed the PIC18F2550, and plugged it in.  The device enumerated OK, but the voltages on the output programming header weren't right, it turns out I had missed the ground pin connection.  Once I fixed that, everything looked okay.

I used Microchip's own PICkit2 programming utility ( http://www.microchip.com/stellent/idcpl ... e=en023805 (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805) ), as suggest by the clone instructions.  It worked like a charm, and programmed the PICqueno32 bootloader (from the SVN repository - http://code.google.com/p/dangerous-prot ... 2FPICqueno (http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/#svn%2Ftrunk%2FPICqueno) ) without any trouble.

[attachment=0]

Since I had only populated the bare minimum of the PICqueno32 necessary to program the chip (to save trouble if I had goofed something up soldering on the PIC32 chip; I have little experience with TQFP that tiny), I have some more soldering to do to get it ready to try out the hello world "blink" program, more on that later, as soon as I finish it (naptime'll be over soon, so I suspect I'll be back on 2-year-old duty before I'm done).
Title: Re: Bootstrapping a PICqueno32
Post by: arupbsk on November 02, 2011, 04:55:49 am
Great schazamp. I even did the same you did now. I have built Ian's JDM2 programmer and the same PK2clone from same site, but in both cases I used etched boards. I had to make a PK2 for making my freePCB  of BPv3.5 alive. For only need of programming 18f2550 of PK2 I've built the JDM2clone and for only need of programming 24fj64 of BP, I've built the PK2.
JDM2 will never come in my work, as I also dont have COM port. I has to goto friend's home for burning the 18f2550.
I think the PK2 will come in any work in near or far future.
My JDM2: viewtopic.php?f=48&t=2747 (http://dangerousprototypes.com/forum/viewtopic.php?f=48&t=2747)
My PK2: [attachment=0]
Title: Re: Bootstrapping a PICqueno32
Post by: schazamp on November 05, 2011, 08:18:14 pm
I have finished populating the PICqueno32, and successfully programmed it.
[attachment=2]
Since I am a cheapo^H^H^H^H^H^H^Hresourceful, and didn't want to buy another FTDI chip, I wanted to program the device with my FTDI cable.  Since it is a pain always trying to make the connection with jumper wires, I built a special FTDI adapter shield out of protoboard.  It takes the 6-pin FTDI cable and hooks it up to the power, ground, TX, RX, and reset pins (via a 100R resistor).  I have not successfully got the auto-reset stuff to work quite right, but everything else is fine.
[attachment=1]
If you want to try it at home, note that the orange TX pin on the FTDI cable goes to the RX pin (pin 0) on the PICqueno (or Arduino, for that matter), and likewise, the yellow RX pin on the FTDI cable goes to the TX pin (pin 1).  I would always get that backwards (hence the shield).

I didn't populate the 8-pin header which is off the 0.1" grid, since I didn't need anything on it, and it didn't line up right.  It means this shield will always have to go on top, but since any permanent project will remove it anyway, that should be just fine.

I may break out a 4-pin (GND, VCC, SCL, SDA, not necessarily in that order) I2C header off of the same protoboard at some point.
[attachment=0]
I successfully programmed a modified "Blink" sketch using the IDE.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01042086976session_write_close ( )...(null):0
20.01072218568ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01072219344Database_MySQL->query( ).../DatabaseHandler.php:119
40.05412358080Database_MySQL->error( ).../Db-mysql.class.php:273