PDA

View Full Version : Need help / verification error and invalid target id warning PIC16F877



makris
- 9th January 2013, 11:20
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

HenrikOlsson
- 9th January 2013, 11:40
Hi,
Have you selected the correct target device in the MPLAB IDE?
6809

If you have then it sounds to me like a problem with the communications between the device and the ICD2. But I don't have any experience with the ICD2 debugger/programmer...

/Henrik.

makris
- 10th January 2013, 13:14
yes it is the right device.
If thats the case,then what are possibilities that can make that go wrong?What do i need to do?

HenrikOlsson
- 10th January 2013, 13:48
Possible causes....
Faulty ICD2
Faulty or wrong cable between target board and ICD2
Problem with the powersupply on the target board
Target board contains circuitry that prevents the ICD2 from functioning:

6810

Make sure you read and understand the section in the ICD2 manual that covers the hardware connections. There's also a complete chapter on troubleshooting which I suggest you read.

Apart from that I'm afraid I can't help much since I don't have an ICD2 myself. Since you have a supervisor perhaps you could consult him/her.

/Henrik.