• AVR Freaks

Hot!How to save a hex that came on a pre-programmed chip? Legally/Ethically *Solved*

Author
t1d
Senior Member
  • Total Posts : 138
  • Reward points : 0
  • Joined: 2015/01/26 15:49:24
  • Location: 0
  • Status: offline
2019/10/24 04:56:58 (permalink)
0

How to save a hex that came on a pre-programmed chip? Legally/Ethically *Solved*

Re: Windows 10/PICKit2 Compatible Programmer/PICKit2 GUI-v2.61/MPLab X-v5.25/XC8-v2.10
 
I assembled a PIC16F628A Frequency Counter Clone Kit from Ebay. The circuit originates from a project (with code) that is openly published on the internet.
 
Another DIY'er has written improved code for the Counter hardware. The code is free for use.
 
I want to preserve the original hex, so that I may try the new code. As far as I can tell, the chip pin-to-pin assignments for the two different kit models is 100* the same. However, my kit has slightly different hardware than that of the improved version, therefore I want to be cautious.
 
I do not have evil designs. I will simply be flashing the new hex. I will not be trying to open the original hex, or the updated version, to read the code. I will not be duplicating the original hex, or distributing it in any way.
 
I would think that I have the right to save the original hex, via fair use of a purchased product. I am asking, here, to make sure that I am not breaking any rules. And, to get instructions on how to save the original hex.
 
I do not have extensive computer, or programming, skills. So, please include lots of details as to how to accomplish this.
 
Thank you so much, for your help.
post edited by t1d - 2019/10/24 12:30:10
#1

