and it works great… BUT only when I put the PIC into the socket. Since I am using the internal oscillator and not the USB Bootloader I need to program the PIC via the programmer and not usb bootloader… So I’m getting really tired and pissed off that I have to take my PIC out of the circuit and put it into the programmer and then put it back in.
So, I decided to setup the ICSP so I dont have to pop it in/out all the time. I found some tutorials on SparkFun and google. I connected it just like I was supposed to. I enabled (at least I think I did) ICSP in my programming application. But no luck I keep getting a “failed programming” error when I try to program my HEX file into the PIC.
I have the ICSP connector just like I have to. I checked it to the datasheet and like 10 other images/site/schematics.
How am I supposed to have the PIC setup for the ICSP? I have the power turned off like I’m supposed to… With the MCLR to +5v plugged in, the LED on the programmer doesn’t light up, but when I remove that cable it lights up. I don’t know what else could be wrong! Do I need any resistors anywhere? I tried putting a 10k resistor between Vpp and Vdd but that didn’t work.
Anyone know what could be wrong?
I tried using WinPic, WinPic800, and ICProg. None of them work. They all send data to the programmer and I can see the programmer’s LED blinking as it gets data but it doesn’t go into the PIC for some reason.
I know the Vpp line is supposed to read like 12-13v, right? How should I test it? Between Vpp and GND? Should I also get 5v between Vdd and Vss?
Check and double check the wiring of the ICSP connector to your breadboard. It is VERY easy to get this wired backwards even if you think you have it right. Also be sure you have the PGC and PGD connections from the ICSP to the chip correct - check and double check these also. I have had both of these problems and it can be very frustrating.
I had all sorts of trouble until I set my ICD2 to be powered from the circuit. Does your programmer have the same configuration option? Also make sure you have a strong enough power source for the circuit and programmer. I have found that I can have at most two PICs and some LEDs and a couple of MCP23017’s powered on my breadboard to be able to program the PICs. Much more and I can’t program anything at all due to not enough power. I had to remove the dsPIC4011 because it was requiring too much power.
MCLR should go directly from the ICSP to the chip.
This is one reason I chose to get the Olimex ICD2. It’s fully MPLAB compatible and I can easily check to be sure the ICD2 is getting enough power to work properly. I definitely recommend this ICD2!
I would get the fancy programmer if I had $100 to blow. Sadly, I don’t and I need to spend it on other things.
You have the Olimex ICSP cable, right? What colors are the wires? Mine are:
white
green
pink
yellow
grey
brown
White is pin #1, correct? I have Yellow on PGD, grey on PGC and brown on PGM.
have those 3 pins directly connected to the RB7/RB6/RB5 pins on the micro.
The ICSP/programmer power the PIC while its programming. When its not programming, I tap into my USB port for 5v. Works perfect for many LEDs and other goodies. Never had problem with USB as power before.
My MCLR/Vpp is connected to the ICSP… But, in order for the PIC to work you need a MCLR to +5v. I currently have that wire removed because without it the LED on the programmer turns on.
I am not sure what you mean by this but MCLR can’t be hard wired to +5V if you want to use the ICSP programming. MCLR is also the VPP line so if you drive it from something else in your circuit you need to consider it hits about 13V when progamming over the ICSP lines. Typically people just pull it to +5V with a 10K resistor, and if soemthing else drives it use a diode to isolate the pin from the driving signal (anode to MCLR/VPP + 10K pull up, cathode to driving signal.)
When I run my PIC I have MCLR connected to +5v. But when I have the ICSP plugged in, I remove that connection and have MCLR connected to the Vpp on the ICSP. Correct?
Now, what about this 10k pull up? Is it required for ICSP?
use the 10K pull-up to +5V and it should not interfere with the ICSP, and 10K is enough resistance that you will not be able to backfeed the VPP voltage into your +5V rail. You NEED the MCLR/VPP connection to the PIC to use ICSP.
10K allows enough current to pull MCLR to +5V if nothing else is driving it. That way you can just hook the ICSP up and not have to change what MCLR is connected to every time you go to program.
Um, maybe a dumb question but did you actually try to use the ICSP with MCLR still hard wired to +5V? olimex.com/dev/pdf/pic-pg2c.pdf under ICSP Programming suggests you can destroy the programmer if you did. Can you still program parts out of circuit? (this is just a test to make sure everything still works.)
Other possibilities… +5V conflict between the programmer and your circuit? Using the ICD2 you can select who powers the device. It is not immediatly clear (in my 3-1/2 minutes of reading through the materials) how this is arbitrated using the sparkfun device but it may be something to examine more carefully.
Actually, the first time I tested the ICSP I did have MCLR to +5v w/o resistor. After it didn’t work I removed the wire and tested it again and it still didn’t work. After that I went to sparkfun and noticed the large bold text that said “WARNING” ^^;; After I read the warning I tested the programmer and it still can read/write/clear the PIC just fine.
EDIT:
While programming, I get 13.08v on Vpp to Vss and 5.01v between Vdd and Vss.
Believe me, when I am spending over $100.00 on something, I consider things very carefully. Remember, I am on a fixed income, so when I spend money on this stuff I want to be pretty darn sure it is going to do what I need and work properly.
The ICSP cable that came with my ICD2 is color coded differently from yours. The additional ICSP cable I have (also from OLIMEX/SFE) is color coded different than this, so color code is not something we can go by on these cables.
I have:
Yellow (Pin 1, MCLR)
Grey
Pink
Green (Pin 4, PGD)
White (Pin 5, PGC)
Brown
You do NOT need to have PGM connected.
Remember though that programming requires more power (and higher voltage) than running a circuit by itself.
I just have MCLR going to the PIC’s MCLR (Pin 1) and have a 1K (at present) pull up to +5V.