Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN1302 Datasheet(PDF) 3 Page - Microchip Technology

Part # AN1302
Description  An I2C??Bootloader for the PIC16F1XXX Enhanced Core
PDF  8 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

AN1302 Datasheet(HTML) 3 Page - Microchip Technology

  AN1302 Datasheet HTML 1Page - Microchip Technology AN1302 Datasheet HTML 2Page - Microchip Technology AN1302 Datasheet HTML 3Page - Microchip Technology AN1302 Datasheet HTML 4Page - Microchip Technology AN1302 Datasheet HTML 5Page - Microchip Technology AN1302 Datasheet HTML 6Page - Microchip Technology AN1302 Datasheet HTML 7Page - Microchip Technology AN1302 Datasheet HTML 8Page - Microchip Technology  
Zoom Inzoom in Zoom Outzoom out
 3 / 8 page
background image
 2009 Microchip Technology Inc.
DS01302A-page 3
AN1302
BOOTLOADER FIRMWARE
As mentioned before, the bootloader firmware resides
in the lower part of the Flash memory. The firmware
receives, interprets and executes a set of I2C com-
mands (the complete list of commands is described in
Table 1). In order to respond to the I2C commands, the
firmware must access the Flash memory. For some
commands that involve operations with the internal
Flash memory that takes time to complete the opera-
tion. These commands are implemented as I2C Read
command. They will return a dummy 0x00 byte after
the operation has completed. During this time, the
slave will clock stretch the I2C bus by pulling the SCL
line low to signal the master device that the operation
has not completed. The download of data to the inter-
nal buffer does not need any response from the target
system, thus the command is implemented as a normal
I2C Write command.
The structure of the I2C commands is described in the
following. These are implemented as the target being
an I2C slave device.
General configuration of an I2C write operation (see
Table 2):
1.
Send a "Start" condition to the slave device
2.
Send the device address with the R/W bit low
(even address). If the sent address matches the
slave device address, then the slave device
sends an ACK signal.
3.
Send the internal register number you want to
write to.
4.
Send data. Depending on the command used,
the master can send multiple data bytes. Please
note that the master device can send a multiple
number of bytes.
5.
Send a "Stop" condition.
TABLE 2:
I2C WRITE COMMAND
General configuration of an I2C read operation (see
Table 3):
1.
Send a “Start” condition.
2.
Send the device address with the R/W bit low
(even address). Notice that the slave sends an
Acknowledge signal if the address matches.
3.
Send the bootloader command number you
want to read from.
4.
Send a “Restart” condition.
5.
Send the device address again. This time with
the R/W bit high (odd address).
6.
Read a number of bytes from the slave device.
If data is not yet available, the slave will use
clock stretching (pull SCL line low).
7.
Send a “Stop” condition
TABLE 3:
I2C READ COMMAND
The bootloader code must exit after completing the
download of the new firmware. This is typically imple-
mented using a Reset instruction. The decision to go to
bootloader code or application code is based on a boot-
loader flag placed in the Flash memory. The location of
this flag is at the highest address of Flash memory for
the target device. In the current implementation using
the PIC16F1937, this location is 0x1FFF. Other devices
might have more or less available Flash program mem-
ory and the last available Flash memory location will
vary accordingly. Following an Erase command, the
data at address 0x1FFF is 0x3FFF. After a successful
code download and verify, the data contained at this
address will be changed to a special value (0x55), indi-
cating that an application is loaded. When the applica-
tion code needs to jump to the bootloader code it will
write an all-zeros value to the bootloader flag address.
When writing an all-zeros value to a Flash memory
location there is no need for a previous erase opera-
tion. An erase operation sets the Flash memory loca-
tion to an all-ones value. The special value can be
either contained in the application hex file or written by
the bootloader upon a successful code update.
Alternatively, any means of code-present flags can be
used, such as flags in EEPROM memory or any other
address in the Flash memory.
The full source code of the bootloader is available with
this application note. The firmware runs on the F1 Eval-
uation Platform containing a PIC16F1937. Three demo
applications are provided along with this application
note. These are relatively simple and are provided with
the purpose of demonstrating firmware upload. The
first two applications are just "Hello world" kind of firm-
ware. The third application showcases the use of inter-
rupt forwarding.
Start
Address
Register
Data (nbytes)
Stop
Start Address Register Restart Address
Data
(nbytes)
Stop



Html Pages

1 2 3 4 5 6 7 8


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com