1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Error programming 16F628

Discussion in 'Microcontrollers' started by gregmcc, Aug 20, 2005.

  1. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    I have just build the P16PRO40 and am using WinICProg to program my
    PIC.

    I tried posting this message on the winicprog site but there seems to
    be a problem with the registration process.

    I have tried toggling the button in the hardware setting and I get the
    following:

    vpp on: MCLR = 12.85V
    clock high: PGC = 4.9V
    output high: PGD = 4.9V

    I'm using the circuit from www.olimex.com/dev/pdf/pic-pg3 b.pdf

    When I program the chip it fails on a verify. It does seem to program
    something as the first few bytes are written although incorrect values.
    I can then erase the device and reprogram it, and different bytes get
    written to the start.

    any idea where I can start looking? I've checked the supply voltage
    with a scope and its stable.
     
  2. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
    12.85V on mclr isn't enough, it should be well above 13V, 14V preferred.
     
  3. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    Are those numbers from the software or read on a multimeter?

    Make sure you are actually getting those voltages on the board...

    As the previous poster said, 12.85V might be a little low... Some PICs are less tolerant on this than others.

    Good luck.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK

    Actually the spec is 12V, although many programmers aim for 13v, which is roughly the value I like to see.

    The voltage reading 13V on a meter doesn't mean it's correct, if you're using an unregulated wallwart a meter may read 13V but the supply may have too much ripple on it, this prevents the PIC entering programming mode.

    A simple test is feed the programmer from 18V DC, using a pair of 9V batteries in series, this prevents any ripple problems.

    A more complex test is to use a scope on MCLR to check for ripple!.
     
  6. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    Hi gergmcc,

    Cannot access the link you have posted for the programmer. But I did after some editing.

    I checked the circuit diagram and it seems OK with pulling PGM pin down to 0V when you place the PIC in the programming socket.

    If you are programming the target PIC using an extension cable, please makes sure that Pin10 (PGM) of 16F628 is connected to 0V during HV programming as recommended by the Microchip programming Spec.

    Software accessing directly the parallel port under WinXp or Win2000 might require additional driver to work properly.
     
  7. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
    I wonder why so many programmers use a little more then 12V, balancing on the edge of the spec...

    I used a 7815 in my P16pro40, giving 15V for mclr !
    I haven't got any problems with that...
     
  8. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    But according to the Programming Spec of 16F628:

    Min MCLR Vpp: Vdd + 3.5V = 8.5V
    Max: 13.5V


    Agree. A bit high. :D

    Many PICs families have max. MCLR Vpp of 12.5V, (e.g. 18Fxxxx) so any voltage higher than 12.5V is out of specification. The use of 14V or higher is a carry over from past experience, I guess.
     
  9. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    According to one PIC programming software author, not to mention Microchip's datasheets, you will encounter problems with newer PICs applying 15V on MCLR. Some PICs will not enter programming mode correctly, or might do so unreliably.

    (I am still trying to find the link to back this up... more to come)
     
  10. Electrix

    Electrix Member

    Joined:
    May 2, 2005
    Messages:
    212
    Likes:
    0
    Location:
    PA, US
    I had a similar problem too with my first programmer. It turned out that the PIC was programmed half way with garbage data. What I did was I changed my Inverter IC and ... it worked !! At that time I felt either the Inverter was faulty (though I dont recall it was) or there was a timing limitation on the Inverter. I suspect your inverter has some timing problems too...asssuming everything in your circuit is correct..
     
  11. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
    I'm using 18F's with USB, there r pretty new devices and i have no problems...
    I'm not saying you're wrong, i'm just saying 15V works for me ...
     
  12. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    thanks for the all the replies.

    i've checked the mclr with a scope. its now 13v with zero ripple. the main supply is from a dc power supply. pin 10 of the chip also connected to ground.

    i haven't tried changing the inter yet though. any other tipds/tricks I can try? I'll get another inverter tomorrow and see if it makes any differnce.

    for the schematic to the circuit i used try http://www.olimex.com/dev/pic-pg3b.html

    thanks
    greg
     
  13. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
    one thing that comes to mind is, use very short and shielded cables between pc <-> programmer <-> pic...

    using unshielded/long cables makes p16pro40 fail...
     
  14. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    im using a shielded printer cable. its 1m long. is that too long?
     
  15. Exo

    Exo Active Member

    Joined:
    Sep 18, 2003
    Messages:
    1,953
    Likes:
    1
    Location:
    Belgium
    no, if it's a decent cable it should be fine

    how is the pic connected to the programmer ?
    in a socket (fine)
    or with wires ? (should be VERY short)
     
  16. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    ive built the circuit on veroboard and then used short wires to connect a socked to the board. the socket is then bounded on a plastic box.

    is there anything in particular i should be looking for - the voltages seem to measure ok. and i've checked all the wiring. it just doesnt want to program. Ive just tried another pic - same problem.
     
  17. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    The inverter has to be either 05,06 or 07 normal TTL version or LS version, others can't be use. These are open-collector inverter or buffer, don't substitute others.

    Test the programmer and programming software without a PIC. Use your scope probe on PGC and PGD, then do a read from the software. Can you see pulses on these lines?

    Does the Vpp LEDs lights up and stay ON during the read operation?

    You kept mentioning the software as WinicProg which don't exist. Did you meant WinPicProg?
     
  18. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    I've now tried another 74ls07 - same problem. I've also tried to redo all the wiring from the veroboard to the ic socket - the original wiring has been replaced with thicker wiring.

    i've also checked the supply voltage and mclr with a scope - there's no ripple.

    on the pgc and pgd lines there are pulses when i read and write to the pic. i'll check the vpp light, but i'm pretty sure it says on during the read. the weird thing is the first two bytes are always both written correctly. its just the rest of the data thats nonsense.

    sorry - the software i used is winpicprog.
     
  19. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    Try increasing the programming delay!.
     
  20. gregmcc

    gregmcc Member

    Joined:
    Aug 20, 2005
    Messages:
    303
    Likes:
    0
    Location:
    Darwen, UK
    I've tried increasing the delay to the max value - no difference. I'm starting to run out of ideas :-(
     
  21. Joel Rainville

    Joel Rainville New Member

    Joined:
    Jul 17, 2005
    Messages:
    730
    Likes:
    0
    Location:
    Montréal, Québec, Canada
    Is it programming garbage or or is it reading garbage?

    I mean, try programming a small LED blinking program on it, ignore the error reported by WinPicProg and see if the LED blinking program works.
     

Share This Page