18 Replies Related Threads

    bitdoctor
    Starting Member
    • Total Posts : 26
    • Reward points : 0
    • Joined: 2019/10/11 06:10:09
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 06:31:44 (permalink)
    +2 (2)
    You're also going to have to learn how to program a chip anyway, in order to install the new software. So why not buy a $1.50 part and learn that first? When you get through that, it will probably be easier for you to figure out how to perform a read. You will likely be using the same application to read and write the chip.
     
    It would be safer for you, because if you screw up the read/write, you might lose the original firmware that you are worried about.
     
    Programming software is available from Microchip, and is fully documented.
    post edited by bitdoctor - 2019/10/24 06:37:51
    #2
    NorthGuy
    Super Member
    • Total Posts : 5799
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 06:51:01 (permalink)
    +1 (1)
    If the project is published, there's no reason to save the HEX file - just get it from the Internet.
     
    Otherwise, you can read it from the cheap, but only if the chip is not protected.
     
    Or spend some time learning how to program chips, write few programs, and half a year from now you'll have a good laugh remembering how you wanted to preserve the HEX file for the frequency counter.
    #3
    pcbbc
    Super Member
    • Total Posts : 1381
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 07:17:08 (permalink)
    +3 (3)
    If it's code protected, remove/de-solder the part from the board.  Keep it as you back up.  Replace with a new part and program to your hearts content.  PIC16 chips are cheap as chips, so really no reason not to do that.
    #4
    t1d
    Senior Member
    • Total Posts : 138
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 09:47:59 (permalink)
    0
    pcbbc
    If it's code protected, remove/de-solder the part from the board.  Keep it as you back up.  Replace with a new part and program to your hearts content.  PIC16 chips are cheap as chips, so really no reason not to do that.


    This is a good suggestion. The chip is in a socket. But, I will have to wait until my next Mouser order.
     
    I do have the programmer and I know how to use it. And, I have all the writing tools. See the listing first thing in my opening post.
     
    I am learning to code in C. I am just a super-novice. Flashing a chip with a ready-made hex is no problem. But, anything beyond that is out of my meager knowledge base.
     
    Learning how to copy the hex with the PICKit2 GUI is worth the effort and I am curious. So, if it is not write protected, how do I copy it?
     
    Thanks to all, for your help.
    #5
    NKurzman
    A Guy on the Net
    • Total Posts : 18027
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 10:20:15 (permalink)
    +1 (1)
    You are not saying what your "writing tools" are.  But there should be an option to "Read Device".  And then you would save or export to a file.  Usually "Intel Hex" if it asks.
    #6
    Mysil
    Super Member
    • Total Posts : 3464
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 10:24:43 (permalink)
    +1 (1)
    Hi,
    In MPLAB X, there is a Icon in the toolbar line with a Big GREEN UP Arrow pointing from the device package. 
    You create a new, empty MPLAB X project, selecting the correct device type, 
    and programmer tool you are using. Connect the programmer tool, and push the Icon.
    There may be some trickery needed to export/store the image hexfile.
     
        Mysil
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 18027
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 11:10:11 (permalink)
    +1 (1)
    Mysil
    Hi,
    In MPLAB X, there is a Icon in the toolbar line with a Big GREEN UP Arrow pointing from the device package. 
    You create a new, empty MPLAB X project, selecting the correct device type, 
    and programmer tool you are using. Connect the programmer tool, and push the Icon.
    There may be some trickery needed to export/store the image hexfile.
     
        Mysil



    "/PICKit2 Compatible Programmer/PICKit2 GUI-v2.61/"
    I do not know the details for PICKit2 GUI.
    And MPLabX does not support the PICKit2.  
     
     
     
    #8
    t1d
    Senior Member
    • Total Posts : 138
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 11:28:40 (permalink)
    0
    NKurzmanAnd MPLabX does not support the PICKit2.

    See attachment...
     

    Attached Image(s)

    #9
    t1d
    Senior Member
    • Total Posts : 138
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 11:42:49 (permalink)
    0
    https://www.edaboard.com/...one-PIC-to-another-PIC
    1) "First confirm the chip is open to be explored. Further comes all your questions."
    2) "in Pickit2 its easy you need to read the device and go to file and click on export hex ."
     
    Okay, with your clues, I think I am making progress. I see in PICKit2 how to make the copy and export it. But, how do I do Step #1; confirm the chip is open to be explored? Try to copy it and if that fails, I'll know?
     
    Thanks again!
     
    #10
    NKurzman
    A Guy on the Net
    • Total Posts : 18027
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 11:50:52 (permalink)
    0
    t1dunn
    NKurzmanAnd MPLabX does not support the PICKit2.

    See attachment...

     
    I stand Corrected, I never Clicked that.  Thank for the Correction.
    That being the case IPE maybe easier to use than MPLabX.
    But I assume his GUI would work too,
     
    #11
    t1d
    Senior Member
    • Total Posts : 138
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 12:15:18 (permalink)
    0
    No worries, NK...
     
    I used the no-guts-no-glory method and read the chip with PICKit2. It said it is code protected, but I continued to copy and save the file.
     
    I think that may have worked... It saved a hex file, being 13KB in size...
     
    Is there anyway I can verify that the hex file will work, short of flashing over the existing hex? Well, I could wait until I get another chip, flash that with the hex copy, plug it in and see if it works, of course...
     
    EDIT: I tried reading the chip again. It says that both the read and verify are successful. It also says that it is protected and the binary(?) lines all stay "0000." So, my hex copy is probably empty, correct?
    post edited by t1d - 2019/10/24 12:24:01
    #12
    ric
    Super Member
    • Total Posts : 24540
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 12:18:46 (permalink)
    +2 (2)
    Look inside the hex file, and see if it's all zeroes or FFs.
    Code protection doesn't stop the chip being read, it just mangles the data that is read.
    You could import the hex file into MPLAB, and see if the disassembly listing matches what was published for the project.
     

    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!
    #13
    t1d
    Senior Member
    • Total Posts : 138
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 12:26:10 (permalink)
    0
    ricLook inside the hex file, and see if it's all zeroes or FFs.
    Code protection doesn't stop the chip being read, it just mangles the data that is read.
    You could import the hex file into MPLAB, and see if the disassembly listing matches what was published for the project.
    Ahh, Ric! So glad you joined in... Yes, it reads all zeros, so no joy, I am sure... Thanks for the good information...


    Okay, let's call this solved. I will get another chip and try the new code with it. Thanks to everyone!
    post edited by t1d - 2019/10/24 12:28:06
    #14
    ric
    Super Member
    • Total Posts : 24540
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 12:30:02 (permalink)
    +1 (1)
    It seems strange that the chip is code protected if it's a published project.
    You can get that message if the programmer isn't talking to the chip at all. I don't know if the program you are using checks the device ID to see if it is talking to the chip correctly.

    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!
    #15
    t1d
    Senior Member
    • Total Posts : 138
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 12:36:09 (permalink)
    0
    ric
    It seems strange that the chip is code protected if it's a published project.
    The device manufacturer took the author's open code and is using it on the hardware he designed and openly published, too. So, you can't say they stole it, but it doesn't seem write that they are protecting it either.
    ric
    You can get that message if the programmer isn't talking to the chip at all. I don't know if the program you are using checks the device ID to see if it is talking to the chip correctly.

    I am using PICKit2 and it verifies the chip and that it is communicating. I did remember to turn on the USB chip power.
    #16
    t1d
    Senior Member
    • Total Posts : 138
    • Reward points : 0
    • Joined: 2015/01/26 15:49:24
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 12:37:11 (permalink)
    +1 (1)
    P.S. There is not a bomb feature that kills the hex, if I try to copy it, is there?
    #17
    pcbbc
    Super Member
    • Total Posts : 1381
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 14:05:22 (permalink)
    +2 (2)
    t1dunn
    P.S. There is not a bomb feature that kills the hex, if I try to copy it, is there?

    No.
    #18
    bitdoctor
    Starting Member
    • Total Posts : 26
    • Reward points : 0
    • Joined: 2019/10/11 06:10:09
    • Location: 0
    • Status: offline
    Re: How to save a hex that came on a pre-programmed chip? Legally/Ethically 2019/10/24 21:08:18 (permalink)
    0
    The software image (firmware) in a chip isn't hex, it's binary. Calling it hex is just confusing, and you will almost never hear it referred to in that way. So you can't "save the original hex" because the hex only exists in a file on the developer's system, but you can "write the hex" because the latter is in a file on your system.
    post edited by bitdoctor - 2019/10/24 21:09:37
    #19
    Jump to:
    © 2019 APG vNext Commercial Version 4.5