Need help / verification error and invalid target id warning PIC16F877

Status
Not open for further replies.

makris

New Member
Hi, I am a university student and I am trying to go over some tutorials that were given to me by my supervisor and I am encountering some strange errors. It should be noted that this is my first time I am attempting PIC programming so all I know for sure is that I am following the tutorial step by step so it is pretty clear to me that something is happening that was not suppose to happen.
I am using MPLAB IDE v.7.4 and MPLAB ICD2 as the controller. My PIC16F877 is connected onto a PIC board which has a 20MHZ crystal a MAX232 and is connected onto the controller using an RJ11 connector. The PIC is powered by an external adaptor of 5V/1A and there are also 8 LEDs onto all B pins.
The code I am using is a basic LED counting test:

//LED counting test.c
#include<16F877.H>
#pragma fuses HS,NOWDT,NOPROTECT,NOLVP
#pragma use delay(clock=20000000)

void main()
{
int value;
set_tris_b(0x00);
for(value=0; value<=60; value++)
{
OUTPUT_B(value);
delay_ms(1000000);
}
}

MPLAB gives me a warning and an error

Warning:
ICDWarn0020: Invalid target device id (expected=0x4D, read=0x1FF) Error:

ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0x3000, Val Read = 0x3FFF)
I’ve been looking around through the internet for similar topics but I can’t seem to figure out what’s wrong. What got me really confused is the fact that I bought a new PIC just to try and see if it got fried, and the first time I tried to program it, it worked. But the weird thing is after being programmed once it started the same problems as the previous PIC.
I also tried to set the memory locations as manual like some forums suggested but nothing changed.

The Self test numbers are:
Target Vdd: 5.04
Target Vpp:12.46
MPLAB ICD 2 Vpp:12.54

And additional info:
Oscillator HS
Watchdog timer OFF
Power Up timer OFF
Brown Out detect ON
Low Voltage Program DISABLED
Flash Program write ENABLED
Data EE read protect OFF
Code Protect OFF
Thanking you in advance,
Kyriacos Makris
 
Warning:
ICDWarn0020: Invalid target device id (expected=0x4D, read=0x1FF) Error:

ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0x3000, Val Read = 0x3FFF)

This means that the chip cannot be seen.. The ICD knows there is something there but not a pic16f877. Check that the connections for programming are correct otherwise the pic may be duff.
If its a new chip then it must be connections... Are you sure the correct device has been set?
 
Yes it is correct,
the weird thing is, if the case is that it cannot be seen then it shouldn't have worked the 1st time I installed the new one,right?
 
Are you sure you haven't got LVP set? ( pics can act weird ).. Check you haven't put too much current through pins 39 and 40.

Any chance of a small shematic
 
Yes I am monitoring it as it goes through the proccess of erasing and programming again.
How can I check the current that goes through those pins?How much should it be?
And what kind of schematic are we talking about?
Thanks again for helping me out!!
 
It seems that it does not actually erase what is on the PIC although it says it was succesfull.

MPLAB ICD 2 Ready
Erasing Target Device......
Erase Succeeded
MPLAB ICD 2 Ready
Blank Checking......
Program MemoryICD0161: Verify failed (MemType = Program, Address = 0x1000, Expected Val = 0x3FFF, Val Read = 0x0)...
Device not blank
MPLAB ICD 2 Ready
Programming Target......
Validating configuration fields...
Erasing Part...
Programming Program Memory (0x0 - 0x38)
Verifying......
Program Memory
ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0x3000, Val Read = 0x3FFF)
ICD0275: Programming failed.
MPLAB ICD 2 Ready
 
Oh!!! Your'e gonna have to check connections.... Everything looks tickey boo...

Is the pic on its own circuit?
 
well that might be good news, at least i know am not doing anything wrong,all I need is to get another PIC board
 
its something custom made from what i can tell,here is a schematic for it...
 

Attachments

  • pic board schematic.jpg
    16.7 KB · Views: 188
If the PIC is in a socket (1) check the IC orientation, (2) confirm no pins are bent under, (3) confirm IC is seated fully in socket.
 
so is it safe for me to just rotate the PIC around just to check if that works??because i don't really know where each RJ11 wire should connect to the PIC this is the only way I could check the orientation of the list...
 
No! Alec means check the orientation first.... Is it possible to disconnect the two top LED's while programming? They may be affecting the programming stage.
 
i tried programming it without the LEDs connected all together and it makes no difference. To be honest i noticed that initially when plugged in all the LEDs are lit and once a connection has been established the 2 1st LEDs turn off and play around randomly every time a procedure is in place.
 
Have the LED's got resistors with them?

I'm trying to eliminate the possibility of the LED's damaging the port.
 
so is it safe for me to just rotate the PIC around just to check if that works?
No. Pin 1 of the IC is identified by a small circular dent in the top of the IC. The pins are numbered counter-clockwise. The circuit board or socket should have some marking to indicate where pin 1 should be placed.
i don't really know where each RJ11 wire should connect to the PIC
We can't see any wires from here!
orientation of the list.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…