English
Language : 

PIC32MX795F512L-80IPT Datasheet, PDF (25/68 Pages) Microchip Technology – PIC32 Flash Programming Specification
11.0 DOWNLOADING THE
PROGRAMMING EXECUTIVE
(PE)
The PE resides in RAM memory and is executed by the
CPU to program the device. The PE provides the
mechanism for the programmer to program and verify
PIC32 devices using a simple command set and
communication protocol. There are several basic
functions provided by the PE:
• Read memory
• Erase memory
• Program memory
• Blank check
• Read executive firmware revision
• Get the Cyclic Redundancy Check (CRC) of Flash
memory locations
The PE performs the low-level tasks required for
programming and verifying a device. This allows the
programmer to program the device by issuing the
appropriate commands and data. A detailed
description for each command is provided in
Section 16.2 “The PE Command Set”.
The PE uses the device’s data RAM for variable
storage and program execution. After the PE has run,
no assumptions should be made about the contents of
data RAM.
After the PE is loaded into the data RAM, the PIC32
family can be programmed using the command set
shown in Table 16-1.
FIGURE 11-1:
DOWNLOADING THE PE
Write the PE Loader to RAM
Load the PE
Loading the PE in the memory is a two step process:
1. Load the PE loader in the data RAM. (The PE
loader loads the PE binary file in the proper loca-
tion of the data RAM, and when done, jumps to
the programming exec and starts executing it.)
2. Feed the PE binary to the PE loader.
 2007-2013 Microchip Technology Inc.
PIC32
Table 11-1 lists the steps that are required to download
the PE.
TABLE 11-1: DOWNLOAD THE
PE
Operation
Operand
Step 1: Initialize BMXCON to 0x1F0040. The instruction
sequence executed by the PIC32 core is:
lui a0,0xbf88
ori a0,a0,0x2000 /* address of BMXCON */
lui a1,0x1f
ori a1,a1,0x40 /* $a1 has 0x1f0040 */
sw a1,0(a0)
/* BMXCON initialized */
XferInstruction 0x3c04bf88
XferInstruction 0x34842000
XferInstruction 0x3c05001f
XferInstruction 0x34a50040
XferInstruction 0xac850000
Step 2: Initialize BMXDKPBA to 0x800. The instruction
sequence executed by the PIC32 core is:
li a1,0x800
sw a1,16(a0)
XferInstruction 0x34050800
XferInstruction 0xac850010
Step 3: Initialize BMXDUDBA and BMXDUPBA to the
value of BMXDRMSZ. The instruction sequence
executed by the PIC32 core is:
lw a1,64(a0)
/* load BMXDMSZ */
sw a1,32(a0)
sw a1,48(a0)
XferInstruction 0x8C850040
XferInstruction 0xac850020
XferInstruction 0xac850030
Step 4: Set up PIC32 RAM address for PE. The instruc-
tion sequence executed by the PIC32 core is:
lui a0,0xa000
ori a0,a0,0x800
XferInstruction 0x3c04a000
XferInstruction 0x34840800
Step 5:
lui
ori
sw
addiu
Load the PE_Loader. Repeat this step (Step 5)
until the entire PE_Loader is loaded in the PIC32
memory. In the operands field, “<PE_loader
hi++>” represents the MSbs 31 through 16 of the
PE loader op codes shown in Table 11-2. Like-
wise, “<PE_loader lo++>” represents the LSbs
15 through 0 of the PE loader op codes shown in
Table 11-2. The “++” sign indicates that when
these operations are performed in succession,
the new word is to be transferred from the list of
op codes of the LPE Loader shown in Table 11-2.
The instruction sequence executed by the PIC32
core is:
a2, <PE_loader hi++>
a0,a0, <PE_loader lo++>
a2,0(a0)
a0,a0,4
XferInstruction (0x3c06 <PE_loader hi++> )
XferInstruction (0x34c6 <PE_loader lo++> )
XferInstruction 0xac860000
XferInstruction 0x24840004
DS61145L-page 25