Editing PIC Programmers, In Circuit Programming and BootLoaders

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
This is an article in the process of creation, will you help finish it?
 
  
 
In the PIC world programming may mean either writing the program by a human being or writing the hex file from the compiled ( assembled ) program into the PIC chip.  This page concenrns the latter.
 
 
== Overview ==
 
 
There are several different methods of programming each with its own advantages and disadvantages.  Right now I like serial bootloading the best, but it may not be the best for everyone.  The following chart summarizes the methods, they are then discussed in more detail later.
 
 
 
 
{| class="wikitable"
 
|-valign="top"
 
|Method
 
|What
 
|Details
 
 
<!-------------------------------->
 
|-valign="top"
 
|Hardware Programmer
 
|The PIC is placed in the programmer and the programmer workds with a PC ( typically ) to move the program to the PIC.
 
|All chips can be used with Hardware Programmer, but different chips may require different programmers.
 
<!-------------------------------->
 
|-valign="top"
 
|In Circuit Programming
 
|The PIC is installed in the target board, and then never moved again. The programmer is plugged into a "programming connector" on the target board each time you want to reprogram the PIC.
 
|Not all chips can be used with In Circuit Programming.{{fact}}
 
<!-------------------------------->
 
|-valign="top"
 
|Serial Bootloaders
 
|In this method a small program ( the Serial Bootloader ) is hidden away in the PIC memory and upon reset the PIC would check its serial connection and if connected to a Bootloader utility on the connection a new program is loaded into the PIC, and then the downloaded program begins.  If the Bootloader utility is not connected the current PIC program is run.  The serial connection can be of any type, RS232 or USB for example.
 
|Requires initial programing with a Hardware Programmer, and the serial connection.  The PC runs the Bootloader utility.  Not all chips can be used with Serial Bootloaders.
 
<!--------------------------------
 
|-valign="top"
 
|what
 
|[[]]
 
|Comment
 
 
 
<!-----------end of table--------------------->
 
 
|}
 
 
== Hardware Programmer ==
 
 
Advantages
 
 
* There is some programmer for every chip, and many support a very wide range of chips including one time programmable chips.
 
 
Disadvantages
 
 
* Need to remove PIC from its circuit and put in the programmer's socket.
 
* Extra cost for the programmer.
 
 
 
for links to programmers see: [[PIC Links]] search for "Programmer"
 
 
== In Circuit Programming ==
 
 
Advantages
 
 
* Do not need to remove chip from the PIC circuit.
 
 
Cypress says "ISSP ... stands for In-System-Serial-Programming.  We recommend that all PCBs be designed to support ISSP. During the prototyping phase it is very convenient for the hardware of software engineer to be able to re-program a PSoC device on the prototype board. This is much easier than removing the PSoC device, reprogramming it and replacing it on the PCB. This is especially true when using surface mount devices."
 
-- Cypress
 
[http://www.cypress.com/psoc2/?id=1353&rtID=118&rID=27453 "Programming a PSoC In System"]
 
 
[http://www.atmel.com/dyn/resources/prod_documents/DOC0943.PDF "Atmel AVR910: In-System Programming"]
 
 
 
 
Disadvantages
 
 
* Not all chips support in circuit programming.
 
 
== Serial Bootloaders ==
 
 
Advantages
 
 
* Do not need to remove chip from the PIC circuit.
 
* Often only requires you to shift the PC software to the Bootloader utility.
 
* Very quick for test, revise, retest cycles.
 
* No special hardware required, cheap.
 
 
Disadvantages
 
 
* Not all chips support in serial bootloaders.
 
* PC may not have the required serial port.
 
* Requires serial hardware, but your circuit may already have it.
 
* You may have to compile or assemble your bootloader to configure it for your needs, it may not be in the same language you would normally use.
 
 
 
With a Serial Bootloaders there are two software components ( in addition to the hardware serial connection ) the Bootloader utility running on the PC and the PIC bootloader on the PIC.  If you program is going to use a serial interface any way ( even if just for debugging ) this can be a very nice way of programming, you do not have to move one bit of hardware to go from programming to running to programming to .......  The bootloader is a small program that is tucked away, normally in high memory, that checks at startup to see if it is connected to a PC bootloader utility.  If so it dowloads a new program to the PIC, else it it runs the PIC program.
 
 
The PIC bootloader must be configured for the target chip and the configuration of the PIC, generally speaking the user program must share the configuration of the bootloader as the bootloading process does not change the configuration.  Because of this bootloaders are often distributed in source code form ( usually asm ) so that you can tweak the code and assemble it for yourself.  Often there will be several pre-built hex files and one of these may or may not work for you.  Once you have the right bootloader you use a Hardware Programmer to write the bootloader to the PIC for hopefully the first and last time ( a badly behaved program can destroy the bootloader requiring a reload ).
 
 
In some cases you may buy a chip that already contains the bootloader -- this can save a certain amount of work.
 
 
 
'''The following is just draft:'''
 
 
 
You may be able to use a bootloader at a different baud rate than intended if the crystal is different.  Both need to change by the same factor.
 
 
 
=== Table of Bootloaders ===
 
 
{| class="wikitable"
 
|-valign="top"
 
|Name
 
|Source
 
|Details
 
 
<!-------------------------------->
 
|-valign="top"
 
|
 
Tiny Bootloader
 
|[http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm Tiny PIC bootloader]
 
|A bunch of different PICs
 
<!-------------------------------->
 
|-valign="top"
 
|
 
Bloader and Screamer
 
|[http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=69 Bloader and Screamer]
 
|from our friends at SparkFun. Supports: 16F877A (20  and 4MHz), 16F876A (20 and 4MHz), 16F873A (20 and 4MHz), and 16F88 (20/4MHz external, 8MHz internal)
 
 
<!-------------------------------->
 
|-valign="top"
 
|
 
PIC downloader 1.08
 
|[http://www.ehl.cz/pic/pic_e.htm PIC downloader]
 
|need comment
 
 
<!-------------------------------->
 
|-valign="top"
 
|
 
CodeLoader
 
|[http://www.thebytefactory.com/default.htm CodeLoader]
 
|need comment
 
<!-------------------------------->
 
|-valign="top"
 
|
 
Zero Pin Loader (ZPL)
 
|[http://www.circuitcellar.com/flash2002/honorable.htm Zero Pin Loader (ZPL) for the PIC18F Family  ]
 
|need comment
 
 
<!-------------------------------->
 
|-valign="top"
 
|
 
PIC18Fx52 bootloader v1.5
 
|[http://www.microchipc.com/PIC18bootload/ PIC18Fx52 bootloader v1.5]
 
|From Microchip  need more comment
 
 
<!-------------------------------->
 
|-valign="top"
 
|
 
PIC16F87x / 16F87xA bootloader
 
|[http://www.microchipc.com/PIC16bootload/index.php PIC16F87x / 16F87xA bootloader]
 
|From Microchip  need more comment
 
 
<!-------------------------------->
 
|-valign="top"
 
|
 
PIC18F1320 bootloader
 
|[http://www.microchipc.com/sourcecode/index.php#PIC18F1320_bootloader C sample code for PIC micros and Hi-Tech C]
 
|From Microchip  need more comment
 
<!-------------------------------->
 
|-valign="top"
 
|
 
My PIC bootloader
 
|[http://www.seanet.com/~karllunt/picload.htm  My PIC bootloader]
 
|This code was written for use with the 16f873 device, which has 4K of program memory.  You can easily convert this program for use with larger devices by changing references to the device name and by moving the start of the program; the locations for these changes will be obvious in the source file.
 
<!-------------------------------->
 
|-valign="top"
 
|
 
Diolan
 
|[http://www.diolan.com/pic/bootloader_dwn.html Diolan USB PIC Bootloader]
 
|USB based.  In asm.
 
<!-------------------------------->
 
|-valign="top"
 
|
 
WLoader
 
|[http://www.voti.nl/wloader/index_1.html WLoader - a 16f877 application loader]
 
|Needs review.
 
<!-------------------------------->
 
|-valign="top"
 
|
 
MicroCode Loader
 
|[http://www.grifo.com/SOFT/mecanique/uk_index3.htm MicroCode Loader]
 
|Needs review.
 
<!-------------------------------->
 
|-valign="top"
 
|
 
Boot18
 
|[http://www.philpem.me.uk/elec/pic/ Boot18]
 
|Needs review. by Philip Pemberton. Currently works on the PIC18F252 and PIC18F452.
 
<!--------------------------------
 
|-valign="top"
 
|
 
name
 
|[]
 
|
 
<!--------------------------------
 
|-valign="top"
 
|
 
name
 
|[]
 
|
 
<!--------------------------------
 
|-valign="top"
 
|
 
name
 
|[]
 
|
 
<!--------------------------------
 
|-valign="top"
 
|
 
name
 
|[]
 
|
 
<!--------------------------------
 
|-valign="top"
 
|
 
name
 
|[]
 
|
 
<!--------------------------------
 
|-valign="top"
 
|
 
name
 
|[]
 
|
 
 
<!-------------------------------->
 
 
 
<!-----------end of table--------------------->
 
 
|}
 
 
=== Tested Bootloaders ===
 
 
Tested tool chains for Serial Bootloaders -- if you Chip/Hardware is close this might be a good place to start.
 
 
{| class="wikitable"
 
|-valign="top"
 
|Method
 
|What
 
|Details
 
 
<!-------------------------------->
 
|-valign="top"
 
|Chip/Hardware
 
|Tool Chain
 
|Link
 
<!-------------------------------->
 
|-valign="top"
 
|
 
*877A
 
*20 meg crystal and clock
 
|
 
* on PIC bootldr-16F877A-20MHz-38400bps.HEX
 
* on PC PICdownloader.exe
 
* download at 38.4 K baud
 
|I forget
 
<!-------------------------------->
 
|-valign="top"
 
|
 
*16F877A
 
*4 meg Hz crystal and clock
 
|
 
* on PIC: bootldr-16F877A-16MHz-38400bps.HEX
 
* on PC: PICdownloader.exe
 
* download at 9.6 K baud  ( note that this is 1/4 of the intended baud because the crystal is 1/4 of the target crystal )
 
|I forget
 
<!-------------------------------->
 
|-valign="top"
 
|
 
*18F2550
 
*20 meg Hz crystal 24 meg Hz clock
 
|
 
* On PIC: tinybld18F2550usb _20MHz_115200.HEX
 
* On PC: TinyBootloader
 
* download at 115.2 K baud
 
This worked fine the first time after programming the bootloader, after first bootload it would not work a second time.  Doing a power off and on to reset seems to make it work time after time.  More testing needed.  This baud rate is high, I have changed it to 19.2K to see if it is more reliable at that speed.  Again more testing needed.
 
|[http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm Tiny PIC bootloader]
 
<!--------------------------------
 
|-valign="top"
 
|
 
*18F2550
 
*20 meg Hz crystal 24 meg Hz clock
 
|
 
* On PIC:
 
* On PC:
 
* download at 9.6 K baud
 
|[]
 
 
 
 
<!-----------end of table--------------------->
 
 
|}
 
 
== Further reading ==
 
 
* [[Bootloader Development]]
 
* [http://en.wikibooks.org/wiki/Embedded_Systems/Bootloaders_and_Bootsectors "Embedded Systems/Bootloaders and Bootsectors"]
 
* [http://massmind.org/techref/microchip/devprogs.htm#bootloaders "PIC Microcontroller Programmers"] discusses in-circuit programmers and bootloaders
 
 
[[category:Microcontroller]][[category:PIC]]
 

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Template used on this page: