PICKit2 Device File, add PIC12F1572

Page: 12 > Showing page 1 of 2
Author
ee_martin
Starting Member
  • Total Posts : 56
  • Reward points : 0
  • Joined: 2007/10/18 13:20:44
  • Location: 0
  • Status: offline
2014/08/11 09:50:36 (permalink)
0

PICKit2 Device File, add PIC12F1572

Folks,
I have been trying to add the PIC12F1572 to version 1.63.146 of the PICKit2 Device File using the PICKit2 Device File Editor (thanks to whoever wrote that!).  I have used several similar PICs as models, and I thought I was doing OK.  However, when I try to actually program the part I get "Selected device not detected".
The Memory Programming Specification for the PIC12F1572 says its DeviceID is 0x3050, and that the Revision ID is in a separate register.  I've tried 0x3050 so I have "DeviceID 0x00003050 (12368))" in the device file editor, and I've tried a few random variants on that, but nothing works.
The PIC is getting power, and the ICSPDAT and ICSPCKL lines toggle fine.  It passes the MCLR_BAR test, saying that it gets 8.4V, but I have to say that it looks more like 6V on the scope.
Can anyone give me some clues as to what's going wrong?
Martin
 
****
I've cracked it, I think.  The Device ID for the PIC12F1572 is 0x3040, not 0x3050 as in the Memory Programming Specification.  I discovered this by using the command line version of the PicKit2, pk2cmd, to read the Device ID from the chip.  I have tried to upload the method but this system won't take it.  Maybe it won't take this ...
Anyway, I have successfully programmed two PIC12F1572 chips using a PicKit2 with a Device File modified to include that device with an ID of 0x3040.
 
post edited by ee_martin - 2014/08/12 10:28:43
#1

