28 September, 2002
This investigation was started after I ordered the free sample kit for the
Circuit Cellar contest, called Mad Dash for Flash
Cash. There seems to be many ways to program the device. Here I have
investigated two ways of programming the PIC18F252.
2. In-Circuit Serial Programming™
The Microchip document Programming
the PIC18FXX2/FXX8, describes programming either the high or the low voltage
In-Circuit Serial Programming™ (ICSP™). This document, 39576a.pdf, is available
from the Microchip web site.
Figure 1. High
Voltage In-Circuit Serial Programming™
Data is clocked with a 10MHz clock maximum, into the PIC, in multiple 20 bit
instructions, made up of 4 bits of command, and 16 bits of operand. Between each
command and operand is a gap of 20ns and between each block of 20 bits is a gap
of 20ns. The operand can contain the word of data payload to be programmed. This
might mean the PIC18F252 could be programmed in about 33ms, but it is doubtful
that a parallel port on a PC could support that throughput.
3. Serial Port Bootloader
Further investigation into the contents of a "blank", as shipped, PIC18F252
revealed a program residing from 0000 - 01BF. This code is a serial port
bootloader and if allowance for this code is made, then the device can be
programmed via a COM port on a PC. The listing for the code is here. I
disassembled the object code after reading the PIC18F252 with my PICstart®Plus
development system, and comparing the code with that shown in AN851, A FLASH
Bootloader for the PIC16 & PIC18. To handle the PIC18F252, the PICstart®Plus
needed to be upgraded from 1v5 to 3v0 firmware after obtaining a PIC17C44 from
the local supplier.
Figure 2. Serial
Port Bootloader Schematic
This circuit uses the MAX232A from Maxim
Integrated Products. This is required for level shifting from unipolar to
bipolar levels, and data inversion.
Functional Block Diagram of MAX232
Data is framed on a standard asynchronous octet that has its baud rate
determined on the first character sent to the firmware after a reset to the
PIC18F252. The recommended baud rate from AN851, the application note titled, A
FLASH Bootloader for the PIC16 and PIC18 devices, 000851a.pdf, on page 4, is
9600 baud. This might mean the device could take about 34 seconds to program.
The application note is available from the Microchip web site.
Reference Documents from Microchip
||2 Jun 97
||A PC-Based Development Programmer for the PIC16C84|
||12 Mar 02
||Implementing a bootloader for the PIC16F87x|
||15 Oct 01
||Implementing Bootloader firmware for the PIC18C601/801 ROMless
||A FLASH Bootloader for PIC16 and PIC18 Devices|
||29 Jun 01
||PIC18FXX2 28/40-pin High Performance, Enhanced FLASH Microcontrollers
with 10-Bit A/D|
||22 Aug 01
||Programming for PIC18FXX2/FXX8 FLASH MCUs|
||14 Feb 02
||How to Implement ICSP Using PIC16F8X FLASH MCUs|
||12 Oct 99
||Downloading HEX files to External FLASH Memory Using PIC17CXXX
||12 Oct 98
||Downloading HEX files to PICF87X PICmicro|
Copyright © 2002 Alan Judson. All Rights Reserved.
||Issue 1, 29 September, 2002
||Page 1 of 1 |