Pickit 3 not programming

Thread Starter

jbvander

Joined Jul 17, 2010
4
I am trying to program a very simple hello world program to blink a light onto a PIC18LF14k22 with a Pickit 3. It builds fine, and then I program it and I get:


PICkit 3 detected
Connecting to PICkit 3...
Running self test...
Self test completed
Firmware Suite Version...... 01.26.05
Firmware type......................PIC18F
PICkit 3 Connected.
Target Detected
Device ID Revision = 00000003

Programming...
Programming/Verify complete

However, I am not able to 'Release from Reset'
And the program does not function on the chip.

This is the code:

#include <p18lf14k22.h>
#include <delays.h>

#pragma config FOSC = IRC
#pragma config WDTEN = OFF

#define LEDPin LATCbits.LATC6 //Define LEDPin as PORT D Pin 1
#define LEDTris TRISCbits.TRISC6 //Define LEDTris as TRISD Pin 1

void main ()
{
LEDTris = 0;//Set LED Pin data direction to OUTPUT
LEDPin = 1;//Set LED Pin
while(1)
{
LEDPin = ~LEDPin;//Toggle LED Pin
Delay10KTCYx(25);//Delay 250K cycles (1 second at 1MHz since each instruction takes 4 cycles)
}
}
 

tom66

Joined May 9, 2009
2,595
Have you done all the simple checks, like:

  • Checking MCLR is connected to Vpp/MCLR
  • Checking the chip's Vdd is connected to the PICkit 3 Vdd?
  • Checking the chip's GND is connected to the PICkit 3 GND?
  • Making sure you have an external voltage source OR the PICkit 3 is powering it? By default the PICkit 3 does NOT autodetect supply voltage and you must turn it on. A multimeter is best for this.
  • If you are powering it from the PICkit 3 make sure there is no short circuit on your board.
  • Making sure you have a 100n capacitor between Vdd and GND, near the chip, for stability? You can sometimes omit these, but if you do it can cause a lot of problems with noisy supplies causing the chip to reset.
 

Thread Starter

jbvander

Joined Jul 17, 2010
4
All the pins from the Pickit are connected to the correct pins on the chip, I just checked them with a multimeter.
I have a 100uF capacitor between Vdd and Vss on the chip, is that too large?
 
My only reference to 18f14k22 is thru a Pickit 2. By default, Debug is enabled for the 18f14k22. If you program thru MPLAB release mode, then there should be no problem. If programming in standalone mode, then bit7 of config 4L word needs to be toggled, by clicking on Configuration in the Pickit configuration editor window. Could be a similar situation with the Pickit 3?
 

tom66

Joined May 9, 2009
2,595
You should also have a 100nF capacitor between Vdd and Vss, the 100uF is only a tank capacitor it's not going to filter the glitches from the chip.
 

BMorse

Joined Sep 26, 2009
2,675
Or the OP should just click the icon on the menubar to bring MCLR to Vdd, to release it from reset after programming... Since the Pickit3 is not complaining with errors and it does connect to the uc with a valid device ID....and it passes the program and verify stage...

Pickit3 menu.jpg


B. Morse
 

Thread Starter

jbvander

Joined Jul 17, 2010
4
Thanks for all the responses. I was supplying current to the chip with a switching power supply that I built. I thought that this might be causing noise on the chip. So I have swapped it with a linear power converter. I also placed a 0.15 uF capacitor in parallel with the 100uF to deal with ripple frequencies.

However, now I am getting an error that I was getting before with the switching power supply as well:

Programming...
The following memory regions failed to program correctly:
Program Memory
Address: 00000000 Expected Value: 0000007a Received Value: 00000000
Programming failed

Target Removed
 

Vaughanabe13

Joined May 4, 2009
102
Why don't you try removing all power from the target board and programming the PIC with your PICKit3, and use the PK3 to supply the power? You can enable power from the options menu of the programmer drop-down. At the very least it will give us more info to work with.
 

BMorse

Joined Sep 26, 2009
2,675
Why don't you try removing all power from the target board and programming the PIC with your PICKit3, and use the PK3 to supply the power? You can enable power from the options menu of the programmer drop-down. At the very least it will give us more info to work with.

Well if something is wired wrong in the circuit, I wouldn't recommend trying to power it off the pickit3 (Unless you just want to buy a new one :) ), try it with the original power source you had without connecting the pickit3, and use a multimeter to check the circuit for proper voltage levels, and also double check your ICSP connections if using this method of programming the uc... and triple check your circuit connections!! at the very least to get the circuit to properly be programmed, you will need both VDD and VSS connected, if using a crystal, make sure crystal is oscillating, (you can use a piezo speaker to test this, if you do not have an oscilloscope) and make sure you are using the proper caps for it, and if using the MCLR pin as a reset then make sure you have atleast a 10k resistor pulling it up to VDD, and a 1N4148 diode in series with it to prevent programming voltages from back feeding into the circuit itself.......


You should really post a circuit schematic of how you have everything connected, this will definitely help in determining your problems... since I do not see a config for disabling the Low voltage programming (LVP), how do you have RC3 connected (This is the LVP enable pin if LVP is enabled in the config)...


B. Morse
 
Last edited:

Thread Starter

jbvander

Joined Jul 17, 2010
4
Thanks so much!! The LVP was not dissabled. So I disabled it and now its working. Is this a configuration that does not usually need to be set for an 18f as opposed to an 18lf pic? (i am using the 18lf)
 
Well if something is wired wrong in the circuit, I wouldn't recommend trying to power it off the pickit3 (Unless you just want to buy a new one :) ), try it with the original power source you had without connecting the pickit3, and use a multimeter to check the circuit for proper voltage levels, and also double check your ICSP connections if using this method of programming the uc... and triple check your circuit connections!! at the very least to get the circuit to properly be programmed, you will need both VDD and VSS connected, if using a crystal, make sure crystal is oscillating, (you can use a piezo speaker to test this, if you do not have an oscilloscope) and make sure you are using the proper caps for it, and if using the MCLR pin as a reset then make sure you have atleast a 10k resistor pulling it up to VDD, and a 1N4148 diode in series with it to prevent programming voltages from back feeding into the circuit itself.......


You should really post a circuit schematic of how you have everything connected, this will definitely help in determining your problems... since I do not see a config for disabling the Low voltage programming (LVP), how do you have RC3 connected (This is the LVP enable pin if LVP is enabled in the config)...


B. Morse
No, if you remove all power connections from the target board, the only power that can get to the board would be from the PICKit3, so unless you are using a step-up converter to generate super high voltages or something, your PK3 would not be damaged. It is very possible that the circuit still wouldn't work correctly, but it definitely wouldn't damage the PK3. What I was suggesting was just standard troubleshooting - If you can't get it to work one way, try it another way. But anyway, it seems like the problem is solved so I'll stop talking.
 
Top