English
Language : 

AN1302 Datasheet, PDF (1/8 Pages) Microchip Technology – An I2C™ Bootloader for the PIC16F1XXX Enhanced Core
AN1302
An I2C™ Bootloader for the PIC16F1XXX Enhanced Core
Author: Cristian Toma
Microchip Technology Inc.
INTRODUCTION
The new PIC16F1XXX enhanced core microcontroller
has the ability to write its own program memory under
software control. This allows the microcontroller to
make modifications in the program Flash memory. This
application note explains the implementation of a
bootloader using I2C™ as a communication channel.
BOOTLOADER CONCEPT
The bootloader allows a processor to change its
firmware without any physical intervention to the device
itself. There is no need for a hardware programmer
when using the bootloader. The firmware is
downloaded from a host system by means of a
communication channel, usually through a USB or a
serial port. This bootloader implementation uses a
standard I2C bus as a communication channel between
the microcontroller and the host system.
In general, when using a bootloader, the code is
transferred from a host device. Typically, this is
comprised of a PC computer using a RS-232 serial
cable or a USB port. Any other device can act as a host
device.
The target device needs bootloader firmware. This is
basically a software that accepts commands and data
from a host device and reads/erases/writes data to the
Flash program memory. This firmware is typically
located on the lower part of the program memory. The
bootloader code is started by default at system Reset.
It then checks if there is any application code loaded
and jumps into application code if any is found.
Alternatively, a button can be used to instruct the
bootloader to stay in bootloader code even if a firmware
is already present. This is useful when reading the
application firmware or in case of an application
firmware update.
BOOTLOADER REQUIREMENTS
The bootloader makes it unnecessary for any physical
intervention with a hardware programmer. The target
device must have some form of data connection with
the host. In this application note, I2C communication is
used. If the device uses the I2C port to communicate
with other devices on the bus, then no additional
connection is needed.
The bootloader will require the lower side of the
program memory reserved for the bootloader firmware
(see Figure 1). The rest of the program memory can be
used by application. No RAM memory needs to be
reserved, since it is used in different contexts and not
at the same time.
FIGURE 1:
FLASH MEMORY MAP
 2009 Microchip Technology Inc.
DS01302A-page 1