[SOLVED] Error programming PIC

Discussion in 'Embedded Systems and Microcontrollers' started by KansaiRobot, Apr 13, 2015.

  1. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    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.
     
  2. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    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.
     
  3. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    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.
     
  4. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    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.

    This is the circuit you need to use. Please check that you have the pins connected correctly:

    [​IMG]

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

    Here is the pinout of the PICkit:

    [​IMG]


    It appears that the PICkit is not seeing your PIC:

    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?
     
    KansaiRobot likes this.
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    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.
     
    DerStrom8 likes this.
  6. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    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.
     
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    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.
     
    KansaiRobot likes this.
  8. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    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: Apr 15, 2015
    DerStrom8 likes this.
  9. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    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.
     
  10. KansaiRobot

    Thread Starter Active Member

    Jan 15, 2010
    318
    5
    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
     
Loading...