"Failed to program device" 16-bit PIC

Thread Starter

ESSE1

Joined Jan 21, 2015
2
Hi,

I recently bought a PIC24hj128gp502 and now I try to make simple program to get started with the device.
I program and power the device with PICKIT3 but it won't work. The device is detected but cannot be programmed, it always ends with "Failed to program device". This is the output:

"
Target detected
Device ID Revision = 3004

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3ff
configuration memory

Programming...
Failed to program device "

and this is my configs:
"
#pragma config ICS = PGD3
#pragma config FWDTEN = OFF
#pragma config FNOSC = FRC "

Before this device I used 8 bit PICS and now I'm using same circuit interface between the PICKIT3 and PIC, 4.7k resistor between Vdd- and MCLRpin, all Vss-pins connected and PGD3/C3.

I dont know what is wrong but all help from you is appreciated. Do I need to change or add configuration directives?
 

spinnaker

Joined Oct 29, 2009
7,830
Are you certain the Pic is powered?
Are you certain you MCLR, PGC, PGD etc are all connected correctly?


Do you have another pic and/or programmer?
 

Thread Starter

ESSE1

Joined Jan 21, 2015
2
Yes there is 3 pgc pgd and I have tried them all. The pickits power on funktion is set and circuit interface and pin connections are correct. The device is detectable and this should isolate the problem but still can't find the solution. Maybe my programmer dont work properly, but what pins/configuration could give rise of such error message "failed to program the device"? Tomorrow I will try with a more stable power supply.
 

ErnieM

Joined Apr 24, 2011
8,415
The very same pins and signals that report "device detected" are used to program the device, so if you get the correct device report usually you are good to go.

There is a possibility of something interacting with the program pins, of too much cap on Vdd or MCLR, so a schematic sketch of all parts would help.

Otherwise, did you erase the thing before programming it?
 
Top