• AVR Freaks

Hot!PIC18F2221 troubles (noob)

Author
jan.catrysse@gmail.com
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2021/01/23 10:23:04
  • Location: 0
  • Status: offline
2021/01/26 12:37:09 (permalink)
0

PIC18F2221 troubles (noob)

Hello,

I have some complete noob questions about copying a PIC18F2221 chip. The copy only seems to work "half". Let me explain.

I use a vaccum packaging machine, and I blew up the PCB. The PCB has a PIC18F2221 microcontroller, some push-buttons, two 8 segment displays (8.8.) and a microswitch input.

I managed to repair the PCB (buck converter and a darlington array) and as a precaution I've read the PIC with my MNT5000 eeprom programmer and copied the image to a new PIC.
I took a screenshot of the fuses and wrote them to the new chip. I verified both.

Now it seems the part of the program when the microswitch input is "closed" seems to work, but the part when the microswitch is "open" does not.

It looks like the PIC is only receiving the "input close" signal and not the "input open" signal. Likewise with the output signals for the relays, they don't "click". The display and the pushbuttons work fine.

How can it be the program is only doing half of the business? Is this a "fuse" setting I am missing? Is this my TNM5000 programmer not doing the business?

The original PIC works fine. I would like to have a copy for the day everything fails.

I ordered a PicKit 4 to do some testing but it hasn't arrived yet.

Thank you for any advice.
Jan
#1

14 Replies Related Threads

    ric
    Super Member
    • Total Posts : 29870
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC18F2221 troubles (noob) 2021/01/26 20:40:15 (permalink)
    +4 (4)
    We can only guess with that information, but the most likely culprit is the programmer.
    When the PK4 arrives, try doing a read on the good chip, and verify on the bad chip.
     
    Be very aware, the PK4 has a design problem with these old PICs.
    You must either:
    [1] Put a 100R resistor in series with the MCLR/VPP connection betwen the PK4 and your PIC, or
    [2] Install this modification to the PK4 https://ww1.microchip.com/downloads/en/DeviceDoc/ETN37_MPLAB-PICkit4_overshoot_modification.pdf
     
    If you do neither, you could destroy your PIC!
     
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    jan.catrysse@gmail.com
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2021/01/23 10:23:04
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/01/27 06:38:48 (permalink)
    0
    Thank you for the tip!
    I will try this as soon as the PK4 arrives.
     
    I will take care not to blow up my PIC, good thing you told me!
    #3
    Jerry Messina
    Super Member
    • Total Posts : 666
    • Reward points : 0
    • Joined: 2003/11/07 12:35:12
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/01/27 07:18:18 (permalink)
    +2 (2)
    Be very aware, the PK4 has a design problem with these old PICs

    Supposedly this has been fixed in the latest PK4 (hdw rev R2), so be sure to check.
     
    The rev is marked on the back of the PK4, and you can also tell by the serial number.
    If it starts with BUR20xxxxxxx it should be ok.
     
    #4
    jan.catrysse@gmail.com
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2021/01/23 10:23:04
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/01/28 03:01:59 (permalink)
    0
    It is the new version, great.
     
    I will be using the available ZIF socket (AC162049) to read / program the chip. Do I still need to add a 50Ohm resistor between VDD and MCLR?
    #5
    jan.catrysse@gmail.com
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2021/01/23 10:23:04
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/01/28 12:48:10 (permalink)
    0
    I received the PK4, and I've read the non-functional chip to a hex file.
     
    When I compare the new HEX file with the original (converted to HEX) BIN from my other EEPROM programmer (TNM5000) the files seem different. I decompiled both files, and they look very similar but not the same.
     
    So I will try re-reading the good chip with the PK4. But that will be for another day, I will have to deassemble the PCB back again first from the machine and fiddle around with some microclips.
     
    I will post an update when I have managed to do so.
     
    Regards.
     
    #6
    jan.catrysse@gmail.com
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2021/01/23 10:23:04
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/02/22 13:25:38 (permalink)
    0
    I succeeded in reading and verifying the original chip, and it seems only three bytes were different. I think it has something to do with the chip settings memory, the oscillator setting was wrong on first sight.
    #7
    ric
    Super Member
    • Total Posts : 29870
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC18F2221 troubles (noob) 2021/02/22 13:50:01 (permalink)
    +2 (2)
    Which three bytes?
    What are the good and bad values?

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    jan.catrysse@gmail.com
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2021/01/23 10:23:04
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/02/24 12:05:41 (permalink)
    0
    Hello, I cannot add files I see... Maybe this info will help:
    1. Address 00 30 00 01 | GOOD = 08 | BAD = 07
    2. Address 00 F0 00 20 | GOOD = 0F | BAD = 10
    3. Address 00 F0 00 24 | GOOD = 2D | BAD = 0F
    #9
    ric
    Super Member
    • Total Posts : 29870
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC18F2221 troubles (noob) 2021/02/24 12:19:18 (permalink)
    +1 (1)
    jan.catrysse@gmail.com
    Hello, I cannot add files I see.

    You can, but not in the "Quick Reply:" window.
    You have to use "Open Full Version" link to get to the Full Edit window.

    .. Maybe this info will help:

    Thanks, will check into that later.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #10
    jan.catrysse@gmail.com
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2021/01/23 10:23:04
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/02/24 12:37:39 (permalink)
    #11
    Jerry Messina
    Super Member
    • Total Posts : 666
    • Reward points : 0
    • Joined: 2003/11/07 12:35:12
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/02/24 12:58:18 (permalink)
    0
    The F000xx addresses are the device EEPROM contents.
    The 300001 is CONFIG1H, so the FOSC settings are different
    #12
    jan.catrysse@gmail.com
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2021/01/23 10:23:04
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/02/24 13:05:48 (permalink)
    0
    Great, thank you!
    #13
    blue_led
    New Users
    • Total Posts : 89
    • Reward points : 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/02/24 13:29:59 (permalink)
    +1 (1)
    jan.catrysse@gmail.com
    Hello, I cannot add files I see... Maybe this info will help:
    1. Address 00 30 00 01 | GOOD = 08 | BAD = 07


    Oscilator selection
    7 = RCIO.   ; External RC . Port A6
    8 = INTIO2  ; Internal , RA6 ,RA7
     
    Just only these make huge change of behaviour
    post edited by blue_led - 2021/02/24 13:35:56
    #14
    Murton Pike Systems
    Super Member
    • Total Posts : 223
    • Reward points : 0
    • Joined: 2020/09/10 02:13:01
    • Location: 0
    • Status: offline
    Re: PIC18F2221 troubles (noob) 2021/02/24 14:55:36 (permalink)
    +1 (1)
    Your lucky the PIC wasnt code protected !
     
    #15
    Jump to:
    © 2021 APG vNext Commercial Version 4.5