8 Replies Latest reply on Jan 12, 2019 11:49 AM by koudelad

    programming hex file for PIC18F26J50-EVK vs separate IC

    wimbloemendal

      Hi,

      I have used several times the PIC18F26J50-EVKPIC18F26J50-EVK development kit. Nice thing about it that it can program it self. That is press S1 (pin RC0) during power on, and it will be recognized by the "Microchip PIC18 Starter Kit for Flowcode from Element14" bootloader. Now I wonder if I buy the uproc as 'standalone' component, will I be able to program it the same way? (Having a S1 connected to RC0 in my own made design). Or do I need a separate programmer?

      regards,

      _Wim_

        • Re: programming hex file for PIC18F26J50-EVK vs separate IC
          koudelad

          Hello,

           

          The mentioned PIC in the kit contains a preprogrammed HID bootloader from factory. It is a firmware bootloader, not hardware. If you buy a new chip, it will arrive blank and you would need a separate programmer to program the PIC with the same firmware. (I guess there is some default firmware available for download at some product page).

           

          David

          2 of 2 people found this helpful
            • Re: programming hex file for PIC18F26J50-EVK vs separate IC
              wimbloemendal

              Hmm, I was afraid for that. So I need a separate programmer + the appropriate hex file. Alternative is to buy the EVK kits, and take out the (preprogrammed) IC...

              Any programmer from element14 for this device you can recommend? And then where to get the default firmware.. Or would a "Read Device" and "Export Hex" from an EVK kit will do the job..!?

              Thanks for your response,

              _Wim_

                • Re: programming hex file for PIC18F26J50-EVK vs separate IC
                  koudelad

                  You are right.

                   

                  If you need just one device, buying the development kit one more time is the cheapest option.

                   

                  If you plan some more work with PIC devices, I recommend using a separate programmer. The newest official low cost programmer is PICkit4. https://uk.farnell.com/microchip/pg164140/in-ckt-debugger-programmer-pic/dp/2840654?st=pickit

                   

                  The last PICkit I used was PICkit2 and it was compatible with the Microchip's IDE: MPLAB (now named MPLAB X). This programmer also had a standalone application that allowed reading and cloning a PIC device. I hope the newest PICkit4 is capable of doing that too, but I would rather someone else (actually owning the programmer) confirming it.

                   

                  Regarding the firmware file: I couldn't find any information about on the Microchip website, however, there is at least a manual for this kit here on element14 (maybe also other resources?) Microchip: User Manual for PIC18F26J50-EVK Flowcode Development Kit . Chapter 6.2 mentiones downloading a sample hex file, so I guess there was some CD supplied with this kit, that contained the file.

                   

                  David

                  2 of 2 people found this helpful
                    • Re: programming hex file for PIC18F26J50-EVK vs separate IC
                      wimbloemendal

                      The PICkit4 is indeed a good idea, cheap enough, even if I would use a few components. However I'm getting a little confused about the firmware (hex) file. If I create a simple program through Flowcode and write that to the target chip, the result is that somehow the target includes (again) the bootloader to allow to program again, and again, etc. I can even choose to 'Erase Device', and still this bootloader is available in the device! So is this 'bootloader' somewhere stored in a hidden area?! Or is this bootloader automatically added with the "HID Bootloader" program? Or what?

                       

                      _Wim_

                        • Re: programming hex file for PIC18F26J50-EVK vs separate IC
                          koudelad

                          This is a usual practice with bootloaders and their "special" software. If you use the software supplied with the kit, it never really erases the bootloader, it uses the bootloader to program the target device (or erase the user program memory) - but never the bootloader itself.

                           

                          On the other hand, if you erase the chip using the MPLAB X (or some PIC programmer software) using the PICkit (or another HW programmer) directly, it would erase the whole chip, including the bootloader. It couldn't be revived using the kit software, but only after programming the bootloader again, using the HW programmer.

                           

                          I hope I didn't confuse you even more.

                           

                          David

                          2 of 2 people found this helpful
                          • Re: programming hex file for PIC18F26J50-EVK vs separate IC
                            koudelad

                            Have a look at this Microchip's description or their bootloader generator and some general principles:

                            https://www.microchip.com/promo/8-bit-bootloader

                            2 of 2 people found this helpful
                              • Re: programming hex file for PIC18F26J50-EVK vs separate IC
                                wimbloemendal

                                Hi David,

                                I think I understand what you're saying, although the matter is pretty complicated (to me). So if I understand correctly, if I order the PICkit4 programmer, I can at least program a new blank chip with my application written with Flowcode. Although I assume now that this will be without a bootloader to allow self-programming. As such not really a big issue for me, although the self-programming feature would be handy...

                                I found however Microchip: Firmware for PIC18F26J50-EVK FLOWCODE Development Kit (.hex file) … I wonder if this would include the demo application + bootloader. So if I program a new blank chip initially with this hex file (using the PICkit14), I end up with a PIC with self-programming capability..!?

                                Of course on my PCB I must add a ICSP connector to be able to connect to the PICkit4, something I would not require for self-programming.. It's kind of chicken & egg story I guess!? :-)

                                Thanks you very much for your support,

                                _Wim_

                                  • Re: programming hex file for PIC18F26J50-EVK vs separate IC
                                    koudelad

                                    Oh, that is great you have found the firmware file. It is exactly as you write - there are two possibilities - it is only some default program for showcase (without bootloader), or it is a full firmware file with bootloader (and optionally with some application).

                                    Bootloaders usually (but not always) need to be programmed using an external programmer.

                                     

                                    Either way, if you buy a standalone programmer like PICkit4, you are able to program the chip even if you bought a chip with blank memory (in that state are all the microcontrollers sold by default). Then you should be able to clone the program memory from the chip in the development kit you already have. Or upload the firmware you found and see whether it works like the chip in the development kit, or not.

                                     

                                    I am not familiar with Flowcode, but does it give you somewhere an option to create an output hex file with or without the bootloader? By default it obviously generates just a program that can be uploaded by the bootloader supplied with the kit (the bootloader was programmed by the manufacturer).

                                     

                                    Think of a bootloader of just a piece of program that is able to program the rest of the flash memory. If you power up the microcontroller, it is the first piece of code that starts and its purpose is to check whether there is a request for a new program upload. If not, the user program runs (if there is any).

                                    It has some advantages and disadvantages.

                                    Advantages:

                                    • it is "free" in terms of HW - you don't need additional chip (like in PICkit4) to program the microcontroller.

                                    Disadvantages:

                                    • you sacrifice some program memory for the bootloader, so your program can't be as big as if you programmed with a programmer on a bare chip.
                                    • It also takes some time, before the user program runs (as explained above).
                                    • If the bootloader has to capability of reprogramming itself, you might somehow be able to corrupt the bootloader, which is irrecoverable without an external programmer.
                                    2 of 2 people found this helpful