Menu

Programming from the IDE to multiple programmers – this may be for you.

Anobium
2017-11-21
2017-11-24
1 2 > >> (Page 1 of 2)
  • Anobium

    Anobium - 2017-11-21

    Introduction

    If you have more than one programmers at attached to your computer and they are different microcontrollers then you know that you have to edit the FLASHPIC.BAT when you change programmers.

    This often happens when you need to switch between any of the following programmers:

    • PICKit2
    • PICKit3 in legacy mode
    • PICKit3 using MPLAB-IPE
    • TinyBootloader+
    • Northern Programmer
    • Xpress Board
    • And, you may have any of the other programmers

    I really do have this issue! And, I am sharing how I have automated the process so I can flash with ease.

    Overview

    When you select to compile and flash the process is automatic and if you have the microcontroller listed in the lookup files then the correct programmer with be selected, else, it will use the default programmer.

    This is a replacement FLASHPIC.BAT that uses some lookup files to select which programmer to use for a specific microcontroller.

    Details

    FLASHPIC.BAT is updated to search a set of configuration files. There is a set of tests in FLASHPIC.BAT that examine the configuration files to determine which programmer to use – if a match is found then the selected programmer will be used, otherwise mine default to a PICKit2.

    FLASHPIC.BAT

    This has been adapted to search for specific configuration files. These are stated clearly in FLASHPIC.BAT and must be in the G+STOOLS folder.

    The attached FLASHPIC.BAT supports the following but it can be extended with ease, adapt the FLASHPIC.BAT file.

    • Northern Programmer
    • Xpress Board
    • PK3 in MPLAB-IPE mode
    • PK3 in automatic load mode
    • PK3
    • TinyBootloader

    you can add your own to this - just adapt the batch file.

    CONFIGURATION FILES

    Configuration files are a simple list of microcontrollers. The configuration files are not case sensitive.

    Example: XpressLoader.ini. This is the configuration file for the Xpress loader programmer. The file called XpressLoader.ini contains the following:

    16f18855
    

    This is a single entry, but, you can have more.

    To use

    Copy the attached files to your G+STOOLS folder. Edit the configuration files and then make any adaptations to FLASHPIC.BAT for you specific installation. I have MPLAB-IPE installed and I access via a symbolic link – you may use the same.. it will save lots of time in the future.

    The configuration files map to programmers as shown in the table below:

    Configuration file Programmer
    Ns.ini Northern Programmer
    XpressLoader.ini Xpress Board
    TinyBooTLoader.ini TinyBooTLoader+
    MPIPEPK3.ini PICKit 3 in MPLAB-IPE mode
    AutoPK3.ini PICKKit3 in legacy/automatic mode
    Defaults PICKit 2

    Summary

    If you have different programmers – no need to edit the FLASHPIC.BAT… look at this as an option.

    It works for me. It saves time and the stress of making a mistake.

    Enjoy

    Anobium

     

    Last edit: Anobium 2017-11-21
  • Anobium

    Anobium - 2017-11-22

    If you find this intereting, useful or even boring... leave a message.

    Was this useful?

     
  • Moto Geek

    Moto Geek - 2017-11-23

    Evan, thanks for this, I am going to try it as I have 2 different xpress boards and a pickit 3 to program mostly a 16f1825 and 12f1840. Now starting to use the pic16f18326 also with PPS, and also just starting to use the bootloader on all three for the first time. So something like this would probably make life easier.

    I have a quick question regarding using the MPLAB IPE with GCB. My workflow is...

    fire up GCB
    fire up MPLAB IPE
    edit flashpic.bat to use the pusher
    write/edit some code
    press hex/flash button
    repeat

    Is there a way to make this happen... When I write some code for the first time and flash, everything above works great. Then I do some editing to the code hit save, keeping the same name and hit hex/flash button. IPE says code has been modified and I have to hit a button to say "yes". Unless I rename every edit, this text box comes up to say code has been modifed. And if you don't hit "yes" in a certain period of time, it just loads the program and you have to hit the "program" button in the IPE. Is there a way to have the batch file just make the IPE run and program the pic without any further interaction past hitting the hex/flash button in GCB while keeping the same name for the program? Talk about first world problems.... Jeeze, I have to hit too many buttons... my life is so hard... etc...

    Thanks again for ALL your hard work and dedication. This is not really a "problem", just an observation....

     
    • Anobium

      Anobium - 2017-11-23

      Someone is reading! Thank you for the feedback.

      Regarding IPE. You can try using the IPE command line option. Create a symbolic link to the MLAB-IPE installation and it will work via FlashPic.bat

      But, this is why I have started to use the Northern Software programmer. I am writing a review on this as the moment.

      But, this is why I want to see if we can actually sort this via a new PICKit3 command line utility... if Microchip cannot fix this... then, we can have a go. :-)

       

      Last edit: Anobium 2017-11-23
  • Moto Geek

    Moto Geek - 2017-11-23

    Just looked up the Northern Software programmer. This looks awesome! Are you actually using this now to program pics? I need to order one of these and have a play. Thanks for mentioning it!

     
    • Anobium

      Anobium - 2017-11-23

      Yes I am.

      0.4s v 13s. Northern Software v IPE.

      The GUI is not to my liking but I use from the batch file/command line. So, the GUI is not crucial.

      The programmer is a Low Voltage Programmer so you must compile with LVP set.

      I am interviewing the developer for full article on Friday.

      This is a great programmer and it is worth every penny.

       
  • William Roth

    William Roth - 2017-11-23

    You can use the MPLABX IPE command line ... or the MPLABX PK3 Command line from the FlashPic.bat. These alow for 1 click programming from the IDE. Here are the lines to use in FlashPic.bat. Make sure the path and version are correct.

    java -jar "C:\Program Files (x86)\Microchip\MPLABX\v4.05\mplab_ipe\ipecmd.jar" -TPPK3 -P%2 -M -OL
    
    Or
    
    "C:\Program Files (x86)\Microchip\MPLABX\v4.05\mplab_ipe\pk3cmd.exe" -P%2 -F%1 -M -L
    

    The command line switches are explained in the respective readme.html files in the MPLABX Docs folder. Here I have release from reset enabled with the -OL or -L Switches as I want the program to run after programming if MCLRE is enabled.

    C:\Program Files (x86)\Microchip\MPLABX\v4.05\docs\Readme for IPECMD.htm
    C:\Program Files (x86)\Microchip\MPLABX\v4.05\docs\Readme for PK3CMD.htm

     

    Last edit: William Roth 2017-11-23
  • Moto Geek

    Moto Geek - 2017-11-23

    Evan, just ordered the NSDSP-1-U board and a couple of the 5v and 3.3v dip 16f1454 chips to play with. I'm going to try and make an "arduino style" board using a 16f18326 or 46 as a development platform, similar to the xpress board, but with dip versions of the micro. This combined with GCB IDE and no more pickit 3 will make it very easy for anyone to play with.

    William, I'm going to try your command lines to see if that fixes my "problem". Thanks for the info!

     
  • Moto Geek

    Moto Geek - 2017-11-23

    Evan, do you have to set the LVP = ON when using this for the first time in GCB IDE? Or do you have to program with the pickit 3 first and set LVP = ON and then switch over to the NSDSP?

     
    • Anobium

      Anobium - 2017-11-23

      If you have programmed a chip without LVP you will need to erase with an appropiate PICKit using the PICKit GUI or MPLAB-IPE - clearly the choice of of PICKit or MPLAB-IPE is dependent on your chip.

       
  • William Roth

    William Roth - 2017-11-23

    If you are going to make a new board, then may I suggest mikroBus compatibility instead of the Arduino footprint for add-on boards.

    Microchip supports Click Boards based upon MikroElektronicas mikroBUS and has this footprint on their newer DEV boards. (Xpress, Curiosity, etc..) I think this is likely the best way forward for GCB.

    https://www.mikroe.com/mikrobus/

    https://shop.mikroe.com/click

     
  • William Roth

    William Roth - 2017-11-23

    The NS boards use LVP. So if the chip has previously programmed with LVP = OFF then the chip must first be programmed with a Pickit3 setting LVP = ON, before it can be used in an NS board.

     
  • Anobium

    Anobium - 2017-11-23

    Attached is an overview of the PICKit3 I am writing. The last section explains how to create a symbolic link to an existing MPLAB-IPE installation which then supports the FLASHPIC,BAT as shippped.

    You can updated MPLAB-IPE as the new versions are release and then recreated the symbolic link and you do not have to change FLASHPIC.BAT.

    The goal is not to change FLASHPIC.BAT unless we really, really have to.

     

    Last edit: Anobium 2017-11-23
  • stan cartwright

    stan cartwright - 2017-11-23

    The pickit2 microchip software has lots of buttons for lvp and "stuff".
    Starting gcb I flashed a hex file using it after not seen it and other flash hex program software.
    Fine if you're from using asm but with gcb I just flash the pics I use on vero board and use that as project board for whatever. It seems so simple I wonder why others use other methods and microchip software.

     
  • Anobium

    Anobium - 2017-11-23

    And! even more. As an alterative.......

    I discussed this with Microchip about a month ago. I expressed how fustrating the installation of MPLAB-IPE is.

    So, here is an unpublished insight. I will add to my existing PICKit3 document.

    You can install MPLAB-IPE to the same location everytime. This means you can install MPLAB-IPE directly into C:\GCB@SYN or whatever directory you wish.

    Download the package from the Microchip web site, then execute this Command (in command prompt): 

    "MPLABX-vx.xx-windows-installer.exe" --mode unattended --installdir "C:\GCB@SYN" 
    

    or, you can fix the directory in your programs directory, as follows:

    "MPLABX-vx.xx-windows-installer.exe" --mode unattended --installdir "C:\Program Files (x86)\Microchip\MPLABX" 
    

    Make sure you in the download folder and the installer exists, before launching the silent installation. 

    This will install the MPLAB X components silently on your machine. 

    Allow 10-15 minutes for the silent installation to complete (depending of the PC resources). 

    Now you have FIX the directoyy location in FLASHPIC.BAT permanently of MPLAB-IPE.

    Another great insight.

    :-)

     
  • David Stephenson

    Yes this is a good initiative. It took me a very long while to get the FLASHPIC.bat file to work (and I'm reluctant to fiddle with it as a consequence). This is what I have in my FLASHPIC.BAT (I don't think it is optimal).
    cd\ cd Program Files (x86)\Microchip\MPLABX\v3.40\mplab_ipe
    pk3cmd -p%2 -e -f%1 -m -V3.300
    cd\gcbasic

    I also had a lot of headaches due to the PICKIT3 changing "modes" and not wanting to go back.

     
  • Moto Geek

    Moto Geek - 2017-11-23

    Sorry about this, just not sinking in my pea brain quickly enough... So if I have a brand new pic12f1840 and want to use the northern programmer instead of pickit 3.

    Do I write my program in GCB IDE including the line LVP = ON, create the hex file and open it in Northern program and program the 12f1840, or do I have to use the pickit 3 for the first time to turn on the LVP, and after that first time I can use the Northern programmer?

    Sorry for my confusion, just not sure if you have to use the pickit 3 the first time or not. I don't yet have the Northern programmer yet or I would just test myself without wasting your time.

     
    • Anobium

      Anobium - 2017-11-23

      A new pic12f1840. You can use either. LVP = ON is ok for either programmmers.

      A pic12f1840 that has been programmed before with LVP = OFF - either knowingly or not. You must ERASE the pic12f1840 using the PICKit3 in the correct mode, or, create a little prgram with LVP = ON the program the pic12f1840 using the PICKit3 in the correct mode. This will set the CONFIG correctly so the NS programmer will work.

      Now... when I got mine. I have a series of emails and calls with the developer. Enjoy,


      Hello Evan,

      The LVP bit comes from the configuration setttings. With XC8, it can be set like this:

      #pragma config LVP = ON // this is the default
      

      or removed like this:

      #pragma config LVP = OFF
      

      If you compile it and program the chip with LVP = OFF then LVP will not be possible any more because MCLR pin will not respond. So to do anything with such a device you need an HVP programmer (such as PICkit3). To reset the bit, you need to compile a program with LVP = ON and write it to the chip with HVP programmer, or simply erase the chip with HVP programmer (LVP = ON is a default on erased chip). Once you do that, you will be able to program it with LVP.

      If you only have an LVP programmer, and you try to program something which has (LVP = OFF), it won’t work. Microchip internals will prevent LVP = OFF setting. Only HVP programmer can do this. So there’s no chance to lock yourself out.


      So, that translate into.... ERASE with a PICKit3 in the correct mode, depends on your chip, using the windows GUI or MPLAB-IPE.

       
  • stan cartwright

    stan cartwright - 2017-11-23

    My take is years ago people installed mplab (no x then) just to flash a hex file but all you needed was mpasm.exe. I'm glad I got gcb to do what I want without any problems and can get on with coding ideas in no time.
    I'm just trying to say how easy gcb can be for a new user but eveyone else is pointing out problems. Contradicts with the idea of basic is simple to use.
    All this should be under advanced label. Makes gcb seem complicated.
    I think all the pic config stuff should be for assembler users and the gcb way of making all that under the bonnet taken care of stuff kept away from anyone who thinks it too technical. It's basic not asm.
    It seems assumed that gcb users used asm. pic users maybe but arduino no.
    Some of the win stuff is hard to. I just use a mouse.

     
    • Anobium

      Anobium - 2017-11-23

      @Stan. Let me clarify the issue here.

      This issue is cause by the selection of the PIC microcontroller. A new user to a professional has to use the correct programmer for a chip, the correct supporting software and correct operating system in the programmer.

      A new user will not know the chip on the front page of the Microchip web site is supported, or, not supported by PICKit3 in a specific operation mode. But, Microchip do expect all new users to use MPLAB-IPE or the tools from MPLAB-X (local install or web IDE).

      A scenerio. A new user or an old user gets a chip.. something simple 16f88.... it works with the PICKit2 that he got off the web, or, a cheap one from eBay. Works fine.

      So, then they think... I will get a newer chip, just happens to be a chip from a few years ago (I think Bill can tell us the ones that do not work with PICKit2).. That one does not work with PICKit2. It is ok. Get a PICKit3 and it works.

      So, then they think... I will get nice new shiney chip like the 16f18326, That one does not work with PICKit3!! Then, they learn that it will work in MPLAB mode. And, they are required to use MPLAB-IPE. That is the supported option from Microchip


      This now raises a great option....Bring on the TinyBootload+!!! But, for those who can use a serial booloader the TinyBootload+ is great. You may have to use MPLAB-IPE to programmer the bootloader but then your are serially connected. Just like an Arduino.

      So, my view, this is not easy ground for a new user or a seasoned person.

      I have thought of creating nice table of the chips that are supported by what Microchip programming methods/alternate programmer. Is this worth the effort? It has to be maintained!


      A little more to share.

      This is a huge concern to me. How does a new user or seasoned user get to understand the way forward? I have given you the facts I know in these postings and these are facts from Microchip Support and/or Microchip Programming Engineering Team.

      Also, we have a session with Microchip Engineering in early Decemeber where they will brief, a few of us from the Great Cow BASIC developement team, specifically with respect to this subject. We will share what we can after the meeting as we should not be guessing the direction of travel for the the Microchip programming tools/software suite.

      Evan

       
  • Anobium

    Anobium - 2017-11-23

    And, there is more. I should write this all up!


    When you finally do break the PICKit3 with the changing of modes... MPLAB mode and reverting to GUI mode, or, simply when MPLAB-IPE gets upset .... you can end up in state when you have a pretty red piece of plastic with a nice pcb inside it. Yes. the PICKit3 can get completely messed up and the PICKit3 core operating system can get corrupted.

    This has happened to me 3 times.

    The first two time the nice people in Microchip sent me two new PICKit3s. Well the third time they were a lot more helpful.

    They provided me the PICKit3 core operating system. The core operating system is not the same the operaring system code that is used when you toggle the mode but the PICKit3 core operating system.

    To salvage the pretty red piece of plastic with a nice pcb inside it to a PICKit3 you need to open the case. Find the programming port and using a PICKit2 or another PICKit3 (at this point I had a few of them) reprogram the PICKit3 core operating system. Result - PICKit3 is back in action.

    Instructions from Microchip.

    1. Connect a programming cable from another MCHP tool to J2
    2. Select the device PIC24J256GB106
    3. Import the core operating system to the programmer
    4. Program and verify

    The triangle next to the J2 text in the board silkscreen designates pin 1. J2 is an ISCP port,

    I get to do this about once a month - one of reasons why I started looking for another programmer! Hence, Northern Software programmer.

    Sharing the pain of programming a few thousand times a month!

    Evan

    The warning I got from Microchip engineering. Same applies here!

    DO NOT BE TRYING THIS TO FIND OUT IF THIS WORKS.
    DO NOT BE TRYING THIS IF DO NOT WANT RISK TOTALLY BRICKING YOUR PICKit3
    DO NOT BE CALL SUPPORT WHEN THIS DOES NOT WORK
    NO WARRANTIES IMPLIED

     

    Last edit: Anobium 2017-11-23
    • Anobium

      Anobium - 2017-11-23

      And, even more.

      I have the core operating system code for the PICKit2. If your PICKit2 gets bricked then ask for the core operating system code.

      :-)

       
    • David Stephenson

      That is very worrying. I have had a single PICKit3 for several years and it is still working. Maybe I should get a spare as my only backup is a homemade JDM programmer which will fry lower Vpp voltage chips.

       
      • Anobium

        Anobium - 2017-11-24

        worrying.... mey be not. There are a few things that seems to cause the PICKit3 error.

        1. Swapping bewtween IPE and GUI
        2. A failure of the communications between the programming computer and the Microchip host server (getting the chip specific file down)
        3. Failure of the local application in terms of the MPLAB-IPE

        I truly have one PICKit3 dedicated to MPLAB-IPE. I do not toogle modes.
        I check the MIcrochip is operational before I change chip in MPLAB-IPE
        I ensure I have the latest patches for Windows, latest Java and latest MPLAB-IPE.

        I program many, many times an hour when in action. I change chips often. I am an edge condition in terms of error happening. :-)

         
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.