"Failed to program device" 16-bit PIC

Discussion in 'Embedded Systems and Microcontrollers' started by ESSE1, Jan 21, 2015.

  1. ESSE1

    Thread Starter New Member

    Jan 21, 2015
    2
    0
    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?
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    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?
     
  3. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    Looks like that chip actually has multiple PGC and PGD connections.
     
  4. ESSE1

    Thread Starter New Member

    Jan 21, 2015
    2
    0
    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.
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,606
    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?
     
  6. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,887
    1,015
    Is the Pic Kit connected as close as possible to the Pic or do you have something like a ribbon cable in between?
     
Loading...