61145L
61145L
61145L
DEVICE OVERVIEW
FIGURE 2-1:
PROGRAMMING SYSTEM
SETUP
Target PIC32 Device
External
Programmer
CPU
On-Chip Memory
2.1
Self-programming
External tool programming
2.0
PROGRAMMING OVERVIEW
DS61145L-page 1
PIC32
2.2
Programming Interfaces
2.3
2.4
Data Sizes
Section 3.0 Programming Steps describes highlevel programming steps, followed by a brief
explanation of each step. Detailed explanations are
available in corresponding sections of this document.
More information on programming commands, EJTAG,
and DC specifications are available in the following
sections:
Section 18.0 Configuration Memory and
Device ID
Section 19.0 TAP Controllers
Section 20.0 AC/DC Characteristics and
Timing Requirements
DS61145L-page 2
PIC32
3.0
PROGRAMMING STEPS
FIGURE 3-1:
PROGRAMMING FLOW
2.
Start
Note:
3.
Erase Device
4.
Download the PE
(Optional)
Done
No
Yes
Note:
Verify Device
See
Section 11.0
Downloading
the
Programming Executive (PE) for more
information.
Done
DS61145L-page 3
PIC32
7.
8.
9.
DS61145L-page 4
Programming
PIC32
4.0
FIGURE 4-1:
2-wire
ICSP
Programmer
4-wire Interface
4.1.1
PROGRAMMING
INTERFACES
PIC32
OR
4.1
4-wire
JTAG
4.1.2
4.1.3
4.1.4
TABLE 4-1:
Pin Type
Pin Description
MCLR
I
Programming Enable
ENVREG(2)
I
Enable for On-Chip Voltage Regulator
P
Power Supply
VDD and AVDD(1)
P
Ground
VSS and AVSS(1)
VCAP
P
CPU logic filter capacitor connection
TDI
I
Test Data In
TDO
O
Test Data Out
TCK
I
Test Clock
TMS
I
Test Mode State
Legend: I = Input
O = Output
P = Power
Note 1: All power supply and ground pins must be connected, including analog supplies (AVDD) and ground
(AVSS).
2: The ENVREG pin is not available on all devices. Please refer to the Pin Diagrams section in the
specific device data sheet to determine availability.
DS61145L-page 5
PIC32
4.2
2-wire Interface
4.2.1
TABLE 4-2:
Device
Pin Name
4.2.2
Pin Type
Pin Description
MCLR
MCLR
P
Programming Enable
N/A
I
Enable for On-Chip Voltage Regulator
ENVREG(2)
VDD and AVDD(1) VDD
P
Power Supply
P
Ground
VSS and AVSS(1) VSS
N/A
P
CPU logic filter capacitor connection
VCAP
PGEC1
PGEC
I
Primary Programming Pin Pair: Serial Clock
PGED1
PGED
I/O
Primary Programming Pin Pair: Serial Data
PGEC2
PGEC
I
Secondary Programming Pin Pair: Serial Clock
PGED2
PGED
I/O
Secondary Programming Pin Pair: Serial Data
Legend: I = Input
O = Output
P = Power
Note 1: All power supply and ground pins must be connected, including analog supplies (AVDD) and ground (AVSS).
2: The ENVREG pin is not available on all devices. Please refer to either the Pin Diagrams or Pin
Tables section in the specific device data sheet to determine availability.
DS61145L-page 6
PIC32
4.3
Power Requirements
FIGURE 4-2:
INTERNAL REGULATOR
ENABLE/DISABLE
OPTIONS
Regulator Enabled(2)
(ENVREG tied to VDD)
3.3V
PIC32
VDD
ENVREG
VCAP
CEFC
(10 F typical)
VSS
Regulator Disabled(2)
(ENVREG tied to ground)
1.8V(1)
3.3V(1)
PIC32
VDD
ENVREG
VCAP
VSS
Note 1:
2:
DS61145L-page 7
PIC32
5.0
FIGURE 5-1:
TAP CONTROLLER
Tap Controller
TMS
TCK
TDO
TDI
Instruction, Data and Control Registers
DS61145L-page 8
PIC32
5.1
Programming Interface
FIGURE 5-2:
TMS
TCK
Common
ETAP
VDD
CPU
TDI
TDO
VSS
MTAP
Flash
Controller
MCLR
or
PGECx
PGEDx
5.1.1
2-wire
to
4-wire
ETAP
Flash
Memory
5.1.4
CPU
5.1.2
5.1.5
MTAP
5.1.3
2-WIRE TO 4-WIRE
FLASH CONTROLLER
5.1.6
FLASH MEMORY
DS61145L-page 9
PIC32
TABLE 5-1:
PIC32 Device
PIC32MX110F016B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX110F016C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX110F016D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX210F016B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX210F016C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX210F016D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX120F032B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX120F032C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX120F032D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX220F032B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX220F032C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX220F032D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX320F032H
128
1024
PIC32MX420F032H
128
1024
PIC32MX130F064B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX130F064C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX130F064D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX230F064B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX230F064C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX230F064D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX320F064H
128
1024
PIC32MX330F064H
128
1024
PIC32MX430F064H
128
1024
PIC32MX534F064H
128
1024
PIC32MX564F064H
128
1024
PIC32MX664F064H
128
1024
PIC32MX330F064L
128
1024
PIC32MX430F064L
128
1024
PIC32MX534F064L
128
1024
PIC32MX564F064L
128
1024
PIC32MX664F064L
128
1024
PIC32MX150F128B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX150F128C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX150F128D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX250F128B
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX250F128C
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX250F128D
32
256
0x1FC00000-0x1FC00BFF (3 KB)
PIC32MX320F128H
128
1024
PIC32MX340F128H
128
1024
PIC32MX350F128H
128
1024
PIC32MX440F128H
128
1024
PIC32MX450F128H
128
1024
PIC32MX564F128H
128
1024
PIC32MX664F128H
128
1024
PIC32MX764F128H
128
1024
PIC32MX320F128L
128
1024
PIC32MX340F128L
128
1024
DS61145L-page 10
PIC32
TABLE 5-1:
PIC32 Device
PIC32MX350F128L
128
1024
PIC32MX440F128L
128
1024
PIC32MX450F128L
128
1024
PIC32MX564F128L
128
1024
PIC32MX664F128L
128
1024
PIC32MX764F128L
128
1024
PIC32MX340F256H
128
1024
PIC32MX350F256H
128
1024
PIC32MX440F256H
128
1024
PIC32MX450F256H
128
1024
PIC32MX575F256H
128
1024
PIC32MX675F256H
128
1024
PIC32MX775F256H
128
1024
PIC32MX350F256L
128
1024
PIC32MX360F256L
128
1024
PIC32MX450F256L
128
1024
PIC32MX460F256L
128
1024
PIC32MX575F256L
128
1024
PIC32MX675F256L
128
1024
PIC32MX775F256L
128
1024
PIC32MX340F512H
128
1024
PIC32MX360F512H
128
1024
PIC32MX370F512H
128
1024
PIC32MX440F512H
128
1024
PIC32MX470F512H
128
1024
PIC32MX575F512H
128
1024
PIC32MX675F512H
128
1024
PIC32MX695F512H
128
1024
PIC32MX775F512H
128
1024
PIC32MX795F512H
128
1024
PIC32MX360F512L
128
1024
PIC32MX370F512L
128
1024
PIC32MX460F512L
128
1024
PIC32MX470F512L
128
1024
PIC32MX575F512L
128
1024
PIC32MX675F512L
128
1024
PIC32MX695F512L
128
1024
PIC32MX775F512L
128
1024
PIC32MX795F512L
128
1024
PIC32MZ0256ECE064
512
4096
PIC32MZ0256ECE100
512
4096
PIC32MZ0256ECE124
512
4096
PIC32MZ0256ECE144
512
4096
PIC32MZ0256ECF064
512
4096
PIC32MZ0256ECF100
512
4096
PIC32MZ0256ECF124
512
4096
PIC32MZ0256ECF144
512
4096
DS61145L-page 11
PIC32
TABLE 5-1:
PIC32 Device
PIC32MZ0512ECE064
512
4096
PIC32MZ0512ECE100
512
4096
PIC32MZ0512ECE124
512
4096
PIC32MZ0512ECE144
512
4096
PIC32MZ0512ECF064
512
4096
PIC32MZ0512ECF100
512
4096
PIC32MZ0512ECF124
512
4096
PIC32MZ0512ECF144
512
4096
PIC32MZ1024ECE064
512
4096
PIC32MZ1024ECE100
512
4096
PIC32MZ1024ECE124
512
4096
PIC32MZ1024ECE144
512
4096
PIC32MZ1024ECF064
512
4096
PIC32MZ1024ECF100
512
4096
PIC32MZ1024ECF124
512
4096
PIC32MZ1024ECF144
512
4096
PIC32MZ1024ECG064
512
4096
PIC32MZ1024ECG100
512
4096
PIC32MZ1024ECG124
512
4096
PIC32MZ1024ECG144
512
4096
PIC32MZ1024ECH064
512
4096
PIC32MZ1024ECH100
512
4096
PIC32MZ1024ECH124
512
4096
PIC32MZ1024ECH144
512
4096
PIC32MZ2048ECG064
512
4096
PIC32MZ2048ECG100
512
4096
PIC32MZ2048ECG124
512
4096
PIC32MZ2048ECG144
512
4096
PIC32MZ2048ECH064
512
4096
PIC32MZ2048ECH100
512
4096
PIC32MZ2048ECH124
512
4096
PIC32MZ2048ECH144
512
4096
DS61145L-page 12
PIC32
5.2
FIGURE 5-3:
TCK
TMS
TDI
iLSb
iMSb
TDO
oLSb
oMSb
DS61145L-page 13
PIC32
5.3
5.3.2
5.3.1
4-PHASE ICSP
FIGURE 5-4:
2-PHASE ICSP
Note:
2-WIRE, 4-PHASE
TCK
TMS
TDI
IR0
IR4
TDO
PGECx
PGEDx
FIGURE 5-5:
pTDO = 1
TMS = 0
TDI = IR0
nTDO = 0
2-WIRE, 2-PHASE
TCK
TMS
TDI
IR0
IR4
TDO
PGECx
PGEDx
DS61145L-page 14
TDI = IR0
TMS = 0
PIC32
6.0
PSEUDO OPERATIONS
6.1
Format:
SetMode (mode)
Restrictions:
None.
Purpose:
To set the EJTAG state machine to a specific state.
Description:
The value of mode is clocked into the device on
signal TMS. TDI is set to a 0 and TDO is ignored.
Example:
SetMode (6b011111)
SetMode (mode)
SendCommand (command)
oData = XferData (iData)
oData = XferFastData (iData)
oData = XferInstruction (instruction)
FIGURE 6-1:
SetMode 4-WIRE
Mode = 6b011111
TCK
TMS
TDI
TDO
FIGURE 6-2:
SetMode 2-WIRE
Mode = 6b011111
PGECx
PGEDx
TDI = 0
TMS = 1
TDO = 1
TDI = 0
TMS = 0
TDO = x
DS61145L-page 15
PIC32
6.2
Format:
SendCommand (command)
Purpose:
To send a command to select a specific TAP register.
Description (in sequence):
1.
2.
3.
4.
Restrictions:
None.
Example:
SendCommand (5h0x07)
FIGURE 6-3:
SendCommand 4-WIRE
TMS Header = 1100
Command = 5h0x07
Command (MSb)
+ TMS = 1
TMS Footer = 10
TCK
TMS
TDI
FIGURE 6-4:
iMSb
iLSb
TDO
TMS Footer = 10
PGECx
PGEDx
TDI = 0
TMS = 1
DS61145L-page 16
TDO = x
TDO = x
TDO = x
TDI = 0
TMS = 1
TDO = x
PIC32
6.3
Format:
oData = XferData (iData)
Purpose:
To clock data to and from the register selected by the
command.
Description (in sequence):
1. The TMS Header is clocked into the device to
select the Shift DR state.
2. The data is clocked in/out of the device on
TDI/TDO while holding signal TMS low.
3. The last MSb of the data is clocked in/out
while setting TMS high.
4. The TMS Footer is clocked in on TMS to return
the TAP controller to the Run/Test Idle state.
Restrictions:
None.
Example:
oData = XferData (32h0x12)
FIGURE 6-5:
XferData 4-WIRE
TMS Header = 100
TMS Footer = 10
TCK
TMS
TDI
iLSb
iMSb
TDO
oLSb
oMSb
FIGURE 6-6:
PGEC
PGED
TDI = 0 TMS = 1
TDO = X
TDI = 0
TMS = 0
TDI = 0
TDO = X
TMS = 0
TDO = oLSb
TDO =...
oLSb+1
TDO = X
TMS Footer = 10
TDI = 0 TMS = 1
TDO = X
TDI = 0
TMS = 0
TDO = X
DS61145L-page 17
PIC32
6.4
Restrictions:
The SendCommand (ETAP_FASTDATA) must be sent
first to select the Fastdata register, as shown in
Example 6-1. See Table 19-4 for a detailed descriptions
of commands.
Format:
oData = XferFastData (iData)
Purpose:
To quickly send 32 bits of data in/out of the device.
Note:
2.
EXAMPLE 6-1:
SendCommand
3.
FIGURE 6-7:
XferFastData 4-WIRE
PrAcc
Data (32h0x12)
TMS Footer = 10
TCK
TMS
TDI
iLSb
iMSb
TDO
oLSb
oMSb
FIGURE 6-8:
PrAcc
Data (32h0x12)
TMS Footer = 10
PGECx
PGEDx
TDI = X TMS = 1
DS61145L-page 18
TMS = 0
TDI =
MSb
PIC32
FIGURE 6-9:
PGECx
PGEDx
TDI = 0 TMS = 1
TDO = X
TDI = 0 TMS = 0
TMS = 0
TDI = 0
PrAcc
TDI = 0
TDO = X
TDO = oLSb
TDO = oLSb+1
TMS = 0
TDO = oPrAcc
TDI = iMSb
TMS = 1
TDO = X
TMS Footer = 10
TDI = 0 TMS = 1
TDO = X
TDI = 0
TMS = 0
TDO = X
DS61145L-page 19
PIC32
6.5
XferInstruction Pseudo
Operation
Format:
XferInstruction (instruction)
Purpose:
To send 32 bits of data for the device to execute.
Description:
The instruction is clocked into the device and then
executed by CPU.
Restrictions:
The device must be in Debug mode.
EXAMPLE 6-2:
XferInstruction
XferInstruction (instruction)
{
// Select Control Register
SendCommand(ETAP_CONTROL);
// Wait until CPU is ready
// Check if Processor Access bit (bit 18) is set
do {
controlVal = XferData(32h0x0004C000);
} while( PrAcc(contorlVal<18>) is not 1 );
// Select Data Register
SendCommand(ETAP_DATA);
// Send the instruction
XferData(instruction);
// Tell CPU to execute instruction
SendCommand(ETAP_CONTROL);
XferData(32h0x0000C000);
}
DS61145L-page 20
PIC32
7.0
To use the 2-wire PGEDx and PGECx pins for programming, they must be enabled. Note that any pair of
programming pins available on a particular device may
be used, however, they must be used as a pair. PGED1
must be used with PGEC1, and so on.
Note:
FIGURE 7-1:
P6
P14
MCLR
P19
P7
VIH
VIH
VDD
Program/Verify Entry Code = 0x4D434850
0
b31
PGEDx
1
b30
0
b29
0
b28
1
...
b27
0
b3
0
b2
0
b1
0
b0
PGECx
P18
P1A
P1B
DS61145L-page 21
PIC32
8.0
FIGURE 8-1:
8.1
4-wire Interface
4-wire
SetMode (6b011111)
1.
2.
3.
4.
5.
6.
Note:
SendCommand (MTAP_SW_MTAP)
SendCommand (MTAP_COMMAND)
No
FCBUSY = 0
CFGRDY = 1
Yes
Done
8.2
2-wire Interface
DS61145L-page 22
PIC32
9.0
The Device ID memory locations are readonly and cannot be erased. Therefore,
Chip Erase has no effect on these memory
locations.
FIGURE 9-1:
ERASE DEVICE
Select MTAP
SendCommand (MTAP_SW_MTAP)
1.
2.
3.
4.
5.
6.
Note:
9.1
Blank Check
1 millisecond Delay
No
FCBUSY = 0
CFGRDY = 1
Yes
Done
DS61145L-page 23
PIC32
10.0
ENTERING SERIAL
EXECUTION MODE
10.1
FIGURE 10-1:
ENTERING SERIAL
EXECUTION MODE
Select MTAP
Cannot Enter
Must Erase First
Yes
Assert Reset
XferData (MCHP_ASSERT_RST)
2-wire
Select ETAP
SendCommand (MTAP_SW_ETAP)
Select MTAP
SendCommand (MTAP_SW_MTAP)
1.
2.
3.
4.
SendCommand (MTAP_SW_MTAP).
SendCommand (MTAP_COMMAND).
statusVal = XferData (MCHP_STATUS).
If CPS (statusVal<7>) is not 1, the device must
be erased first.
SendCommand (MTAP_SW_ETAP).
SendCommand (ETAP_EJTAGBOOT).
Set MCLR high.
2-wire Interface
No
Note:
10.2
CPS = 1
5.
6.
7.
SendCommand (MTAP_SW_MTAP)
4-wire Interface
SendCommand (MTAP_SW_MTAP).
SendCommand (MTAP_COMMAND).
statusVal = XferData (MCHP_STATUS).
If CPS (statusVal<7>) is not 1, the device must
be erased first.
5. XferData (MCHP_ASSERT_RST).
6. SendCommand (MTAP_SW_ETAP).
7. SendCommand (ETAP_EJTAGBOOT).
8. SendCommand (MTAP_SW_MTAP).
9. SendCommand (MTAP_COMMAND).
10. XferData (MCHP_DE_ASSERT_RST).
11. XferData (MCHP_FLASH_ENABLE) This step is
not required for PIC32MZ EC family devices.
12. SendCommand (MTAP_SW_ETAP).
1.
2.
3.
4.
Release Reset
XferData (MCHP_DE_ASSERT_RST)
Enable Flash
XferData (MCHP_FLASH_EN)
Not required for PIC32MZ EC devices
Select ETAP
SendCommand (MCHP_SW_ETAP)
2-wire
DS61145L-page 24
PIC32
11.0
DOWNLOADING THE
PROGRAMMING EXECUTIVE
(PE)
Read memory
Erase memory
Program memory
Blank check
Read executive firmware revision
Get the Cyclic Redundancy Check (CRC) of Flash
memory locations
FIGURE 11-1:
DOWNLOADING THE PE
TABLE 11-1:
DOWNLOAD THE
PE
Operation
Operand
Step 1:
lui
ori
lui
ori
sw
XferInstruction 0x3c04bf88
XferInstruction 0x34842000
XferInstruction 0x3c05001f
XferInstruction 0x34a50040
XferInstruction 0xac850000
Step 2:
li
sw
XferInstruction 0x34050800
XferInstruction 0xac850010
Step 3:
lw
sw
sw
XferInstruction 0x8C850040
XferInstruction 0xac850020
XferInstruction 0xac850030
Step 4:
Set up PIC32 RAM address for PE. The instruction sequence executed by the PIC32 core is:
lui a0,0xa000
ori a0,a0,0x800
XferInstruction 0x3c04a000
XferInstruction 0x34840800
Step 5:
Load the PE
2.
lui
ori
sw
addiu
DS61145L-page 25
PIC32
TABLE 11-1:
DOWNLOAD THE
PE (CONTINUED)
Operation
Step 6:
lui
ori
jr
nop
Operand
TABLE 11-2:
PE LOADER OP CODES
Op code
Instruction
0x3c07dead
lui
a3, 0xdead
0x3c06ff20
lui
a2, 0xff20
0x3c05ff20
lui
al, 0xff20
herel:
0x8cc40000
lw
XferInstruction 0x3c19a000
0x8cc30000
lw
v1, 0 (a2)
XferInstruction 0x37390800
0x1067000b
beq
XferInstruction 0x03200008
0x00000000
nop
XferInstruction 0x00000000
0x1060fffb
beqz
Step 7:
0x00000000
nop
0x8ca20000
lw
v0, 0 (a1)
0x2463ffff
addiu
v1, v1, -1
0xac820000
sw
v0, 0 (a0)
0x24840004
addiu
a0, a0, 4
0x1460fffb
bnez
v1, <here2>
0x00000000
nop
0x1000fff3
0x00000000
nop
0x3c02a000
lui
v0, 0xa000
0x34420900
ori
0x00400008
jr
v0
0x00000000
nop
SendCommand
ETAP_FASTDATA
XferFastData
PE_ADDRESS (Address of PE
program block from PE Hex
file)
XferFastData
XferFastData
Step 8:
a0, 0 (a2)
v1, <here1>
here2:
<here1>
here3:
XferFastData
0x00000000
XferFastData
0xDEAD0000
DS61145L-page 26
PIC32
12.0
DOWNLOADING A DATA
BLOCK
12.1
Without the PE
FIGURE 12-1:
DOWNLOADING DATA
WITHOUT THE PE
TABLE 12-1:
Op code
Step 1:
Step 3:
12.2
Write 32-bit Immediate
Data to bufAddr
Increment bufAddr
lui
$s0, 0xA000;
3c08<DATA>
3508<DATA>
ae08<OFFSET>
Instruction
3c10a000
Step 2:
DOWNLOAD DATA OP
CODES
lui
ori
sw
$t0, <DATA(31:16)>;
$t0, <DATA(15:0)>;
$t0, <OFFSET>($s0);
// OFFSET increments by 4
With the PE
When using the PE the steps in Section 12.0 Downloading a Data Block and Section 13.0 Initiating a
Flash Row Write are handled in two single commands:
ROW_PROGRAM and PROGRAM.
The ROW_PROGRAM command programs a single row of
Flash data, while the PROGRAM command programs
multiple rows of Flash data. Both of these commands
are documented in Section 16.0 The Programming
Executive.
No
Done
DS61145L-page 27
PIC32
13.0
Note:
13.1
With the PE
13.2
Without the PE
FIGURE 13-1:
Start Operation
Done
DS61145L-page 28
PIC32
The following steps are required to initiate a Flash
write:
1.
2.
TABLE 13-1:
Op Code
Step 1:
lui a0,0xbf80
ori a0,a0,0x0600
ori s3,$0,0x8080
sw s1,16(a0)
sw s2,16(a0)
sw s3,144(a0)
nop
3c08<ADDR>
3508<ADDR>
ac880020
Step 5:
lui a0,0xbf80
ori a0,a0,0xf400
AC910010
AC920010
AC950090
00000000
Step 4:
a1,$0,0x4003
a2,$0,0x8000
a3,$0,0x4000
s1,0xaa99
s1,s1,0x6655
s2,0x5566
s2,s2,0x99aa
s0,0x0000
3c04bf80
34840600
34158080
Step 3:
ori
ori
ori
lui
ori
lui
ori
lui
3c04bf80
3484f400
Step 2:
Instruction
34054003
34068000
34074000
3c11aa99
36316655
3c125566
365299aa
3c100000
Step 2:
lui t0,<FLASH_ROW_ADDR(31:16)>
ori t0,t0,<FLASH_ROW_ADDR(15:0)>
sw t0,32(a0)
3610<ADDR>
ac900040
ori s0,s0,<RAM_ADDR(15:0)>
sw s0,64(a0)
TABLE 13-1:
Op Code
Step 5:
here1:
lw t0,0(a0)
andi t0,t0,0x0800
bne t0,$0,here1
nop
ac910010
ac920010
ac860008
Step 9:
sw a1,0(a0)
delay (6 s)
8C880000
31080800
1500fffd
00000000
Step 8:
ori s0,s0,<RAM_ADDR(15:0)>
sw s0,112(a0)
ac850000
Step 7:
Instruction
3610<ADDR>
ac900040
Step 6:
sw s1,16(a0)
sw s2,16(a0)
sw a2,8(a0)
8c880000
01064024
1500fffd
00000000
here2:
lw t0,0(a0)
and t0,t0,a2
bne t0,$0,here2
nop
nop
nop
nop
nop
sw a3,4(a0)
DS61145L-page 29
PIC32
14.0
14.1
14.2
FIGURE 14-2:
VERIFYING MEMORY
WITHOUT THE PE
FIGURE 14-1:
VERIFYING MEMORY
WITH THE PE
No
Done
1.
2.
3.
XferFastData (GET_CRC).
XferFastData (start_Address).
XferFastData (length).
valCkSum = XferFastData (32h0x00).
4.
TABLE 14-1:
Op code
Step 1:
3c13ff20
Step 2:
lui $t0,<FLASH_WORD_ADDR(31:16)>
ori $t0,<FLASH_WORD_ADDR(15:0)>
8d090000
ae690000
DS61145L-page 30
3c08<ADDR>
3508<ADDR>
Step 3:
lw $t1, 0($t0)
sw $t1, 0($s3)
Step 4:
Step 5:
PIC32
15.0
EXITING PROGRAMMING
MODE
15.1
4-wire Interface
15.2
FIGURE 15-2:
FIGURE 15-1:
2-wire Interface
2-WIRE EXIT
PROGRAMMING MODE
P16
P17
VIH
MCLR
VDD
4-WIRE EXIT
PROGRAMMING MODE
PGEDx
P16
VIH
PGECx
MCLR
PGEDx = Input
VDD
TCK
TMS
TDI
TDO
1.
2.
3.
4.
SetMode (5b11111).
Assert MCLR.
Issue a clock pulse on PGECx.
Remove power (if the device is powered).
SetMode (5b11111).
Assert MCLR.
Remove power (if the device is powered).
DS61145L-page 31
PIC32
16.0
THE PROGRAMMING
EXECUTIVE
16.1
PE Communication
16.1.1
16.1.2
COMMUNICATION OVERVIEW
EXAMPLE 16-1:
TABLE 16-1:
COMMUNICATION
SEQUENCE FOR THE PE
Operation
Step 1:
Operand
XferFastData
XferFastData..
optional data..
Step 2:
DS61145L-page 32
GetPEResponse EXAMPLE
WORD GetPEResponse()
{
WORD response;
GetPEResponse
response
GetPEResponse...
response...
PIC32
16.2
16.2.1
COMMAND FORMAT
Some commands have no Operand information, however, the Operand field must
be sent and the programming executive
will ignore the data.
TABLE 16-2:
Op code
FIGURE 16-1:
COMMAND FORMAT
31
16
Op code
15
0
Operand (optional)
31
16
Command Data High (if required)
15
0
Command Data Low (if required)
PE COMMAND SET
Mnemonic
Description
0x0
ROW_PROGRAM(1)
0x1
READ
Read N 32-bit words of memory starting from the specified address (N < 65,536).
0x2
PROGRAM
0x3
WORD_PROGRAM
0x4
CHIP_ERASE
0x5
PAGE_ERASE
0x6
BLANK_CHECK
0x7
EXEC_VERSION
0x8
GET_CRC
0x9
PROGRAM_CLUSTER
0xA
GET_DEVICEID
0xB
CHANGE_CFG
(2)
0xC
GET_CHECKSUM
0xD
QUAD_WORD_PGRM
Used by the probe to set various configuration settings for the PE.
Get the checksum of Flash memory.
(4)
Note 1: Refer to Table 5-1 for the row size for each device.
2: This command is not available in PIC32MX1XX/2XX devices.
3: On the PIC32MZ EC family devices, which incorporate ECC, the WORD_PROGRAM command will not
generate the ECC parity bits. Reading a location programmed with the WORD_PROGRAM command with
ECC enabled will cause a DED fault.
4: This command is available on PIC32MZ EC family devices only.
DS61145L-page 33
PIC32
16.2.2
RESPONSE FORMAT
16.2.3
FIGURE 16-2:
RESPONSE FORMAT
31
16
ROW_PROGRAM COMMAND
Last Command
15
Operand
31
31
16
16
Data_High_N
15
Addr_High
15
0
Data_Low_N
Addr_Low
31
16
Data_High_1
Last_Cmd Field
15
0
Data_Low_1
31
16
Data_High_N
15
Response Code
Data_Low_N
TABLE 16-3:
RESPONSE VALUES
Mnemonic
0x0
PASS
0x2
FAIL
0x3
NACK
16.2.2.3
0
Data_Low_1
Op code
Op code
15
15
16.2.2.2
16
16
Data_High_1
16.2.2.1
ROW_PROGRAM COMMAND
31
Response Code
31
FIGURE 16-3:
Description
Command successfully
processed
Command unsuccessfully
processed
Command not known
Optional Data
TABLE 16-4:
ROW_PROGRAM FORMAT
Field
Description
Op code
0x0
Operand
Not used
Addr_High
Addr_Low
FIGURE 16-4:
ROW_PROGRAM RESPONSE
31
16
Last Command
15
0
Response Code
DS61145L-page 34
PIC32
16.2.4
READ COMMAND
FIGURE 16-5:
READ COMMAND
31
16
Op code
15
0
Operand
31
16
Addr_High
15
0
Addr_Low
TABLE 16-5:
READ FORMAT
Field
Description
Op code
0x1
Operand
Addr_Low
Addr_High
Expected Response:
FIGURE 16-6:
READ RESPONSE
31
16
Last Command
15
0
Response Code
31
16
Data_High_1
15
0
Data_Low_1
31
16
Data_High_N
15
0
Data_Low_N
Note:
DS61145L-page 35
PIC32
16.2.5
PROGRAM COMMAND
PROGRAM COMMAND
FIGURE 16-7:
31
16
Op code
15
0
Operand
31
16
Addr_High
15
0
Addr_Low
31
16
Length_High
15
0
Length_Low
31
16
Data_High_1
15
0
Data_Low_1
31
1.
2.
3.
16
Data_High_N
15
0
Data_Low_N
PROGRAM FORMAT
TABLE 16-6:
Field
Description
Op code
0x2
Operand
Not used
Addr_Low
Addr_High
Length_Low
Length_High
Data_Low_N
Data_High_N
FIGURE 16-8:
PROGRAM RESPONSE
31
16
0
Response Code
DS61145L-page 36
PIC32
FIGURE 16-9:
Data is
equal to a
single row
Data is
equal to
two rows
Data
is larger than
two rows
Receive status
(LSB 16 bits of
Destination Address
Status Value)
Receive status
for Row 1
Receive status
for Row 1
Receive status
for Row 2
Receive status
for Row 2
Receive status
for Row N-1
Receive status
for Row N
Done
DS61145L-page 37
PIC32
16.2.6
WORD_PROGRAM COMMAND
16.2.7
CHIP_ERASE COMMAND
FIGURE 16-10:
WORD_PROGRAM
COMMAND
31
16
Op code
15
0
Operand
31
16
FIGURE 16-12:
CHIP_ERASE COMMAND
31
16
Op code
15
0
Operand
Addr_High
15
TABLE 16-8:
Addr_Low
31
Field
16
Data_High
15
0
Data_Low
TABLE 16-7:
WORD_PROGRAM FORMAT
Field
Description
Op code
0x3
Operand
Not used
CHIP_ERASE FORMAT
Description
Op code
0x4
Operand
Not used
Addr_Low
Addr_High
FIGURE 16-13:
Addr_High
31
Addr_Low
15
Data_High
Data_Low
CHIP_ERASE RESPONSE
16
Last Command
0
Response Code
FIGURE 16-11:
WORD_PROGRAM
RESPONSE
31
16
Last Command
15
0
Response Code
DS61145L-page 38
PIC32
16.2.8
PAGE_ERASE COMMAND
16.2.9
BLANK_CHECK COMMAND
FIGURE 16-16:
BLANK_CHECK COMMAND
31
FIGURE 16-14:
16
PAGE_ERASE COMMAND
31
Op code
16
15
31
16
15
31
Op code
15
Operand
16
Operand
31
Addr_High
0
Addr_High
15
Addr_Low
16
Addr_Low
TABLE 16-9:
Length_High
15
PAGE_ERASE FORMAT
Field
0
Length_Low
Description
Op code
0x5
Operand
Addr_Low
Op code
0x6
Addr_High
Operand
Not used
Address
Length
Field
FIGURE 16-15:
PAGE_ERASE RESPONSE
31
16
Last Command
15
Description
FIGURE 16-17:
0
BLANK_CHECK RESPONSE
31
Response Code
16
Last Command
15
0
Response Code
DS61145L-page 39
PIC32
16.2.10
EXEC_VERSION COMMAND
GET_CRC COMMAND
16.2.11
FIGURE 16-18:
EXEC_VERSION
COMMAND
31
16
Op code
15
0
Operand
CRC-CCITT, 16-bit
Polynomial: X^16+X^12+X^5+1, hex 0x00011021
Seed: 0xFFFF
Most Significant Byte (MSB) shifted in first
Note 1: In the response, only the CRC Least
Significant 16 bits are valid.
2: The PE will automatically determine if the
hardware CRC is available and use it by
default. The hardware CRC is not used
on PIC32MX1XX/2XX devices.
Description
FIGURE 16-20:
0x7
GET_CRC COMMAND
31
Not used
16
Op code
FIGURE 16-19:
15
EXEC_VERSION
RESPONSE
31
0
Operand
31
16
Addr_High
16
15
Last Command
15
0
Addr_Low
0
Version Number
31
16
Length_High
15
0
Length_Low
Description
Op code
0x8
Operand
Not used
Address
Length
FIGURE 16-21:
GET_CRC RESPONSE
31
16
Last Command
15
0
Response Code
31
16
CRC_High
15
0
CRC_Low
DS61145L-page 40
PIC32
16.2.12
PROGRAM_CLUSTER COMMAND
16.2.13
FIGURE 16-22:
PROGRAM_CLUSTER
COMMAND
31
FIGURE 16-24:
Op code
16
Op code
15
0
Operand
0
Operand
31
Addr_High
15
Field
16
Length_High
15
0
Length_Low
0xA
Operand
Not used
FIGURE 16-25:
16
Last Command
15
Description
0
Device ID
Op code
0x9
Operand
Not used
Address
Length
Note:
GET_DEVICEID
RESPONSE
31
Description
Op code
Addr_Low
31
GET_DEVICEID
COMMAND
31
16
15
GET_DEVICEID COMMAND
FIGURE 16-23:
PROGRAM_CLUSTER
RESPONSE
31
16
Last Command
15
0
Response Code
DS61145L-page 41
PIC32
16.2.14
CHANGE_CFG COMMAND
16.2.15
GET_CHECKSUM COMMAND
CHANGE_CFG is used by the probe to set various configuration settings for the PE. Currently, the single configuration setting determines which of the following
calculation methods the PE should use:
FIGURE 16-28:
CHANGE_CFG COMMAND
31
16
Op code
FIGURE 16-26:
CHANGE_CFG COMMAND
31
15
16
Op code
15
Operand
31
16
0
Operand
31
Addr_High
15
16
CRCFlag_High
15
Addr_Low
31
16
0
CRCFlag_Low
Length_High
15
0
Length_Low
Description
Op code
0xB
Operand
Not used
CRCFlag
FIGURE 16-27:
CHANGE_CFG RESPONSE
31
Op code
0x0C
Operand
Not used
Addr_High
Addr_Low
16
Length_Low
Last Command
15
Response Code
Note:
Description
FIGURE 16-29:
GET_CHECKSUM
RESPONSE
31
16
Last Command
15
0
Response Code
31
16
Checksum_High
15
0
Checksum_Low
DS61145L-page 42
PIC32
16.2.16
QUAD_WORD_PROGRAM COMMAND
FIGURE 16-30:
Field
Op code
Not used
High-order 16 bits of the 32-bit starting
address.
16
Addr_Low
Data0_High
Data0_Low
Data1_High
Data1_Low
Data2_High
Data2_Low
Data3_High
Data3_Low
Operand
31
16
Addr_High
15
0
Addr_Low
31
16
Data0_High
15
0
Data0_Low
31
16
Data1_High
15
FIGURE 16-31:
QUAD_WORD_PROGRAM
RESPONSE
31
0
Data1_Low
31
0x0C
Addr_High
Op code
15
Description
Operand
QUAD_WORD_PROGRAM
COMMAND
31
16
Last Command
15
16
0
Response Code
Data2_High
15
0
Data2_Low
31
16
Data3_High
15
0
Data3_Low
DS61145L-page 43
PIC32
17.0
CHECKSUM
17.2
17.1
Theory
REGISTER 17-1:
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
Mask Values
For example, Register 17-1 shows the DEVCFG0 register of the PIC32MX360F512L device. The mask value
for this register is:
mask_value_devcfg0 = 0x110FF00B
Table 17-1 lists the mask values of the four device Configuration registers and Device ID registers to be used
in the checksum calculations.
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
r-0
r-1
r-1
R/P-1
r-1
r-1
r-1
R/P-1
CP
BWP
r-1
r-1
r-1
r-1
R/P-1
R/P-1
R/P-1
R/P-1
PWP19
PWP18
PWP17
PWP16
R/P-1
R/P-1
R/P-1
R/P-1
r-1
r-1
r-1
r-1
PWP15
PWP14
PWP13
PWP12
R/P-1
R/P-1
r-1
r-1
r-1
r-1
R/P-1
r-1
ICESEL
Legend:
R = Readable bit
-n = Value at POR
DS61145L-page 44
P = Programmable bit
W = Writable bit
1 = Bit is set
DEBUG<1:0>
r = Reserved bit
U = Unimplemented bit, read as 0
0 = Bit is cleared
x = Bit is unknown
PIC32
TABLE 17-1:
Device
DEVCFG0
DEVCFG1
DEVCFG2
DEVCFG3
DEVID
0x1100FC1F
0x03DFF7A7
0x0070077
0xF0000000
0x0FFFFFFF
0x1100FC1F
0x03DFF7A7
0x0078777
0xF0000000
0x0FFFFFFF
0x110FF00B
0x009FF7A7
0x00070077
0x00000000
0x000FF000
0x110FF01F
0x03DFF7A7
0x00070077
0x30C70000
0x00FFFFFF
0x110FF00B
0x009FF7A7
0x00078777
0x00000000
0x000FF000
0x110FF01F
0x03DFF7A7
0x00078777
0xF0C70000
0x00FFFFFF
0x7FFFFFFF
0xFFFFFFFF
0xFFFFFFFF
0xFFFF0000
0x0FFFFFFF
PIC32MX534F064H
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x0FFFF000
PIC32MX534F064L
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x0FFFF000
PIC32MX564F064H
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x0FFFF000
PIC32MX564F064L
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x0FFFF000
PIC32MX564F128H
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x0FFFF000
PIC32MX564F128L
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x0FFFF000
PIC32MX575F256H
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x000FF000
PIC32MX575F256L
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x000FF000
PIC32MX575F512H
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x000FF000
PIC32MX575F512L
0x110FF00F
0x009FF7A7
0x00078777
0xC4070000
0x000FF000
PIC32MX664F064H
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x0FFFF000
PIC32MX664F064L
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x0FFFF000
PIC32MX664F128H
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x0FFFF000
PIC32MX664F128L
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x0FFFF000
PIC32MX675F256H
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x000FF000
PIC32MX675F256L
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x000FF000
PIC32MX675F512H
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x000FF000
PIC32MX675F512L
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x000FF000
PIC32MX695F512H
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x000FF000
PIC32MX695F512L
0x110FF00F
0x009FF7A7
0x00078777
0xC3070000
0x000FF000
PIC32MX764F128H
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x0FFFF000
PIC32MX764F128L
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x0FFFF000
PIC32MX775F256H
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x000FF000
PIC32MX775F256L
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x000FF000
PIC32MX775F512H
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x000FF000
PIC32MX775F512L
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x000FF000
PIC32MX795F512H
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x000FF000
PIC32MX795F512L
0x110FF00F
0x009FF7A7
0x00078777
0xC7070000
0x000FF000
DS61145L-page 45
PIC32
17.3
Algorithm
FIGURE 17-1:
pic32_checksum
No
Yes
Checksum (32-bit quantity) = 2s complement
of tmpChecksum
Done
DS61145L-page 46
PIC32
The formula to calculate the checksum for a PIC32
device is provided in Equation 17-1.
EQUATION 17-1:
CHECKSUM FORMULA
Checksum = 2s complement PF + BF + DCR + DIR
Where,
PF = 32-bit summation of all bytes in Program Flash
BF = 32-bit summation of all bytes in boot Flash, except device Configuration registers
3
DCR = 32-bit summation of bytes MASK DEVCFGX & DEVCFGx
X = 0
DIR = 32-bit summation of bytes MASK DEVID & DEVID
MASKDEVCFGX = mask value from Table 17-1
MASKDEVID = mask value from Table 17-1
17.4
17.4.2
To begin, each item on the right-hand side of the equation (PF, BF, DCR, DIR) is individually calculated. After
those values have been derived, the final value of the
checksum can be determined.
17.4.1
17.4.3
TABLE 17-2:
Register
Mask
DEVCFG0
0x7FFFFFFF
0x110FF00B
0x110FF00B
0x0000011B
DEVCFG1
0xFFFFFFFF
0x009FF7A7
0x009FF7A7
0x0000023D
DEVCFG2
0xFFFFFFFF
0x00070077
0x00070077
0x0000007E
DEVCFG3
0xFFFFFFFF
0x00000000
0x00000000
0x00000000
0x000003D6
DS61145L-page 47
PIC32
17.4.4
TABLE 17-3:
17.4.5
Register
Mask
32-Bit Summation of
Bytes
DEVID
0x00938053
0x000FF000
0x00038000
0x00000083
EXAMPLE 17-1:
1.
2.
3.
4.
17.4.6
DS61145L-page 48
PIC32
18.0
CONFIGURATION MEMORY
AND DEVICE ID
18.1
Device Configuration
TABLE 18-1:
DEVCFG LOCATIONS
Configuration Word
Physical Address
DEVCFG0
DEVCFG1
DEVCFG2
DEVCFG3
0x1FC02FFC
0x1FC02FF8
0x1FC02FF4
0x1FC02FF0
TABLE 18-2:
Configuration Word
Physical Address
DEVCFG0
DEVCFG1
DEVCFG2
DEVCFG3
0x1FC00BFC
0x1FC00BF8
0x1FC00BF4
0x1FC00BF0
On Power-on Reset (POR), or any reset, the Configuration Words are copied from the boot Flash memory to
their corresponding Configuration registers. A Configuration bit can only be programmed = 0 (unprogrammed
state = 1).
DS61145L-page 49
PIC32
TABLE 18-3:
Configuration Word
(see Note 1)
Fixed Boot
Region 1
Fixed Boot
Region 2
Active Boot
Alias Region
(see Note 2)
Inactive Boot
Alias Region
(see Note 2)
0x1FC4FFF0
0x1FC6FFF0
0x1FC0FFF0
0x1FC2FFF0
Code Protection
0x1FC4FFD0
0x1FC6FFD0
0x1FC0FFD0
0x1FC2FFD0
DEVCFG0
0x1FC4FFCC
0x1FC6FFCC
0x1FC0FFCC
0x1FC2FFCC
DEVCFG1
0x1FC4FFC8
0x1FC6FFC8
0x1FC0FFC8
0x1FC2FFC8
DEVCFG2
0x1FC4FFC4
0x1FC6FFC4
0x1FC0FFC4
0x1FC2FFC4
DEVCFG3
0x1FC4FFC0
0x1FC6FFC0
0x1FC0FFC0
0x1FC2FFC0
0x1FC4FF70
0x1FC6FF70
0x1FC0FF70
0x1FC2FF70
0x1FC4FF50
0x1FC6FF50
0x1FC0FF50
0x1FC2FF50
Alternate DEVCFG0
0x1FC4FF4C
0x1FC6FF4C
0x1FC0FF4C
0x1FC2FF4C
Alternate DEVCFG1
0x1FC4FF48
0x1FC6FF48
0x1FC0FF48
0x1FC2FF48
Alternate DEVCFG2
0x1FC4FF44
0x1FC6FF44
0x1FC0FF44
0x1FC2FF44
Alternate DEVCFG3
0x1FC4FF40
0x1FC6FF40
0x1FC0FF40
0x1FC2FF40
Note 1:
2:
Each of the following Configuration Word Groups should be programmed using the
QUAD_WORD_PROGRAM command to insure proper ECC configuration:
Boot Sequence Number (single quad word programming operation)
Code Protection (single quad word programming operation)
DEVCFG3, DEVCFG2, DEVCFG1, and DEVCFG0 (single quad word programming operation)
Alternate Boot Sequence Number (single Quad Word programming operation)
Alternate Code Protection (single Quad Word programming operation)
Alternate DEVCFG3, alternate DEVCFG2, alternate DEVCFG1, and alternate DEVCFG0 (single quad
word programming operation)
Active/Inactive boot alias selections are assumed for an unprogrammed device where Fixed Region 1 is
active and Fixed Region 2 is inactive. Refer to Section 3. Memory Organization (DS61115) for a
detailed description of the alias boot regions.
DS61145L-page 50
PIC32
18.1.1
CONFIGURATION REGISTER
PROTECTION
To prevent inadvertent Configuration bit changes during code execution, all programmable Configuration
bits are write-once. After a bit is initially programmed
during a power cycle, it cannot be written to again.
TABLE 18-4:
PIC32MX110F016B
PIC32MX110F016C
PIC32MX110F016D
PIC32MX120F032B
PIC32MX120F032C
PIC32MX120F032D
PIC32MX130F064B
PIC32MX130F064C
PIC32MX130F064D
PIC32MX150F128B
PIC32MX150F128C
PIC32MX150F128D
PIC32MX210F016B
PIC32MX210F016C
PIC32MX210F016D
PIC32MX220F032B
PIC32MX220F032C
PIC32MX220F032D
PIC32MX230F064B
PIC32MX230F064C
PIC32MX230F064D
PIC32MX250F128B
PIC32MX250F128C
PIC32MX250F128D
PIC32MX330F064H
PIC32MX330F064L
PIC32MX430F064H
PIC32MX430F064L
PIC32MX350F128H
PIC32MX350F128L
PIC32MX450F128H
PIC32MX450F128L
PIC32MX350F256H
PIC32MX350F256L
PIC32MX450F256H
PIC32MX450F256L
PIC32MX370F512H
PIC32MX370F512L
PIC32MX470F512H
PIC32MX470F512L
2007-2013 Microchip Technology Inc.
0x04A07053
0x04A09053
0x04A0B053
0x04A06053
0x04A08053
0x04A0A053
0x04D07053
0x04D09053
0x04D0B053
0x04D06053
0x04D08053
0x04D0A053
0x04A01053
0x04A03053
0x04A05053
0x04A00053
0x04A02053
0x04A04053
0x04D01053
0x04D03053
0x04D05053
0x04D00053
0x04D02053
0x04D04053
0x05600053
0x05601053
0x05602053
0x05603053
0x0570C053
0x0570D053
0x0570E053
0x0570F053
0x05704053
0x05705053
0x05706053
0x05707053
0x05808053
0x05809053
0x0580A053
0x0580B053
0x0 A0 Revision
DS61145L-page 51
PIC32
TABLE 18-4:
PIC32MX360F512L
0x0938053
PIC32MX360F256L
PIC32MX340F128L
PIC32MX320F128L
PIC32MX340F512H
PIC32MX340F256H
PIC32MX340F128H
PIC32MX320F128H
PIC32MX320F064H
PIC32MX320F032H
PIC32MX460F512L
PIC32MX460F256L
PIC32MX440F128L
PIC32MX440F256H
PIC32MX440F512H
PIC32MX440F128H
PIC32MX420F032H
PIC32MX534F064H
PIC32MX534F064L
PIC32MX564F064H
PIC32MX564F064L
PIC32MX564F128H
PIC32MX564F128L
PIC32MX575F256H
PIC32MX575F256L
PIC32MX575F512H
PIC32MX575F512L
PIC32MX664F064H
PIC32MX664F064L
PIC32MX664F128H
PIC32MX664F128L
PIC32MX675F256H
PIC32MX675F256L
PIC32MX675F512H
PIC32MX675F512L
PIC32MX695F512H
PIC32MX695F512L
PIC32MX764F128H
PIC32MX764F128L
PIC32MX775F256H
PIC32MX775F256L
PIC32MX775F512H
PIC32MX775F512L
PIC32MX795F512H
PIC32MX795F512L
0x0934053
0x092D053
0x092A053
0x0916053
0x0912053
0x090D053
0x090A053
0x0906053
0x0902053
0x0978053
0x0974053
0x096D053
0x0952053
0x0956053
0x094D053
0x0942053
0x4400053
0x440C053
0x4401053
0x440D053
0x4403053
0x440F053
0x4317053
0x4333053
0x4309053
0x430F053
0x4405053
0x4411053
0x4407053
0x4413053
0x430B053
0x4305053
0x430C053
0x4311053
0x4325053
0x4341053
0x440B053
0x4417053
0x4303053
0x4312053
0x430D053
0x4306053
0x430E053
0x4307053
DS61145L-page 52
0x3 B2 Revision
0x4 B3 Revision
0x5 B4 Revision
0x5 B6 Revision
0x0 A0 Revision
0x1 A1 Revision
PIC32
TABLE 18-4:
PIC32MZ0256ECE064
PIC32MZ0256ECE100
PIC32MZ0256ECE124
PIC32MZ0256ECE144
PIC32MZ0256ECF064
PIC32MZ0256ECF100
PIC32MZ0256ECF124
PIC32MZ0256ECF144
PIC32MZ0512ECE064
PIC32MZ0512ECE100
PIC32MZ0512ECE124
PIC32MZ0512ECE144
PIC32MZ0512ECF064
PIC32MZ0512ECF100
PIC32MZ0512ECF124
PIC32MZ0512ECF144
PIC32MZ1024ECE064
PIC32MZ1024ECE100
PIC32MZ1024ECE124
PIC32MZ1024ECE144
PIC32MZ1024ECF064
PIC32MZ1024ECF100
PIC32MZ1024ECF124
PIC32MZ1024ECF144
PIC32MZ1024ECG064
PIC32MZ1024ECG100
PIC32MZ1024ECG124
PIC32MZ1024ECG144
PIC32MZ1024ECH064
PIC32MZ1024ECH100
PIC32MZ1024ECH124
PIC32MZ1024ECH144
PIC32MZ2048ECG064
PIC32MZ2048ECG100
PIC32MZ2048ECG124
PIC32MZ2048ECG144
PIC32MZ2048ECH064
PIC32MZ2048ECH100
PIC32MZ2048ECH124
PIC32MZ2048ECH144
0x0 A0 Revision
0x0 A0 Revision
DS61145L-page 53
PIC32
18.2 Device Code Protection bit (CP)
The PIC32 family of devices feature code protection, which when enabled, prevents reading of Flash
memory by an external programming device. Once
code protection is enabled, it can only be disabled
by erasing the device with the Chip Erase command
(MCHP_ERASE).
When programming a device that has opted to utilize code protection, the programming device must
perform verification prior to enabling code protection. Enabling code protection should be the last step
of the programming process. Location of the code
protection enable bits vary by device. Refer to the
Special Features chapter in the specific device
data sheet for details.
Note:
DS61145L-page 54
PIC32
19.0
TAP CONTROLLERS
TABLE 19-1:
Command
Description
MTAP_COMMAND
5h0x07
TDI and TDO connected to MCHP Command Shift register (See Table 19-2).
MTAP_SW_MTAP
5h0x04
MTAP_SW_ETAP
5h0x05
MTAP_IDCODE
5h0x01
19.1
19.1.1
MTAP_COMMAND INSTRUCTION
19.1.1.1
MCHP_STATUS INSTRUCTION
19.1.1.2
MCHP_ASSERT_RST INSTRUCTION
19.1.1.3
MCHP_DE_ASSERT_RST
INSTRUCTION
19.1.1.4
MCHP_FLASH_DISABLE
INSTRUCTION
19.1.2
for
MTAP_SW_MTAP INSTRUCTION
19.1.3
MTAP_SW_ETAP INSTRUCTION
19.1.4
MCHP_ERASE INSTRUCTION
19.1.1.5
19.1.1.6
MTAP_IDCODE INSTRUCTION
MCHP_FLASH_ENABLE
INSTRUCTION
MCHP_FLASH_ENABLE sets the FAEN bit, which controls processor accesses to the Flash memory. The
FAEN bits state is returned in the field of the same
name. This command has no effect if CPS = 0. This
command requires a NOP to complete.
Note:
for
DS61145L-page 55
PIC32
TABLE 19-2:
MTAP_COMMAND DR COMMANDS
Command
Value
Description
MCHP_STATUS
8h0x00
MCHP_ASSERT_RST
8h0xD1
MCHP_DE_ASSERT_RST
8h0xD0
Removes the request for device Reset, which causes the reset
controller to de-assert device Reset if there is no other source
requesting Reset (i.e., MCLR).
MCHP_ERASE
8h0xFC
MCHP_FLASH_ENABLE(1)
8h0xFE
MCHP_FLASH_DISABLE(1)
8h0xFD
Note 1:
TABLE 19-3:
Bit
Range
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
7:0
CPS
NVMERR(1)
CFGRDY
FCBUSY
FAEN(2)
DEVRST
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
2:
TABLE 19-4:
Command
ETAP_ADDRESS
Value
5h0x08
Description
Select Address register.
ETAP_DATA
5h0x09
ETAP_CONTROL
5h0x0A
ETAP_EJTAGBOOT
5h0x0C
ETAP_FASTDATA
5h0x0E
DS61145L-page 56
PIC32
19.2
19.2.1
19.2.2
ETAP_DATA COMMAND
19.2.3
ETAP_CONTROL COMMAND
19.2.3.1
DS61145L-page 57
PIC32
REGISTER 19-1:
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
R/W-0
R-0
R-0
Rocc
R-0
bit 17
bit 16
bit 15
bit 14
bit 13
bit 12
bit 11-4
bit 3
bit 2-0
Note 1:
Bit
Bit
28/20/12/4 27/19/11/3
Psz<1:0>
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
U-0
U-0
U-0
U-0
U-0
U-0
R/W-0
R-0
R-0
R/W-0
R-0
R/W-0
VPED
Doze
Halt
PerRst
PrnW
PrACC
PrRst
R/W-0
R/W-0
U-0
R/W-0
U-0
U-0
U-0
U-0
ProbEn
ProbTrap
EjtagBrk
U-0
U-0
U-0
U-0
R-0
U-0
U-0
U-0
DM
Legend:
R = Readable bit
-n = Value at POR
bit 31-29
bit 28-24
bit 23-19
bit 18
W = Writable bit
1 = Bit is set
See Note 1
Unimplemented: Read as 0
See Note 1
PrACC: Pending Processor Access and Control bit
This bit indicates a pending processor access and controls finishing of a pending processor access. A write
of 0 finishes processor access if pending. A write of 1 is ignored. A successful FASTDATA access will clear
this bit.
1 = Pending processor access
0 = No pending preprocessor access
Unimplemented: Read as 0
See Note 1
ProbEn: Processor Access Service Control bit
This bit controls where the probe handles accesses to the DMSEG segment through servicing of processor
accesses.
1 = Probe services processor accesses
0 = Probe does not service processor access
ProbTrap: Debug Exception Vector Control Location bit
This bit controls the location of the debug exception vector.
1 = 0xFF200200
0 = 0xBFC00480
Unimplemented: Read as 0
EjtagBrk: Debug Interrupt Exception Request bit
This bit requests a debug interrupt exception to the processor when this bit is written as 1. A write of 0 is
ignored.
1 = A debug interrupt exception request is pending
0 = A debug interrupt exception request is not pending
Unimplemented: Read as 0
See Note 1
Unimplemented: Read as 0
For descriptions of these bits, please refer to the EJTAG Control Register Field Descriptions in the EJTAG
Specification (MD00047), which is available from MIPS Technologies, Inc. (www.mips.com).
DS61145L-page 58
PIC32
19.2.4
ETAP_EJTAGBOOT COMMAND
19.2.5
ETAP_FASTDATA COMMAND
DS61145L-page 59
PIC32
20.0
TABLE 20-1:
Characteristic
Min.
Max.
Units
Conditions
VDD
See Note 1
D113
IDDP
mA
See Note 1
D114
IPEAK
mA
See Note 1
D031
VIL
See Note 1
D041
VIH
See Note 1
D080
VOL
See Note 1
D090
VOH
See Note 1
D012
CIO
pF
See Note 1
D013
CF
See Note 1
P1
TPGC
100
ns
P1A
TPGCL
40
ns
P1B
TPGCH
40
ns
P6
TSET2
100
ns
P7
THLD2
500
ns
P9A
TDLY4
40
P9B
TDLY5
15
P11
TDLY7
ms
See Note 1
P12
TDLY8
ms
See Note 1
See Note 1
P13
TDLY9
ms
P14
TR
1.0
P15
TVALID
10
ns
P16
TDLY8
P17
THLD3
MCLR to VDD
100
ns
P18
TKEY1
40
ns
P19
TKEY2
40
ns
P20
500
Note 1:
Refer to the Electrical Characteristics chapter in the specific device data sheet for the Minimum and
Maximum values for this parameter.
DS61145L-page 60
PIC32
APPENDIX A:
FIGURE A-1:
PIC32 FLASH
MEMORY MAP
APPENDIX B:
PFM
0x1D007FFF
0x1F000000
0x1F001FFF
0x1F002FF0
BFM
Boot Page 0
Boot Page 1
Boot Page 2
Debug Page
Configuration Words
(4 x 32 bits)
Note:
0x1F002FFF
DS61145L-page 61
PIC32
APPENDIX C:
REVISION HISTORY
DS61145L-page 62
PIC32
Revision F (April 2010) (Continued)
Added the following devices:
- PIC32MX534F064H
- PIC32MX534F064L
- PIC32MX564F064H
- PIC32MX564F064L
- PIC32MX564F128H
- PIC32MX564F128L
- PIC32MX575F256L
- PIC32MX664F064H
- PIC32MX664F064L
- PIC32MX664F128H
- PIC32MX664F128L
- PIC32MX675F256H
- PIC32MX675F256L
- PIC32MX695F512H
- PIC32MX605F512L
- PIC32MX764F128H
- PIC32MX764F128L
- PIC32MX775F256H
- PIC32MX775F256L
- PIC32MX775F512H
- PIC32MX775F512L
DS61145L-page 63
PIC32
Revision J (August 2011) (Continued)
Updated the PGCx signal in Entering Enhanced
ICSP Mode (see Figure 7-1)
Updated the Erase Device block diagram (see
Figure 9-1)
Added a new step 4 to the process to erase a target
device in Section 9.0 Erasing the Device
Updated the MCLR signal in 2-Wire Exit Test
Mode (see Figure 15-2)
Updated the PE Command Set with the following
commands and modified Note 2 (see Table 16-2):
- PROGRAM_CLUSTER
- GET_DEVICEID
- CHANGE_CFG
Added a second note to Section 16.2.11
GET_CRC Command
Updated the Address and Length descriptions in the
PROGRAM_CLUSTER Format (see Table 16-13)
Added a note after the CHANGE_CFG Response (see
Figure 16-27)
Updated the DEVCFG0 and DEVCFG1 values for
All PIC32MX1XX and All PIC32MX2XX devices in
Table 17-1
The following changes were made to the AC/DC
Characteristics and Timing Requirements
(Table 20-1):
- Updated the Min. value for parameter D111 (VDD)
- Added parameter D114 (IPEAK)
- Removed parameters P2, P3, P4, P4A, P5, P8
and P10
Removed Appendix C: Flash Program Memory
Data Sheet Clarification
Minor updates to text and formatting were
incorporated throughout the document
DS61145L-page 64
PIC32MX420F032H
PIC32MX330F064H
PIC32MX330F064L
PIC32MX430F064H
PIC32MX430F064L
PIC32MX340F128H
PIC32MX340F128L
PIC32MX350F128H
PIC32MX350F128L
PIC32MX350F256H
PIC32MX350F256L
PIC32MX440F128H
PIC32MX440F128L
PIC32MX450F128H
PIC32MX450F128L
PIC32MX440F256H
PIC32MX450F256H
PIC32MX450F256L
PIC32MX460F256L
PIC32MX340F512H
PIC32MX360F512H
PIC32MX370F512H
PIC32MX370F512L
PIC32MX440F512H
PIC32MX460F512L
PIC32MX470F512H
PIC32MX470F512L
PIC32
Revision L (January 2013)
This revision includes the following updates:
The following sections were added or updated:
- Section 2.1 Devices with Dual Flash
Panel and Dual Boot Regions (new)
- Section 4.3 Power Requirements
- Section 13.0 Initiating a Flash Row Write
- Section 16.1.1 2-wire ICSP EJTAG RATE
Updated the Device Configuration Register Mask
Values (see Table 17-1)
The following devices were added to the Code
Memory Size table and the Device IDs and Revision
table (see Table 5-1 and Table 18-4):
- PIC32MZ0256ECE064
- PIC32MZ1024ECF064
- PIC32MZ0256ECE100
- PIC32MZ1024ECF100
- PIC32MZ0256ECE124
- PIC32MZ1024ECF124
- PIC32MZ0256ECE144
- PIC32MZ1024ECF144
- PIC32MZ0256ECF064
- PIC32MZ1024ECG064
- PIC32MZ0256ECF100
- PIC32MZ1024ECG100
- PIC32MZ0256ECF124
- PIC32MZ1024ECG124
- PIC32MZ0256ECF144
- PIC32MZ1024ECG144
- PIC32MZ0512ECE064
- PIC32MZ1024ECH064
- PIC32MZ0512ECE100
- PIC32MZ1024ECH100
- PIC32MZ0512ECE124
- PIC32MZ1024ECH124
- PIC32MZ0512ECE144
- PIC32MZ1024ECH144
- PIC32MZ0512ECF064
- PIC32MZ2048ECG064
- PIC32MZ0512ECF100
- PIC32MZ2048ECG100
- PIC32MZ0512ECF124
- PIC32MZ2048ECG124
- PIC32MZ0512ECF144
- PIC32MZ2048ECG144
- PIC32MZ1024ECE064
- PIC32MZ2048ECH064
- PIC32MZ1024ECE100
- PIC32MZ2048ECH100
- PIC32MZ1024ECE124
- PIC32MZ2048ECH124
- PIC32MZ1024ECE144
- PIC32MZ2048ECH144
DS61145L-page 65
PIC32
NOTES:
DS61145L-page 66
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchips Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as unbreakable.
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchips code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
FlashFlex, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PIC32 logo, rfPIC, SST, SST Logo, SuperFlash
and UNI/O are registered trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MTP, SEEVAL and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of
Microchip Technology Inc. in other countries.
Analog-for-the-Digital Age, Application Maestro, BodyCom,
chipKIT, chipKIT logo, CodeGuard, dsPICDEM,
dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB
Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code
Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit,
PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O,
Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA
and Z-Scale are trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
GestIC and ULPP are registered trademarks of Microchip
Technology Germany II GmbH & Co. & KG, a subsidiary of
Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their
respective companies.
2007-2013, Microchip Technology Incorporated, Printed in
the U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 978-1-62076-856-3
== ISO/TS 16949 ==
2007-2013 Microchip Technology Inc.
DS61145L-page 67
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://www.microchip.com/
support
Web Address:
www.microchip.com
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Japan - Osaka
Tel: 81-6-6152-7160
Fax: 81-6-6152-9310
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8569-7000
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
China - Hangzhou
Tel: 86-571-2819-3187
Fax: 86-571-2819-3189
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8864-2200
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-213-7828
Fax: 886-7-330-9305
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Taiwan - Taipei
Tel: 886-2-2508-8600
Fax: 886-2-2508-0102
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
DS61145L-page 68
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Japan - Tokyo
Tel: 81-3-6880- 3770
Fax: 81-3-6880-3771
11/29/12