This article introduces the reader to a set of up to date Serial Bootloader tools for Microchip 8 bit PIC series products that we frequently use in electronic designs featuring an 8 bit embedded MCU (Micro Controller Unit).
So what is a Serial Bootloader and why would anyone want it?
In some products that use an MCU it may be advantageous to allow the program to be updated in the field or at a service shop without the specialized programming gear needed to completely reprogram it. For this purpose the MCU is equipped with a small primary program whose sole purpose is to facilitate updating of the main device application program. In embedded systems this is sometimes referred to as a “Bootloader Stub” since it is often located at the beginning or end of the program memory space, and is the first code to execute on start or reset. When the device starts, the Bootloader checks for a special state or instruction. If that object is present, the Bootloader waits to download and overwrite the Application Program with an update. Otherwise the device continues on to execute the full Application Program. Some such devices have a USB port that can be used as the communications for this but it is less common than other serial port types that can be implemented at lower cost. One of the most common serial port types on low cost embedded designs is the venerable RS-232 port. In fact, many different MCU devices have one or more built in UART devices (direct support for RS-232) while just a handful build in the more complex USB port.
For example: recently tasked with redesigning a controller PCB for an existing product, there was no need or desire to change the interfaces, only update the components that were obsolete. One of the obsolete components was the Microchip MCU, a 40 PIN DIP with insufficient Flash memory for program updates and a shortage of digital I/O. It was replaced by an 80 pin TQFP variant with more memory space in all 3 categories (Flash, RAM and EEPROM) more I/O of course (to eliminate the previous I/O sharing scheme and provide for expansion) and perhaps most important at a lower cost than the old part it replaces. A dedicated ICSP (In Circuit Serial Programming) port replaces the practice of burning the old DIP parts in in an old EEPROM programmer appliance. The product also uses an RS-232 port to communicate with a control computer. In this case, it was decided to leverage the existing RS-232 port in the design for firmware maintenance. The larger Flash space of the new MCU allowed adding the Serial Bootloader feature to eliminate the need for any dedicated programmer equipment when updating units already programmed at least once. All that is needed is a PC to run the AN1310 PC Bootloader application equipped with a RS-232 serial port, an established serial link between the computer and device to be programmed and the program update in the form of a .hex file.
The Application Note from Microchip, AN1310 provides all of the resources needed to accomplish the addition and operation of the Serial Bootloader with many variants of the PIC16F and PIC18F 8 bit MCU families having an available UART port.
Microchip AN1310