Help requested please - Pickit2 CLI problems


+ Reply to Thread
Results 1 to 15 of 15
  1. #1
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Help requested please - Pickit2 CLI problems

    Hi all
    I have been using the pickit2 for over a year now - no problems at all.
    On a recent project though, using two boards hooked up via serial comms - one with 16F886 and the other with 16F917 - I came across a potentially damaging issue -

    When I change the program in development, often it is changes to both units, so each is then hooked up to icsp and programmed.

    I accidentally clciked compile and program on the wrong code, the 917 code - when actaully connected to the 886 - and the damn thing wrote the 917 code to the 886 !!! - as you can imagine, this causes rather a lot of 'issues'

    I am using the CLI version of the pickit programmer -
    Any ideas please - I do not want to use the gui as the cli is so easy to use, but this situation is potentially damaging.

    My command line in PDS is : pk2cmd -PPIC$target-device$ -F$hex-filename$ -E -M -J -H4 -R

    If I replace PPIC$target-device$ with -P it autodetects, but still writes the wrong code. ??

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster bill9399's Avatar
    Join Date
    Aug 2004
    Posts
    1,702
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    1.29 GB

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    http://www.microchip.com/stellent/id...irects=pickit2

    Listed below 'what's new' header

    PK2CMDv1.20

    look for command line section in this document



    -I shows device name
    The -I command now displays the device name associated with the read
    Device ID, and warns if it is different from the selected device.

    Might help. Might not.
    A wise man may listen and say nothing. A fool may listen and have nothing to say. Which one are you???

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Quote Originally Posted by bill9399 View Post
    http://www.microchip.com/stellent/id...irects=pickit2

    Listed below 'what's new' header

    PK2CMDv1.20

    look for command line section in this document



    -I shows device name
    The -I command now displays the device name associated with the read
    Device ID, and warns if it is different from the selected device.

    Might help. Might not.
    Many thanks Bill, I have the document and perused it, but had not noticed that switch.
    It actually does what it says, - it 'warns' - unfortunately though - at the END of programming. - ie, it goes ahead and programs then says, oh, btw, there as a device difference....

    Thanks for looking though
    Joe.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    pverburg
    Guest pverburg's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Hi Joe,
    you could add a test cmd like
    PK2cmd.exe -I
    pause
    pk2cmd -PPIC$target-device$ -F$hex-filename$ -E -M -J -H4 -R

    Then you could ctrl-x out of the batch file or maybe you could check for the error code after the first line I can't test that here as I don't have a Pkit2.
    I know its a work around but will save you some problems.
    Paul V.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Quote Originally Posted by pverburg View Post
    Hi Joe,
    you could add a test cmd like
    PK2cmd.exe -I
    pause
    pk2cmd -PPIC$target-device$ -F$hex-filename$ -E -M -J -H4 -R

    Then you could ctrl-x out of the batch file or maybe you could check for the error code after the first line I can't test that here as I don't have a Pkit2.
    I know its a work around but will save you some problems.
    Paul V.
    Hello Paul, thankyou ever so much for the response.
    There are a few issues though - maybe you can advise ?

    Firstly, I have no control (that I am aware of) over the way the IDE passes the programmer details and switches via the CLI to the pickit2.
    Only in the view - compile and programmer options - programmer - settings. ?
    If one uses 'pause' it is not passed, I tried creating a bat file - but that did not work also.

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    pverburg
    Guest pverburg's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Hi Joe,

    replace pk2cmd.exe with batchfile.bat leave the rest as it was.

    try this batch file:
    PK2cmd.exe -I
    pause
    rem pk2cmd -PPIC$target-device$ -F$hex-filename$ -E -M -J -H4 -R
    pk2cmd %2 %3 %4 %5 %6 %7 %8 %9
    echo %2
    echo %3
    echo %4
    echo %5
    echo %6
    echo %7
    echo %8
    echo %9
    pause
    *************************

    Should give you the idea how to work this.
    Last edited by pverburg; 4th December 2011 at 17:53.

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Hiya Paul

    One problem is that the -I only works with a "target device" passed -

    I get the following with your code -

    c:\program files (x86)\microchip\pk2cmdv1-20>PK2cmd.exe -I

    -P need specifying
    (If we use -P though Paul, it simply auto detects, (hence doesnt know there is a difference!) I tired to pass the -PPIC$target-device$ but that is unrecognised -



    c:\program files (x86)\microchip\pk2cmdv1-20>pause
    Press any key to continue . . .

    c:\program files (x86)\microchip\pk2cmdv1-20>rem pk2cmd -PPIC$target-device$ -F$
    hex-filename$ -E -M -J -H4 -R

    c:\program files (x86)\microchip\pk2cmdv1-20>pk2cmd -FC:\Users\Mary\PDS\ST9319~1
    .HEX -E -M -J -H4 -R
    -P is a required option



    c:\program files (x86)\microchip\pk2cmdv1-20>echo -FC:\Users\Mary\PDS\ST9319~1.H
    EX
    -FC:\Users\Mary\PDS\ST9319~1.HEX

    c:\program files (x86)\microchip\pk2cmdv1-20>echo -E
    -E

    c:\program files (x86)\microchip\pk2cmdv1-20>echo -M
    -M

    c:\program files (x86)\microchip\pk2cmdv1-20>echo -J
    -J

    c:\program files (x86)\microchip\pk2cmdv1-20>echo -H4
    -H4

    c:\program files (x86)\microchip\pk2cmdv1-20>echo -R
    -R

    c:\program files (x86)\microchip\pk2cmdv1-20>echo
    ECHO is on.

    c:\program files (x86)\microchip\pk2cmdv1-20>echo
    ECHO is on.

    c:\program files (x86)\microchip\pk2cmdv1-20>pause
    Press any key to continue . . .

    If we can pass the target device parameter, I think you are onto a winner Paul !

    thankyou kindly
    Joe
    Last edited by Kapitan; 5th December 2011 at 10:08.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    pverburg
    Guest pverburg's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Ok so this should be closer:

    Each "%?" is what's passed on from the command line %1 is the batchfile name %2 in your case is -P???????? etc. etc.

    PK2cmd.exe %2 -I
    pause
    pk2cmd.exe %2 %3 %4 %5 %6 %7 %8 %9
    pause
    ***********************

    Paul V.
    Last edited by pverburg; 5th December 2011 at 17:32. Reason: %2 explanation

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Prolific Poster bill9399's Avatar
    Join Date
    Aug 2004
    Posts
    1,702
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    1.29 GB

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Keep in mind you can also use conditional statements in batch files, such as

    IF %n ==
    do something
    ELSE
    do something else
    END IF

    Note. DOS statements are not case sensitive.

    More information here

    http://www.computerhope.com/overview.htm
    A wise man may listen and say nothing. A fool may listen and have nothing to say. Which one are you???

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Thanks guys, will report back - have had lack of emptynet for the last day - but seems to be back on now - it is difficult in the middle of the Pacific (according to JTabb lol)

    Greatly appreciated !!!

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #11
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    A first solution, many thanks indeed to Paul (Pverberg) - I made a few small changes - end result -? - it WORKS!!!!

    ; Bat File -
    PK2cmd.exe %1 -I
    pause
    pk2cmd.exe %1 %2 %3 %4 %5 %6 %7 %8

    ;PDS settings -
    programmer filename = pk2cmd.bat

    Parameters = -PPIC$target-device$ -F$hex-filename$ -E -M -J -H4 -R

    It darn well works great Paul !! - you are 'da man' !!!!

    CTRL X does not work as the window is not highlighted, but it does fully warn of a clash ! - it is simple to click the 'X' - close window button -
    It would be great to add an option to NOT continue if that was possible - but I know I am asking for 'Jam' on it lol - it is super as it is .


    As an example- trying to program a 16F886 with 16F917 code produces the following in the CMD window -


    c:\program files (x86)\microchip\pk2cmdv1-20>PK2cmd.exe -PPIC16F917 -I
    Device ID = 2060
    Revision = 0002
    Device Name = PIC16F886 !WARNING! -P device mismatch

    Operation Succeeded

    c:\program files (x86)\microchip\pk2cmdv1-20>pause
    Press any key to continue . . .

    (That is using the above code)

    Again, you da man !!!

  22. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #12
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    just a point Paul, is not %1 the FIRST parameter after the BAT file name ?

    Joe.

  24. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  25. #13
    pverburg
    Guest pverburg's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Your right looking at your output I'm sure at some time you could get the bat file name maybe %0 ?
    Now that this part works have a look at %errorlevel% after the -I command line
    ie
    PK2cmd.exe %1 -I
    echo %ERRORLEVEL%
    pause
    if %ERRORLEVEL% == ????? goto display error line then end?
    You can test with an if statement and jump over the program line.

  26. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  27. #14
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Hi Paul
    many thanks again, will experiment later and report back -
    thanks to your good self and Bill we have a working solution. I will put something up on the wiki when completed with full credits to you guys.

    Joe.

  28. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  29. #15
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: Help requested please - Pickit2 CLI problems

    Hi Paul
    the error level returned on both success and failure is '00' - as it is not an error (to the pickit) it is a warning -

    is there any way we can pick out the message IF there is a warning - as in -

    "Device Name = PIC16F886 !WARNING! -P device mismatch"

    ??
    Joe.

  30. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Weak pullup on MCLR when digital input ? advice requested please.
    By Kapitan in forum Proton Plus Compiler v3
    Replies: 17
    Last Post: 26th December 2011, 07:19
  2. Pickit2 ISCP problems
    By chuckieboy in forum The Lounge
    Replies: 5
    Last Post: 29th June 2011, 18:13
  3. Replies: 19
    Last Post: 18th March 2011, 19:34
  4. More Pickit2 problems??
    By stevewidg in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 22nd June 2008, 00:37
  5. Bit more help requested with Arrays
    By johngb in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 23rd December 2004, 21:35

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts