Tiny PIC bootloader using PIC16F microcontroller

Summary of Tiny PIC bootloader using PIC16F microcontroller


This article describes "Tiny Bootloader," a compact firmware solution for Microchip PIC microcontrollers (16F, 18F, dsPIC30 families). It occupies under 100 words of program space and supports flash, EEPROM, and configuration byte writing. The bootloader waits one second after reset to receive PC commands before launching the user application. A companion PC software tool facilitates HEX file uploads, automatically detects device models, and allows customizable communication settings.

Parts used in the Tiny Bootloader:

  • Tiny Bootloader firmware (.asm file)
  • PC software tool
  • Microchip PIC microcontroller (16F, 18F, or dsPIC30 family)
  • Serial communication interface (COM port)

Tiny Bootloader

This is a bootloader for the Microchip PIC microcontrollers.

  • It is the smallest bootloader, taking less than 100 words of program space;
  • Supports families of PIC devices: 16F, 18F, dsPIC30 (those devices that support self-programming)
  • Does not support yet PIC24, dsPIC33, PIC18xxJyy
 

Tiny PIC bootloader

Features of the firmware

  • Size of only 100 words; (all versions, for 16F,18F,dsPIC occupy less than 100 words);
  • Can write flash, eeprom and configuration bytes(18F);
  • On reset, waits 1 second (adjustable) for a message from the PC, if not received, launch user application;
  • The .asm file can be easily modified and adapted for any frequency (or baudrate);

Features of the PC software

  • Can upload programs into flash (in current version eeprom and cfg bytes can be modified only manually, depending on the device type);
  • Works with PIC16F,PIC18F and dsPIC types; automatically detects HEX content and PIC model;
  • Remembers last settings;
  • In case of errors, performs retransmissions or tries to resynchronize with pic;
  • The communication settings are editable so you can write any COM number or desired baud;
  • If a filename is specified as a command line parameter, it will automatically try to write it;

Supported/Tested Devices

Device Devices of the same type Flash ram EE ser adc osc pin    

PIC 16F Family

PIC16F876 877, 873, 874                  
PIC16F876A 877A, 873A, 874A 8k .3 .2 1 y   dD    
PIC16F887 PIC16F886                  
PIC16F88 87 4k .3 .2 1 y y d    

PIC 18F Family

PIC18F252 452, 242, 442;  2420, 2520, 4420, 4520 16k 1.5k .2 1a y   dD    
PIC18F258 458, 248, 448;  2480, 2580, 4480, 4580 16k 1.5k .2 1a y   dD CAN  
PIC18F2620 4620, 2525, 4525 32k 3.9k 1k 1e y y dD    
PIC18F1320 1220, 2220, 2320 4k .2 .2 1e y y d    
PIC18F8720 6520, 8520, 6620, 8620, 6720; 6621 64k 3.8k 1k 2 y   Q ext.mem.  
PIC18F2550 4550, 2455, 4455 16k 1.5k .2 1e y Y dD usb  
PIC18F4431 2331, 2431, 4331 8k .7 .2 1e Y   dD advPWM  
PIC18F4680 2585,2680,4585 32k 3.3 1k 1 y   dD ECAN  
PIC18F4580 2480,2580,4480 16k 1.5 .2 1 y   dD ECAN  
PIC18F4620 2525,2620,4525 32k 3.9 1 1 y   dD    
PIC18F4320 2220,2320,4220 4k .5 .2 1 y   dD    
                     

dsPIC Family

Device Devices of the same type Flash ram EE ser adc osc pin    
dsPIC20F2010   4k .5 1k 1 y y d 6pwm  
dsPIC30F6014 6012, 6013, 6011, 6012A 44k 8k 4k 2 yy y Q 2CAN  
dsPIC30F3013 3012, 2012, 2011 8k 2k 1k (2) yy YY d    
dsPIC30F4012 4011 16k 2k 1k (2) y Y dD 6pwm, CAN  
dsPIC30F3011 3010 8k 1k 1k (2) y Y dD 6pwm  
dsPIC30F6010   44k 8k 4k 2 y y Q 8pwm, 2CAN  
 
  blue – tested for longer periods
blue – verified (or user source provided)
navy – reported to work (may require modifications!)
Flash, RAM, EEprom:  max. amount
ser:  a=addr.; e=enh.(brg/lin)
adc:  yy=12bit
osc:  internal+features
pin:  d<=dip28;  D=dip40;  Q>=tqfp

 

For more detail: Tiny PIC bootloader using PIC16F microcontroller

Quick Solutions to Questions related to Tiny Bootloader:

  • How small is the Tiny Bootloader?
    The bootloader takes less than 100 words of program space.
  • Can the bootloader write to EEPROM and configuration bytes?
    Yes, it can write flash, EEPROM, and configuration bytes, though manual modification may be required for EEPROM and CFG bytes depending on the device type.
  • Does the bootloader wait for a message from the PC upon reset?
    Yes, it waits one second (adjustable) for a message; if none is received, it launches the user application.
  • What PIC families are supported by this bootloader?
    It supports 16F, 18F, and dsPIC30 families that allow self-programming.
  • Can I modify the .asm file for different frequencies?
    Yes, the .asm file can be easily modified and adapted for any frequency or baudrate.
  • Does the PC software automatically detect the PIC model?
    Yes, the software automatically detects HEX content and the specific PIC model.
  • Is the communication baud rate editable?
    Yes, communication settings including COM number and desired baud rate are editable.
  • What happens if an error occurs during upload?
    In case of errors, the software performs retransmissions or tries to resynchronize with the PIC.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter