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 Microchip’s 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 Microchip’s 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.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
K
rfPIC 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,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
logo, REAL ICE, rfLAB,
Select Mode, Total Endurance, TSHARC, WiperLock and
ZENA 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.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
2.0Guidelines for Getting Started with 32-bit Microcontrollers ........................................................................................................ 15
5.0Flash Program Memory.............................................................................................................................................................. 55
10.0 Direct Memory Access (DMA) Controller ................................................................................................................................... 67
11.0 USB On-The-Go (OTG).............................................................................................................................................................. 69
26.0 Special Features ...................................................................................................................................................................... 101
27.0 Instruction Set .......................................................................................................................................................................... 113
28.0 Development Support............................................................................................................................................................... 121
INDEX ................................................................................................................................................................................................ 167
Worldwide Sales and Service ............................................................................................................................................................ 170
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@microchip.com or fax the Reader Response Form in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
Customer Notification System
Register on our web site at www.microchip.com to receive the most current information on all of our products.
Note 1: Some features are not available on all device variants.
2: BOR functionality is provided when the on-board voltage regulator is enabled.
UART 1,2
Comparators
PORTA
PORTD
PORTE
PORTF
PORTG
PORTB
CN1-22
JTAG
Priority
DMAC
ICD
MIPS 32® M4K® CPU Core
ISDS
EJTAGINT
Bus Matrix
Prefetch
Data RAM
Peripheral Bridge
128
128-bit wide
Flash
32
32
32
32
32
Peripheral Bus Clocked by PBCLK
Program Flash Memory
Controller
32
32
Module
32
32
Interrupt
Controller
BSCAN
PORTC
PMP
I2C 1,2
SPI 1,2
IC 1-5
PWM
OC 1-5
OSC1/CLKI
OSC2/CLKO
V
DD,
Timing
Generation
V
SS
MCLR
Power-up
Timer
Oscillator
Start-up Ti me r
Power-on
Reset
Watchdog
Timer
Brown-out
Reset
Precision
Reference
Band Gap
FRC/LPRC
Oscillators
Regulator
Voltage
VDDCORE/VCAP
ENVREG
OSC/SOSC
Oscillators
PLL
DIVIDERS
SYSCLK
PBCLK
Peripheral Bus Clocked by SYSCLK
USB
PLL-USB
USBCLK
32
RTCC
10-bit ADC
Timer1-5
32
1.0DEVICE OVERVIEW
Note:This data sheet summarizes the features of
the PIC32MX3XX/4XX family of devices. It
is not intended to be a comprehensive
reference source. To complement the
information in this data sheet, refer to the
appropriate section of the “PIC32MXFamily Reference Manual”, which is
available from the Microchip web site
(www.microchip.com/PIC32)
FIGURE 1-1:BLOCK DIAGRAM
(1,2)
This document contains device-specific information for
the PIC32MX3XX/4XX devices.
Figure 1-1 shows a general block diagram of the core
and peripheral modules in the PIC32MX3XX/4XX families of devices.
Table 1-1 lists the functions of the various pins shown
in the pinout diagrams.
Legend: CMOS = CMOS compatible input or outputAnalog = Analog inputP = Power
ST = Schmitt Trigger input with CMOS levelsO = OutputI = Input
TTL = TTL input buffer
Pin
Typ e
I/O
O
I/OSTPORTG is a bidirectional I/O port.
O
O
O
O
Buffer
Type
IOST/CMOS—External clock source input. Always associated with OSC1 pin function.
Oscillator crystal output. Connects to crystal or resonator in Crystal Oscillator
mode. Optionally functions as CLKO in RC and EC modes. Always associated
with OSC2 pin function.
I
ST/CMOS—Oscillator crystal input. ST buffer when configured in RC mode;
CMOS otherwise.
Oscillator crystal output. Connects to crystal or resonator in Crystal Oscillator
mode. Optionally functions as CLKO in RC and EC modes.
Parallel Master Port Address Bit 0 Input (Buffered Slave modes) and Output
(Master modes).
Parallel Master Port Address Bit 1 Input (Buffered Slave modes) and Output
(Master modes).
—
Parallel Master Port Address (Demultiplexed Master Modes).
—
Parallel Master Port Enable Strobe (Master mode 1).
—
Parallel Master Port Chip Select 1 Strobe.
—
Parallel Master Port Chip Select 2 Strobe.
Parallel Master Port Data (Demultiplexed Master mode) or Address/Data
(Multiplexed Master modes).
—
Parallel Master Port Read Strobe.
—
Parallel Master Port Write Strobe.
—
Parallel Master Port Address Latch Enable low-byte (Multiplexed Master
modes).
—
Parallel Master Port Address Latch Enable high-byte (Multiplexed Master
modes).
—
Parallel Master Port Read/Write Strobe (Master mode 1).
—
Parallel Master Port Address Latch Enable low-byte (Multiplexed Master
modes).
—
Parallel Master Port Address Latch Enable high-byte (Multiplexed Master
modes).
—
Parallel Master Port Read/Write Strobe (Master mode 1).
Legend: CMOS = CMOS compatible input or outputAnalog = Analog inputP = Power
ST = Schmitt Trigger input with CMOS levelsO = OutputI = Input
TTL = TTL input buffer
Pin
Typ e
O
I/O
I/O
O
O
I/O
I/O
Buffer
Type
I
P
I
I
I
ANA
—
—
ANA
ANA
ST
—
—
ST
ST
ST
ST
USB Bus Power Monitor.
USB Internal Transceiver Supply.
USB Host and OTG Bus Power Control Output.
USB D+.
USB D–.
USB OTG ID Detect.
Trace Clock.
Trace Data Bits 0-3
Data I/O pin for programming/debugging communication channel 1.
Clock input pin for programming/debugging communication channel 1.
Data I/O pin for programming/debugging communication channel 2.
Clock input pin for programming/debugging communication channel 2.
2.0GUIDELINES FOR GETTING
STARTED WITH 32-BIT
MICROCONTROLLERS
Note:This data sheet summarizes the features of
the PIC32MX3XX/4XX family of devices. It
is not intended to be a comprehensive
reference source. Refer to the “PIC32MXFamily Reference Manual” for a detailed
description of the PIC32MX MCU.
The manual is available from the Microchip
web site (www.Microchip.com/PIC32).
2.1Basic Connection Requirements
Getting started with the PIC32MX3XX/4XX family of
32-bit Microcontrollers (MCU) requires attention to a
minimal set of device pin connections before
proceeding with development. The following is a list of
pin names, which must always be connected:
DD and VSS pins
• All V
(see Section 2.2)
• All AV
•V
•MCLR
• PGECx/PGEDx pins used for In-Circuit Serial
• OSC1 and OSC2 pins when external oscillator
Additionally, the following pins may be required:
•V
DD and AVSS pins (regardless if ADC module
is not used)
(see Section 2.2)
CAP/VDDCORE
(see Section 2.3)
pin
(see Section 2.4)
Programming™ (ICSP™) and debugging purposes
(see Section 2.5)
source is used
(see Section 2.8)
REF+/VREF- pins used when external voltage
reference for ADC module is implemented
Note:The AVDD and AVSS pins must be
connected independent of ADC use and
ADC voltage reference source.
2.2Decoupling Capacitors
The use of decoupling capacitors on every pair of
power supply pins, such as V
AVSS is required. See Figure 2-1.
Consider the following criteria when using decoupling
capacitors:
• Value and type of capacitor: Recommendation
of 0.1 µF (100 nF), 10-20V. This capacitor should
be a low-ESR and have resonance frequency in
the range of 20 MHz and higher. It is
recommended that ceramic capacitors be used.
• Placement on the printed circuit board: The
decoupling capacitors should be placed as close
to the pins as possible. It is recommended to
place the capacitors on the same side of the
board as the device. If space is constricted, the
capacitor can be placed on another layer on the
PCB using a via; however, ensure that the trace
length from the pin to the capacitor is within onequarter inch (6 mm) in length.
• Handling high frequency noise: If the board is
experiencing high frequency noise, upward of
tens of MHz, add a second ceramic-type capacitor
in parallel to the above described decoupling
capacitor. The value of the second capacitor can
be in the range of 0.01 µF to 0.001 µF. Place this
second capacitor next to the primary decoupling
capacitor. In high-speed circuit designs, consider
implementing a decade pair of capacitances as
close to the power and ground pins as possible.
For example, 0.1 µF in parallel with 0.001 µF.
• Maximizing performance: On the board layout
from the power supply circuit, run the power and
return traces to the decoupling capacitors first,
and then to the device pins. This ensures that the
decoupling capacitors are first in the power chain.
Equally important is to keep the trace length
between the capacitor and the power pins to a
minimum thereby reducing PCB track inductance.
starting value is 10 kΩ. Ensure that the MCLR
pin VIH and VIL specifications are met.
2: R1 ≤ 470Ω will limit any current flowing into
MCLR
from the external capacitor C, in the
event of MCLR
pin breakdown, due to
Electrostatic Discharge (ESD) or Electrical
Overstress (EOS). Ensure that the MCLR
pin
V
IH and VIL specifications are met.
3: The capacitor can be sized to prevent uninten-
tional resets from brief glitches or to extend the
device reset period during POR.
C
R1
R
V
DD
MCLR
PIC32MX
JP
FIGURE 2-1:RECOMMENDED
MINIMUM CONNECTION
2.2.1BULK CAPACITORS
The use of a bulk capacitor is recommended to improve
power supply stability. Typical values range from 4.7 µF
to 47 µF. This capacitor should be located as close to
the device as possible.
2.4Master Clear (MCLR) Pin
The MCLR pin provides for two specific device
functions:
• Device Reset
• Device Programming and Debugging
Pulling The MCLR pin low generates a device reset.
Figure 2-2 shows a typical MCLR circuit. During
device programming and debugging, the resistance
and capacitance that can be added to the pin must
be considered. Device programmers and debuggers
drive the MCLR
levels (V
IH and VIL) and fast signal transitions must
not be adversely affected. Therefore, specific values
of R and C will need to be adjusted based on the
application and PCB requirements.
For example, as shown in Figure 2-2, it is
recommended that the capacitor C, be isolated from
the MCLR
operations.
Place the components shown in Figure 2-2 within
one-quarter inch (6 mm) from the MCLR
FIGURE 2-2:EXAMPLE OF MCLR PIN
pin. Consequently, specific voltage
pin during programming and debugging
pin.
CONNECTIONS
2.3Capacitor on Internal Voltage
Regulator (V
2.3.1INTERNAL REGULATOR MODE
A low-ESR (< 5 Ohms) capacitor is required on the
VCAP/VDDCORE pin, which is used to stabilize the
internal voltage regulator output. The V
pin must not be connected to VDD, and must have a
10 µF capacitor, with at least a 6V rating, connected to
ground. The type can be ceramic or tantalum. Refer to
Section 28.0 "Electrical Characteristics" for
additional information. This mode is enabled by
connecting the ENVREG pin to V
2.3.2EXTERNAL REGULATOR MODE
In this mode the core voltage is supplied externally
through the VDDCORE pin. A low-ESR capacitor of
10 µF is recommended on the VDDCORE pin. This mode
is enabled by grounding the ENVREG pin.
The placement of this capacitor should be close to the
CAP/VDDCORE. It is recommended that the trace
V
length not exceed one-quarter inch (6 mm). Refer to
Section 26.3 "On-Chip Voltage Regulator" for
details.
The PGECx and PGEDx pins are used for In-Circuit
Serial Programming™ (ICSP™) and debugging purposes. It is recommended to keep the trace length
between the ICSP connector and the ICSP pins on the
device as short as possible. If the ICSP connector is
expected to experience an ESD event, a series resistor
is recommended, with the value in the range of a few
tens of Ohms, not to exceed 100 Ohms.
Pull-up resistors, series diodes, and capacitors on the
PGECx and PGEDx pins are not recommended as they
will interfere with the programmer/debugger communications to the device. If such discrete components are
an application requirement, they should be removed
from the circuit during programming and debugging.
Alternately, refer to the AC/DC characteristics and timing requirements information in the respective device
Flash programming specification for information on
capacitive loading limits and pin input voltage high (V
IH)
and input low (VIL) requirements.
Ensure that the “Communication Channel Select” (i.e.,
PGECx/PGEDx pins) programmed into the device
matches the physical connections for the ICSP to
MPLAB
®
ICD 2, MPLAB® ICD 3, or MPLAB® REAL
ICE™.
For more information on ICD 2, ICD 3, and REAL ICE
connection requirements, refer to the following
documents that are available on the Microchip website.
®
• “MPLAB
ICD 2 In-Circuit Debugger User's
Guide” DS51331
®
• “Using MPLAB
• “MPLAB
®
• “Using MPLAB
ICD 2” (poster) DS51265
ICD 2 Design Advisory” DS51566
®
ICD 3” (poster) DS51765
• “MPLAB® ICD 3 Design Advisory” DS51764
®
• “MPLAB
REAL ICE™ In-Circuit Debugger
User's Guide” DS51616
®
• “Using MPLAB
REAL ICE™” (poster) DS51749
2.6JTAG
Pull-up resistors, series diodes, and capacitors on the
TMS, TDO, TDI, and TCK pins are not recommended
as they will interfere with the programmer/debugger
communications to the device. If such discrete components are an application requirement, they should be
removed from the circuit during programming and
debugging. Alternately, refer to the AC/DC characteristics and timing requirements information in the respective device Flash programming specification for
information on capacitive loading limits and pin input
voltage high (V
IH) and input low (VIL) requirements.
2.7Trace
The trace pins can be connected to a hardware-traceenabled programmer to provide a compress real time
instruction trace. When used for trace the TRD3,
TRD2, TRD1, TRD0, and TRCLK pins should be dedicated for this use. The trace hardware requires a 22
Ohm series resistor between the trace pins and the
trace connector.
2.8External Oscillator Pins
Many MCUs have options for at least two oscillators: a
high-frequency primary oscillator and a low-frequency
secondary oscillator (refer to Section 8.0 "OscillatorConfiguration" for details).
The oscillator circuit should be placed on the same
side of the board as the device. Also, place the
oscillator circuit close to the respective oscillator pins,
not exceeding one-half inch (12 mm) distance
between them. The load capacitors should be placed
next to the oscillator itself, on the same side of the
board. Use a grounded copper pour around the
oscillator circuit to isolate them from surrounding
circuits. The grounded copper pour should be routed
directly to the MCU ground. Do not run any signal
traces or power traces inside the ground pour. Also, if
using a two-sided board, avoid any traces on the
other side of the board where the crystal is placed. A
suggested layout is shown in Figure 2-3.
The TMS, TDO, TDI, and TCK pins are used for testing
and debugging according to the Joint Test Action
Group (JTAG) standard. It is recommended to keep the
FIGURE 2-3:SUGGESTED PLACEMENT
OF THE OSCILLATOR
CIRCUIT
trace length between the JTAG connector and the
JTAG pins on the device as short as possible. If the
JTAG connector is expected to experience an ESD
event, a series resistor is recommended, with the value
in the range of a few tens of Ohms, not to exceed 100
Ohms.
2.9Configuration of Analog and
Digital Pins During ICSP
Operations
If MPLAB ICD 2, ICD 3, or REAL ICE is selected as a
debugger, it automatically initializes all of the A/D input
pins (ANx) as “digital” pins by setting all bits in the
ADPCFG register.
The bits in this register that correspond to the A/D pins
that are initialized by MPLAB ICD 2, ICD 3, or REAL
ICE, must not be cleared by the user application
firmware; otherwise, communication errors will result
between the debugger and the device.
If your application needs to use certain A/D pins as
analog input pins during the debug session, the user
application must clear the corresponding bits in the
ADPCFG register during initialization of the ADC
module.
When MPLAB ICD 2, ICD 3, or REAL ICE is used as a
programmer, the user application firmware must
correctly configure the ADPCFG register. Automatic
initialization of this register is only done during
debugger operation. Failure to correctly configure the
register(s) will result in all A/D pins being recognized as
analog input pins, resulting in the port value being read
as a logic '0', which may affect user application
functionality.
2.10Unused I/Os
Unused I/O pins should not be allowed to float as
inputs. They can be configured as outputs and driven
to a logic-low state.
Alternately, inputs can be reserved by connecting the
pin to V
the pin as an input.
the PIC32MX3XX/4XX Family of devices. It
is not intended to be a comprehensive
reference source. Refer to the “PIC32MX
Family Reference Manual” Section 2.
“MCU” (DS61113) for a detailed description
of the PIC32MX MCU. The manual is
available from the Microchip web site
(www.Microchip.com/PIC32). Resources for
the MIPS32
available at www.mips.com/products/cores/32-bit-cores/ mips32-m4k/#.
The MCU module is the heart of the PIC32MX3XX/4XX
Family processor. The MCU fetches instructions,
decodes each instruction, fetches source operands,
executes each instruction, and writes the results of
instruction execution to the proper destinations.
3.1Features
• 5-stage pipeline
• 32-bit Address and Data Paths
• MIPS32 Enhanced Architecture (Release 2)
- Multiply-Accumulate and Multiply-Subtract
Instructions
- Targeted Multiply Instruction
- Zero/One Detect Instructions
- WAIT Instruction
- Conditional Move Instructions (MOVN, MOVZ)
- Vectored interrupts
- Programmable exception vector base
- Atomic interrupt enable/disable
- GPR shadow registers to minimize latency
for interrupt handlers
- Bit field manipulation instructions
®
M4K® Processor Core are
• MIPS16e™ Code Compression
- 16-bit encoding of 32-bit instructions to
improve code density
- Special PC-relative instructions for efficient
loading of addresses and constants
- SAVE & RESTORE macro instructions for
setting up and tearing down stack frames
within subroutines
- Improved support for handling 8 and 16-bit
data types
The PIC32MX3XX/4XX Family core contains several
logic blocks working together in parallel, providing an
efficient high performance computing engine. The following blocks are included with the core:
• Execution Unit
• Multiply/Divide Unit (MDU)
• System Control Coprocessor (CP0)
• Fixed Mapping Translation (FMT)
• Dual Internal Bus interfaces
• Power Management
• MIPS16e Support
• Enhanced JTAG (EJTAG) Controller
3.2.1EXECUTION UNIT
The PIC32MX3XX/4XX Family core execution unit
implements a load/store architecture with single-cycle
ALU operations (logical, shift, add, subtract) and an
autonomous multiply/divide unit. The core contains
thirty-two 32-bit general purpose registers used for
integer operations and address calculation. One additional register file shadow set (containing thirty-two registers) is added to minimize context switching overhead
during interrupt/exception processing. The register file
consists of two read ports and one write port and is fully
bypassed to minimize operation latency in the pipeline.
The execution unit includes:
• 32-bit adder used for calculating the data address
• Address unit for calculating the next instruction
address
• Logic for branch determination and branch target
address calculation
• Load aligner
• Bypass multiplexers used to avoid stalls when
executing instructions streams where data
producing instructions are followed closely by
consumers of their results
• Leading Zero/One detect unit for implementing the
CLZ and CLO instructions
• Arithmetic Logic Unit (ALU) for performing bitwise
logical operations
• Shifter and Store Aligner
3.2.2MULTIPLY/DIVIDE UNIT (MDU)
The PIC32MX3XX/4XX Family core includes a multiply/divide unit (MDU) that contains a separate pipeline
for multiply and divide operations. This pipeline operates in parallel with the integer unit (IU) pipeline and
does not stall when the IU pipeline stalls. This allows
MDU operations to be partially masked by system stalls
and/or other integer unit instructions.
The high-performance MDU consists of a 32x16 booth
recoded multiplier, result/accumulation registers (HI
and LO), a divide state machine, and the necessary
multiplexers and control logic. The first number shown
(‘32’ of 32x16) represents the rs operand. The second
number (‘16’ of 32x16) represents the rt operand. The
PIC32MX core only checks the value of the latter (rt)
operand to determine how many times the operation
must pass through the multiplier. The 16x16 and 32x16
operations pass through the multiplier once. A 32x32
operation passes through the multiplier twice.
The MDU supports execution of one 16x16 or 32x16
multiply operation every clock cycle; 32x32 multiply
operations can be issued every other clock cycle.
Appropriate interlocks are implemented to stall the
issuance of back-to-back 32x32 multiply operations.
The multiply operand size is automatically determined
by logic built into the MDU.
Divide operations are implemented with a simple 1 bit
per clock iterative algorithm. An early-in detection
checks the sign extension of the dividend (rs) operand.
If rs is 8 bits wide, 23 iterations are skipped. For a 16bit-wide rs, 15 iterations are skipped, and for a 24-bitwide rs, 7 iterations are skipped. Any attempt to issue
a subsequent MDU instruction while a divide is still
active causes an IU pipeline stall until the divide operation is completed.
Table 3-1 lists the repeat rate (peak issue rate of cycles
until the operation can be reissued) and latency (number of cycles until a result is available) for the PIC32MX
core multiply and divide instructions. The approximate
latency and repeat rates are listed in terms of pipeline
clocks.
The MIPS architecture defines that the result of a multiply or divide operation be placed in the HI and LO registers. Using the Move-From-HI (MFHI) and MoveFrom-LO (MFLO) instructions, these values can be
transferred to the general purpose register file.
In addition to the HI/LO targeted operations, the
MIPS32 architecture also defines a multiply instruction,
MUL, which places the least significant results in the
primary register file instead of the HI/LO register pair.
By avoiding the explicit MFLO instruction, required
when using the LO register, and by supporting multiple
destination registers, the throughput of multiply-intensive operations is increased.
Two other instructions, multiply-add (MADD) and multiply-subtract (MSUB), are used to perform the multiplyaccumulate and multiply-subtract operations. The
MADD instruction multiplies two numbers and then adds
TABLE 3-2:COPROCESSOR 0 REGISTERS
Register
Number
0-6ReservedReserved in the PIC32MX3XX/4XX Family core
10ReservedReserved in the PIC32MX3XX/4XX Family core
12Status
12IntCtl
12SRSCtl
12SRSMap
13Cause
14EPC
15PRIdProcessor identification and revision
15EBASEException vector base register
16ConfigConfiguration register
16Config1Configuration register 1
16Config2Configuration register 2
16Config3Configuration register 3
Register
Name
7HWREnaEnables access via the RDHWR instruction to selected hardware registers
8BadVAddr
9Count
11Compare
(1)
(1)
(1)
(1)
(1)
(1)
(1)
(1)
(1)
Function
Reports the address for the most recent address-related exception
Processor cycle count
Timer interrupt control
Processor status and control
Interrupt system status and control
Shadow register set status and control
Provides mapping from vectored interrupt to a shadow set
Cause of last general exception
Program counter at last exception
16 bits11
32 bits22
32 bits32
16 bits1918
24 bits2625
32 bits3332
the product to the current contents of the HI and LO
registers. Similarly, the MSUB instruction multiplies two
operands and then subtracts the product from the HI
and LO registers. The MADD and MSUB operations
are commonly used in DSP algorithms.
3.2.3SYSTEM CONTROL
COPROCESSOR (CP0)
In the MIPS architecture, CP0 is responsible for the virtual-to-physical address translation, the exception control system, the processor’s diagnostics capability, the
operating modes (kernel, user, and debug), and
whether interrupts are enabled or disabled. Configuration information, such as presence of options like
MIPS16e, is also available by accessing the CP0 registers, listed in Table 3-2.
17-22ReservedReserved in the PIC32MX3XX/4XX Family core
23Debug
24DEPC
25-29ReservedReserved in the PIC32MX3XX/4XX Family core
30ErrorEPC
31DESAVE
Note 1:Registers used in exception processing.
Coprocessor 0 also contains the logic for identifying
and managing exceptions. Exceptions can be caused
by a variety of sources, including alignment errors in
data, external events, or program errors. Table 3-3
shows the exception types in order of priority.
TABLE 3-3:PIC32MX3XX/4XX FAMILY CORE EXCEPTION TYPES
ExceptionDescription
DDBL / DDBS EJTAG Data Address Break (address only) or EJTAG Data Value Break on Store (address + value)
Register
Name
(2)
(2)
(1)
(2)
Function
Debug control and exception status
Program counter at last debug exception
Program counter at last error
Debug handler scratchpad register
2: Registers used during debug.
ResetAssertion MCLR or a Power-On Reset (POR)
DSSEJTAG Debug Single Step
DINTEJTAG Debug Interrupt. Caused by the assertion of the external EJ_DINT input, or by setting the
EjtagBrk bit in the ECR register
NMIAssertion of NMI signal
InterruptAssertion of unmasked hardware or software interrupt signal
DIBEJTAG debug hardware instruction break matched
AdELFetch address alignment error
Fetch reference to protected address
IBEInstruction fetch bus error
DBpEJTAG Breakpoint (execution of SDBBP instruction)
SysExecution of SYSCALL instruction
BpExecution of BREAK instruction
RIExecution of a Reserved Instruction
CpUExecution of a coprocessor instruction for a coprocessor that is not enabled
CEUExecution of a CorExtend instruction when CorExtend is not enabled
OvExecution of an arithmetic instruction that overflowed
TrExecution of a trap (when trap condition is true)
AdELLoad address alignment error
Load reference to protected address
AdESStore address alignment error
Store to protected address
DBELoad or store bus error
DDBLEJTAG data hardware breakpoint matched in load data compare
The PIC32MX3XX/4XX Family core offers a number of
power management features, including low-power
design, active power management, and power-down
modes of operation. The core is a static design that
supports slowing or halting the clocks, which reduces
system power consumption during idle periods.
3.3.1INSTRUCTION-CONTROLLED
POWER MANAGEMENT
The mechanism for invoking power-down mode is
through execution of the WAIT instruction. For more
information on power management, see Section 25.0“Power-Saving Features”.
3.3.2LOCAL CLOCK GATING
The majority of the power consumed by the
PIC32MX3XX/4XX Family core is in the clock tree and
clocking registers. The PIC32MX family uses extensive
use of local gated-clocks to reduce this dynamic power
consumption.
3.4EJTAG Debug Support
The PIC32MX3XX/4XX Family core provides for an
Enhanced JTAG (EJTAG) interface for use in the
software debug of application and kernel code. In
addition to standard user mode and kernel modes of
operation, the PIC32MX3XX/4XX Family core provides
a Debug mode that is entered after a debug exception
(derived from a hardware breakpoint, single-step
exception, etc.) is taken and continues until a debug
exception return (DERET) instruction is executed.
During this time, the processor executes the debug
exception handler routine.
The EJTAG interface operates through the Test Access
Port (TAP), a serial communication port used for
transferring test data in and out of the
PIC32MX3XX/4XX Family core. In addition to the
standard JTAG instructions, special instructions
defined in the EJTAG specification define what
registers are selected and how they are used.
the PIC32MX3XX/4XX family of devices. It
is not intended to be a comprehensive
reference source. Refer to the “PIC32MX
Family Reference Manual” Section 3.
“Memory Organization” (DS61115 ) f o r a
detailed description of this peripheral.
The manual is available from the Microchip
web site (www.Microchip.com/PIC32).
PIC32MX3XX/4XX microcontrollers provide 4 GB of
unified virtual memory address space. All memory
regions including program, data memory, SFRs, and
Configuration registers reside in this address space at
their respective unique addresses. The program and
data memories can be optionally partitioned into user
and kernel memories. In addition, the data memory can
be made executable, allowing PIC32MX3XX/4XX to
execute from data memory.
Key Features:
• 32-bit native data width
• Separate User and Kernel mode address space
• Flexible program Flash memory partitioning
• Flexible data RAM partitioning for data and
program space
• Separate boot Flash memory for protected code
• Robust bus exception handling to intercept
runaway code.
• Simple memory mapping with Fixed Mapping
Translation (FMT) unit
• Cacheable and non-cacheable address regions
4.1PIC32MX3XX/4XX Memory Layout
PIC32MX3XX/4XX microcontrollers implement two
address spaces: Virtual and Physical. All hardware
resources such as program memory, data memory, and
peripherals are located at their respective physical
addresses. Virtual addresses are exclusively used by
the CPU to fetch and execute instructions as well as
access peripherals. Physical addresses are used by
peripherals such as DMA and Flash controller that
access memory independently of CPU.
2: The size of this memory region is programmable (see Section 3. “Memory Organization”
(DS61115)) and can be changed by initialization code provided by end-user development
tools (refer to the specific development tool documentation for information).
KSEG1KSEG0
FIGURE 4-1:MEMORY MAP ON RESET FOR PIC32MX320F032H, PIC32MX420F032H
2: The size of this memory region is programmable (see Section 3. “Memory Organization”
(DS61115)) and can be changed by initialization code provided by end-user development
tools (refer to the specific development tool documentation for information).
KSEG1KSEG0
FIGURE 4-2:MEMORY MAP ON RESET FOR PIC32MX320F064H DEVICES
2: The size of this memory region is programmable (see Section 3. “Memory Organization”
(DS61115)) and can be changed by initialization code provided by end-user development
tools (refer to the specific development tool documentation for information).
KSEG1KSEG0
FIGURE 4-3:MEMORY MAP ON RESET FOR PIC32MX320F128H, PIC32MX320F128L