[SOLVED] Error programming PIC

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Hello and thanks always for your help.
I am trying to program a 18F2550 pic IC. I put it on a breadboard, attached the pins to the pins on amy PICKIT3 and use the MPLAB IPE v2.35 (I also tried directly from the MPLABX later with the same results)

Anyway, I got errors and couldnt program it.
The first got I got was:

"Target Device ID(Ox0) does not match expected Device ID Ox1240"

and then when I tried to program it

"Address 0 expected value e8 received value 0
Failed to program device"

What can I be doing wrong??

This time I am powering the IC with 4 batteries and conncet MCLR and Vdd with a resistor.
 

DerStrom8

Joined Feb 20, 2011
2,390
4 batteries likely gives you 6V. The PIC18F2550 is a 5-volt device, you may have damaged it.

How do you have the pins connected? Please post a schematic of your ICSP circuitry.
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
4 batteries likely gives you 6V. The PIC18F2550 is a 5-volt device, you may have damaged it.

How do you have the pins connected? Please post a schematic of your ICSP circuitry.
Thank you for your reply
Isnt the electrical characteristics of that Pic :

Voltage on VDD with respect to VSS ......................................................................................................... -0.3V to +7.5V

Reading this I thought that is still ok. Perhaps not? :(

The pins are simply, each pin of the PicKit 3 connected to its respective pin in the PIC, and VDD connected to + and Vss connected to ground. I put a resistor between MCLR and Vdd. Nothing more.
 

DerStrom8

Joined Feb 20, 2011
2,390
Thank you for your reply
Isnt the electrical characteristics of that Pic :

Voltage on VDD with respect to VSS ......................................................................................................... -0.3V to +7.5V

Reading this I thought that is still ok. Perhaps not? :(
Woops, you are correct. But those are the absolute maximum values, you really should try to stick closer to 4V. But you're right, it probably didn't damage it.

The pins are simply, each pin of the PicKit 3 connected to its respective pin in the PIC, and VDD connected to + and Vss connected to ground. I put a resistor between MCLR and Vdd. Nothing more.
This is the circuit you need to use. Please check that you have the pins connected correctly:



You may leave out the LED and 300 ohm resistor if desired, they are not required.

Here is the pinout of the PICkit:




It appears that the PICkit is not seeing your PIC:

Target Device ID(Ox0) does not match expected Device ID Ox1240
Reading 0x0 suggests that PGC or PGD are connected incorrectly. Make sure they are connected properly (not swapped) and ensure they are not loose.

Are you using a breadboard? Are you powering externally during programming, or are you allowing the PICkit to supply power?
 

ErnieM

Joined Apr 24, 2011
8,377
"Target Device ID(Ox0) does not match expected Device ID Ox1240"
Note the return value: all zeros. You get the same data when reading registers. Check your connections to the PICkit carefully. Something is amiss.

The PICkit can power the device during programming, and for lightly loaded projects as well. I would leave the batttery off during programming as I would worry that the excessively large voltage could damage the PICkit. Do note that while the absolute max for the PIC is 7.5V the opperating voltage only goes to 5.5V.

I have never connected pin 6 of any PICkit to anything. It is only used for Low-Voltage ICSP Programming.
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Thank you for the very useful replies. I will try them today (I just started my day :) )

Just one thing: I tried the PICKIT powering the IC. However it was not possible. I don't know if it is because the IC has USB capabilities , but the program reported that 4.7 v were detected in Vdd (when 5 was needed) so couldnt power it. Apparently the power provided by the pickit was not enough.
 

ErnieM

Joined Apr 24, 2011
8,377
AFAIK the PICkits don't boost or buck the 5V line, it is switch from whatever is on your USB port, and sometimes these run a little low.

Try adjusting the programming voltage down to 4.5V (MPLAB X has this setting) and all should be fine.
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
PICkit 3 is trying to supply 5.000000 volts from the USB port, but the target VDD is measured to be 4.750000 volts. This could be due to the USB port power capabilities or the target circuitry affecting the measured VDD.

The target circuit may require more power than the debug tool can provide. An external power supply might be necessary.
Connection Failed.
I followed your advice and used 4.75 (from the IPE though)- although it "recommended" me to use 5V. And it recognized the IC and programmed it!
I tried it (still with the PICKIT powering it) and it works as expected!
Later I tried it powering with 4 batteries, and it works well too.


thanks!

P.S. I just wonder what exactly does that error message meant after all:"the target VDD is measured to be 4.750000 volts"...
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,377
Congratulations on getting your device to work. That is actually not a simple thing to do the first time so good work.

The message "the target VDD is measured to be 4.750000 volts" means precisely what it says: the PICkit measured the supply voltage on your chip and reported it was out of tolerance.
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Just to add to my original question in case someone needs a reference. The error that I asked is produced usually from some connection gone bad. For example, connecting the programmer cables to another pin by mistake ... or having a defective breadboard that doesnt connect them well. I discovered that through hours of work with this
 
Top