33 Replies Related Threads

    Ken_Pergola
    Super Member
    • Total Posts : 2127
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/13 13:42:18 (permalink)
    4 (1)
     
    Hello Martin,
     
    I was not able to corroborate your findings with regard to the Device ID of the PIC12F1572 part.
     
    I did some research and found:
     
    1) The actual PIC12F1572 silicon in front of me emits a Device ID of 0x3050.
    2) The Programming Specification correctly lists the Device ID of 0x3050.
     
    Please double-check what you are seeing for the Device ID with an oscilloscope as I did.
    That is the best way to see exactly what the silicon emits.
     
    I hope this helps.
     
    Best regards,
     
    Ken
     
     
     
    #2
    scasis
    Super Member
    • Total Posts : 121
    • Reward points : 0
    • Joined: 2011/01/07 01:18:59
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/14 06:05:04 (permalink)
    4.5 (2)
    Hi,
    PIC12F1571, PIC12F1572 (and many other Enhanced Midrange part) have two separate 14 bit locations one for device ID (at 0x8006) and one for Revision (at 0x8005). Even the PICkit2 V 2.61 program has to be modified to handle the revision correctly.
    If handling the device ID only: In the Pk2DeviceFile.dat a new family has to be used. The device ID mask for this family has to be changed to 0x3FFF.
    #3
    ee_martin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2007/10/18 13:20:44
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/14 14:06:04 (permalink)
    0
    Folks,
     
    I stand by what I said.  However, if you were to tell me that Farnell has sold me a fake chip, or something, I couldn't argue.  All I can say is that the two devices in front of me behave as I have said.  And I do know the difference between the ID number and the revision number.
     
    I used pk2cmd to find the ID number, and I'd tell you how I did it but the system here won't allow me to type in the command!!  maybe I can walk round the problem ...
     
    To find the ID number I downloaded the latest verison of pk2cmd, and made sure it was using my version of the Device File that I had modified to include the PIC12F1572 (with the ID of 0x3050, as recommended by MPS).
     
    I then gave the  pk2cmd  command with arguments PPIC12F1572 and Gi and I.  The response I got was:

    Read successfully.
    ID Memory
    3FFF  3FFF  3FFF  3FFF
    Device ID = 3040
    Revision  = 0010
    Device Name = <unknown device>

    Note the Device ID as 0x3040!  I then went back the Device File Editor, changed the Device ID for the PIC12F1572 to 0x3040, and used the PicKit2 to successfully program the device with a "Hello World"-type program that just toggled the value on a single pin.  That worked, and at the frequency expected.

    I am not enough of an expert to be able to tell you what is going on, only that pk2cmd reports 0x3040, and that I can successfully program the device using 0x3040.  More than that I cannot say.
     
    Martin
     
    #4
    ric
    Super Member
    • Total Posts : 22101
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/14 15:40:45 (permalink)
    4 (2)
    That is because your device file is using a "device ID mask' which is masking away the bottom 5 bits.
    So, the Device ID word contains 3050, but it is taking away bits 0 to 5, and reporting "Revision = 10", leaving 3040 as the device ID.
    The correct way to handle this is as scasis said above:

    If handling the device ID only: In the Pk2DeviceFile.dat a new family has to be used. The device ID mask for this family has to be changed to 0x3FFF.


    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!
    #5
    ee_martin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2007/10/18 13:20:44
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/15 10:34:27 (permalink)
    0
    Oh this is scary stuff, and shows that you shouldn't mess about with things you don't really understand, particularly when you can't get good documentation.
     
    I see what you are saying.  All the other devices I found had the Device ID and the revision number in the same word, with the bottom five bits the latter.  The PIC12F1572 has them in separate words.  I didn't know what the "family" thing was, so I just didn't mess about with it.
     
    So I should make a new family, which would have to be number 21, as 20 is the biggest in my current Device File, and I should do that by copying all the content from a similar family, perhaps number 14, Midrange/1.8V Min, which is the one I used before, into a new family.  The only things I should then modify would be the family name, perhaps to "Midrange/Enhanced", the number, to 21, and the Device ID mask to 0x00003FFF.  I should then go back to my PIC12F1572 part, make its family 21, and its ID 0x3050.
     
    How am I doing??
     
    Martin
    #6
    scasis
    Super Member
    • Total Posts : 121
    • Reward points : 0
    • Joined: 2011/01/07 01:18:59
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/15 23:51:11 (permalink)
    4.5 (2)
    Yes. If You use Pk2 Device File Editor use the 'duplicate family' pop up menu item. Modify the name and the number of the new family. Save the file to a new file. Load the new file into the editor. Modify Device Id mask to 0x3FFF. Locate PIC12F1572 part and change its family number. Double check the settings of the original and new family. Save the file again.
    There is a bug in the Pk2 Device File Editor. When duplicating families, parts or scripts. The array object duplicated by reference only. If you modify an array object (a script, a config mask setting,...) just after the duplication the original one is affected too. The best way to overcome this bug, to save and reload the file before any array object is modified.
    #7
    ee_martin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2007/10/18 13:20:44
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/17 13:10:41 (permalink)
    5 (1)
    Thanks for the information.  I, of course, blundered on and tried to do the duplication, myself, before you wrote what you did, and so didn't do the Save-and-reload bit.  I have to say that I *appear* to have got off with it - the one I duplicated doesn't seem to have changed.  However, I will check that again very carefully.
     
    If I wanted to read the Device revision number, how would I do that?  There seems to be an assumption that the ID will be at address 0x8006, in that I don't see that address specified in either the family data or the part data, and the revision number is nearly always in the lower five bits of that word.  However, now that in the PIC12F1572 the User ID and revision number are in separate words, how does the system know where the revision number is?
     
    Martin
    #8
    ric
    Super Member
    • Total Posts : 22101
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/17 13:36:36 (permalink)
    4 (1)
    I don't think you can. Remember you are modifying a system that came out well before they started putting the revision number in to a separate location.

    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!
    #9
    scasis
    Super Member
    • Total Posts : 121
    • Reward points : 0
    • Joined: 2011/01/07 01:18:59
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/18 00:18:57 (permalink)
    4.33 (3)
    You have a chance:
    - Make a backup of Pk2Devicefile.dat.
    - Duplicate the Midrange 1.8V family. Save the file.
    - Read the file again. Locate the ReadDeviceIdScript: Script No. 3. Duplicate the script. Save the file.
    - Read the file again. Locate the ReadDeviceIdScript at the and of "scipts" section of tree view. Change its script number to one greater then the previous script's number, modify the name of script as well. Save the file again.
    - Read the file again. Locate the new script at the and of "scipts" section of tree view.
    - Change it to this script:
    0xAAEE (43758) WriteBitsLit
    0xBB06 (47878)
    0xBB00 (47872)
    0xAAF2 (43762) WriteByteLit
    0xBB00 (47872)
    0xAAF2 (43762) WriteByteLit
    0xBB00 (47872)
    0xAAEE (43758) WriteBitsLit
    0xBB06 (47878)
    0xBB06 (47878)
    0xAAE9 (43753) Loop to [7] more 5 time(s)
    0xBB03 (47875)
    0xBB05 (47877)
    0xAAEE (43758) WriteBitsLit
    0xBB06 (47878)
    0xBB04 (47876)
    0xAAF0 (43760) ReadByteBuf
    0xAAF0 (43760) ReadByteBuf
    0xAAEE (43758) WriteBitsLit
    0xBB06 (47878)
    0xBB00 (47872)
    0xAAF2 (43762) WriteByteLit
    0xBB00 (47872)
    0xAAF2 (43762) WriteByteLit
    0xBB00 (47872)
    0xAAEE (43758) WriteBitsLit
    0xBB06 (47878)
    0xBB06 (47878)
    0xAAE9 (43753) Loop to [25] more 4 time(s)
    0x0003 (3)
    0x0004 (4)
    0xAAEE (43758) WriteBitsLit
    0xBB06 (47878)
    0xBB04 (47876)
    0xAAF0 (43760) ReadByteBuf
    0xAAF0 (43760) ReadByteBuf
    - Change the ReadDeviceIdScript number of new family to the number of new script.
    - Save the file.
    - Replace the Pk2Devicefile.dat with the new file in PICkit2 directory.
    - Restart the progra.
    Good luck.
    #10
    ee_martin
    Starting Member
    • Total Posts : 56
    • Reward points : 0
    • Joined: 2007/10/18 13:20:44
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/18 04:52:39 (permalink)
    5 (1)
    Scasis,
    Thanks for that.  I have made the mods suggested and now I can use pk2cmd to find the device ID (0x3050) and the revision number (0xC000).  I don't see how to ask the usual PicKit2 interface to give me this information.
     
    The PicKit2 now programs the device successfully, with an ID of 0x3050, as you said it would.
     
    It was all blind faith, though!  Is there some documentation that might help me understand where all these numbers you produced come from??
     
    Martin
    #11
    scasis
    Super Member
    • Total Posts : 121
    • Reward points : 0
    • Joined: 2011/01/07 01:18:59
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/08/23 11:27:42 (permalink)
    5 (1)
    Hi,
    in the source package of PICkit2 (PICkit2_PCAppSource_V2_61.zip) there is a description in the file PICkit2SourceGuidePCv2-61FWv2-32.pdf
    #12
    slcasner
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2014/09/28 11:27:38
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2014/09/28 11:31:19 (permalink)
    0
    ee_martin, can you make your resulting file(s) available somewhere so others don't have to repeat these steps?
    #13
    JKPDC
    Starting Member
    • Total Posts : 37
    • Reward points : 0
    • Joined: 2011/01/17 12:10:44
    • Location: Rochester, MN USA
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2015/07/07 10:06:30 (permalink)
    0
    Thanks for the tips on programming these. I'm using a PIC12LF1571 and this was the only helpful information that I could find on getting it done. I'm using the iCP02-V1.0 programmer and even after implementing the changes it still would not identify a part or program it. I finally, as a last ditch effort, changed the small switch on the end of the programmer from 5.0V to 3.3V and if finally worked. Should have caught that earlier but I've never needed to switch it to the lower voltage for the other parts I've used. So, if anyone else out there cannot get it to work, remember to use the low voltage programming option on your programmer. Works like a charm, thanks again for your help!
    #14
    mario_chus
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2016/12/12 20:07:47
    • Location: El Salvador
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2016/12/29 08:11:26 (permalink)
    3 (1)
    Hi Folks,
     
    Thanks for the tips to add new PICs to PICKit2 software.
     
    I have been trying to add the PIC16F18345 to version 1.63.146 of the PICKit2 Device File using the PICKit2 Device File Editor. I have followed the step by step instructions given in this forum, specially the instruction provided by Scasis.
     
    I already download the Datasheet, programming specification of this pic. I have also downloaded PICkit2SourceGuidePCv2-61FWv2-32.pdf and I have especially read the subject: 5.0 PROGRAMMER FIRMWARE.
     
    However, it does not mean that I understand all the technical details involved.
     
    Anyway, when I run the PICKit2 program the PIC16F18345 is recognized, but when I try to read it or write it the program throws an exception: “Divide By Zero Exception”
     
    Can anyone give me some clues as to what's going wrong?
     
    Best regards,
    Mario
    #15
    scasis
    Super Member
    • Total Posts : 121
    • Reward points : 0
    • Joined: 2011/01/07 01:18:59
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2016/12/29 10:07:47 (permalink)
    3.5 (2)
    Hi,
    PIC16F188xx have a new programming method based on an SPI like communication. See programming specifications DS40001538.
    post edited by scasis - 2016/12/29 10:11:27
    #16
    mario_chus
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2016/12/12 20:07:47
    • Location: El Salvador
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2016/12/29 12:53:44 (permalink)
    3 (1)
    Thanks for your answer Scasis!
     
    But the pic that I’m trying to add is the 16F183xx not the 16f188xx. The programing specification for these kind of PICs that I found is: 40001738B.pdf
     
    When I look at the topic: 3.0 Programming Algorithms, it’ seems to me that it's the old programing method.
     
    Thanks in advance. I’ll wait for your answer.
     
    Mario
    #17
    timijk
    Super Member
    • Total Posts : 1216
    • Reward points : 0
    • Joined: 2007/11/26 00:30:07
    • Location: Taiwan
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2016/12/31 02:15:58 (permalink)
    5 (1)
    I run the PICKit2 program the PIC16F18345 is recognized, but when I try to read it or write it the program throws an exception: “Divide By Zero Exception”

     
    Hi Mario,
    Usually it's caused by some data error, if some parameter is set to zero, when the program is calculating how many times to do a certain work by dividing some number with the parameter(zero)... then you got this exception.  Probably it's the size of the row or the size of something is wrong (set to zero).  You may double check the PIC's data in the device editor.
     
    You can also try to run the PICkit2 from the Visual Studio, the Windows Source v2.61 is at Microchip Downloads Archive (right at the bottom on that page), and see if you can find where the exception comes from.
     
    If you try to debug within Visual Studio, you can set a breakpoint at the function bool deviceWrite() in FormPICkit2.cs, so after you click the "Write" button, it will stop there.
     
    The other possible breakpoint is in the same function at "bool configInProgramSpace", it's when it starts programming configuration bits.
     
    Tim
     
     
    #18
    mario_chus
    New Member
    • Total Posts : 23
    • Reward points : 0
    • Joined: 2016/12/12 20:07:47
    • Location: El Salvador
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2016/12/31 07:01:19 (permalink)
    3 (1)
    Thanks Tim.
     
    I had already thought about doing that, but I had no idea where to start.
     
    I had already downloaded the “PICkit 2 Software for Windows Source v2.61” but no the “PICkit 2 Device Firmware Source v2.32”. I will be reading the documentation for a while.
     
    First, just as you say, I'll verify the PIC's data in the device editor.
    And then I’ll try to debug within Visual Studio.
     
    I tell you how it all comes out.
     
    Mario
    #19
    scasis
    Super Member
    • Total Posts : 121
    • Reward points : 0
    • Joined: 2011/01/07 01:18:59
    • Location: 0
    • Status: offline
    Re: PICKit2 Device File, add PIC12F1572 2016/12/31 14:25:28 (permalink)
    5 (1)
    Hi,
    having a look at the memory map of PIC16F183xx devices implementing them in PICkit2 requires to modify all scrips setting memory addresses: EEMemEraseScript, EEReadPrepScritp, ProgMemAddrSetScript. Since there is 4 configuration registers the ConfigReadScript, ConfigWriteScript have to be modified as well.
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2018 APG vNext Commercial Version 4.5