Note 1:UART1 has assigned pins. UART2 and UART3 are remappable.
2:SPI1 and SPI3 have assigned pins. SPI2 is remappable.
3:SCCP can be configured as a PWM with one output, input capture, output compare, 2 x 16-bit timers or 1 x 32-bit timer.
4:MCCP can be configured as a PWM with up to six outputs, input capture, output compare, 2 x 16-bit timers or
1 x 32-bit timer.
Pins
Program Memory (Kbytes)
Data Memory (Kbytes)
16-Bit Timers Maximum
General Purpose I/O/PPS
PWM Outputs Maximum
Dedicated 16-Bit Timers
(4)
(3)
/LIN/J2602
(1)
UART
MCCP
SCCP
S
2
/I
(2)
CLC
SPI
10/12-Bit ADC (External Channels)
CRC
Comparators
RTCC
C
2
I
USB
Packages
UQFN
UQFN
UQFN
DS60001387D-page 2 2016-2019 Microchip Technology Inc.
Page 3
Pin Diagrams
28-Pin SSOP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
28
27
26
25
24
23
22
21
20
19
18
17
16
15
MCLR
PGEC2/RP1/RA0
PGED2/RP2/RA1
PGED1/RP6/RB0
PGEC1/RP7/RB1
RP8/RB2
TDI/RP9/RB3
V
SS
OSC1/RP3/RA2
OSC2/RP4/RA3
(1)
SOSCI/RP10/RB4
SOSCO/RP5/RA4
V
DD
PGED3/RP11/RB5
V
BUS/RB6
RP12/RB7
TCK/RP13/RB8
(1)
TMS/RP14/RB9
(1,2)
PGEC3/TDO/RP18/RC9
(1)
VCAP
D-/RB10
D+/RB11
V
USB3V3
RP15/RB13
(1)
RP16/RB14
RP17/RB15
(1)
AVSS/VSS
AVDD/VDD
Legend: Shaded pins are up to 5V tolerant.
Note 1: High drive strength pin.
2: This pin may toggle during ICSP programming. Refer to Section 2.6 “JTAG”.
PIC32MM0256GPM028
PIC32MM0256GPM064 FAMILY
TABLE 2:COMPLETE PIN FUNCTION DESCRIPTIONS FOR 28-PIN SSOP DEVICES
2: Alternate pin assignments for I2C1 as determined by the I2C1SEL Configuration bit.
3: This pin may toggle during ICSP programming. Refer to Section 2.6 “JTAG”.
2: Alternate pin assignments for I2C1 as determined by the I2C1SEL Configuration bit.
3: This pin may toggle during ICSP programming. Refer to Section 2.6 “JTAG”.
(2)
/USBID/SS3/FSYNC3/OCM3E/RB5 25 AVDD/VDD
/SCK1/OCM1A/RB8
(1)
(1)
21 AN8/LVDIN/RP15/SCL3/SCK3/OCM3A/RB13
28 PGED2/VREF-/AN1/RP2/OCM1F/RA1
OCM1B/INT2/RB9
USB3V3
(1,3)
(2)
/T3CK/T3G/USBOEN/SDO3/OCM2A/RC9
(1)
/FSYNC1/OCM2B/INT0/RB15
(1)
(1)
DS60001387D-page 4 2016-2019 Microchip Technology Inc.
Page 5
Pin Diagrams (Continued)
36-Pin QFN
(3)
RP8/RB2
TDI/RP9/RB3
RC0
RC1
RP19/RC2
V
SS
OSC1/RP3/RA2
OSC2/RP4/RA3
(1)
SOSCI/RP10/RB4
SOSCO/
RP5
/RA4
RP24/RA9
V
SS
VDD
RC3
V
BUS/RB6
RP12/RB7
TCK/
RP13
/RB8
(1)
TMS/RP14/RB9
(1,2)
RC8
PGEC3/TDO/RP18/RC9
(1)
VCAP
VDD
D+/RB11
V
USB3V3
D-/RB10
RP15/RB13
(1)
RP16/RB14
RP17/RB15
(1)
AVSS/VSS
AVDD/VDD
MCLR
PGEC2/
RP1
/RA0
PGED2/
RP2
/RA1
PGED1/
RP6
/RB0
PGEC1/
RP7
/RB1
9
1
2
3
4
5
161718
101112
13
31
7
6
3635343332
14
15
24
25
26
27
19
20
21
22
23
29
28
8
30
PIC32MM0256GPM036
PGED3/
RP11
/RB5
Legend: Shaded pins are up to 5V tolerant.
Note 1: High drive strength pin.
2: This pin may toggle during ICSP programming. Refer to Section 2.6 “JTAG”.
3: The back side thermal pad is not electrically connected.
PIC32MM0256GPM064 FAMILY
TABLE 4:COMPLETE PIN FUNCTION DESCRIPTIONS FOR 36-PIN QFN DEVICES
PinFunctionPinFunction
1 AN4/C1INB/
2 TDI/AN11/C1INA/
3 AN12/C2IND/T2CK/T2G/RC021 PGEC3/TDO/
4 AN13/T3CK/T3G/RC122 V
5
RP19
6V
SS
7 OSC1/CLKI/AN5/
8 OSC2/CLKO/AN6/C3IND/
9 SOSCI/AN7/
10 SOSCO/SCLKI/
RP24
11
12 V
SS
13 V
DD
14 RC332 MCLR
15 PGED3/
BUS
16 V
RP12
17
18 TCK/
Note 1:
2:
3: This pin may toggle during ICSP programming. Refer to Section 2.6 “JTAG”.
2.0Guidelines for Getting Started with 32-Bit Microcontrollers........................................................................................................ 23
5.0Flash Program Memory.............................................................................................................................................................. 45
14.0 Capture/Compare/PWM/Timer Modules (MCCP and SCCP) .................................................................................................. 141
15.0 Serial Peripheral Interface (SPI) and Inter-IC Sound (I2S)....................................................................................................... 157
18.0 USB On-The-Go (OTG)............................................................................................................................................................ 179
19.0 Real-Time Clock and Calendar (RTCC) ................................................................................................................................... 207
20.0 12-Bit ADC Converter with Threshold Detect........................................................................................................................... 215
25.0 Power-Saving Features ........................................................................................................................................................... 257
26.0 Special Features ...................................................................................................................................................................... 263
27.0 Instruction Set .......................................................................................................................................................................... 281
28.0 Development Support............................................................................................................................................................... 283
Index ................................................................................................................................................................................................. 349
The Microchip Website ...................................................................................................................................................................... 353
Customer Change Notification Service .............................................................................................................................................. 353
Customer Support .............................................................................................................................................................................. 353
Product Identification System ............................................................................................................................................................ 355
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. 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 Website 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., DS30000000A is version A of document DS30000000).
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:
• 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 website at www.microchip.com to receive the most current information on all of our products.
DS60001387D-page 12 2016-2019 Microchip Technology Inc.
Page 13
PIC32MM0256GPM064 FAMILY
Referenced Sources
This device data sheet is based on the following
individual sections of the “PIC32 Family Reference Manual”. These documents should be considered as
the general reference for the operation of a particular
module or device feature.
Note:To access the documents listed below,
browse the documentation section of the
Microchip website (www.microchip.com).
DS60001387D-page 14 2016-2019 Microchip Technology Inc.
Page 15
PIC32MM0256GPM064 FAMILY
UART1,2,3
Comparators
PORTA
PORTB
Priority
ISDS
EJTAGINT
Bus Matrix
RAMPeripheral Bridge
64
64-Bit Wide
Flash
32
32 32
Peripheral Bus Clocked by PBCLK
Program Flash Memory
Controller
32
32
32
Interrupt
Controller
PORTC
I2C1,2,3
SPI1,2,3
SCCP4-9
MCCP1,2,3
OSC1/CLKI
OSC2/CLKO
V
DD,
Timing
Generation
V
SS
MCLR
Power-up
Time r
Oscillator
Start-up Timer
Power-on
Reset
Watchdog
Time r
Brown-out
Reset
Precision
Reference
Band Gap
Regulator
Volt ag e
VCAP
Primary
Dividers
SYSCLK
PBCLK (1:1 with SYSCLK)
Peripheral Bus Clocked by PBCLK
PLL
RTCC
12-Bit ADC
Timer1,2,3
32
32
Oscillator
FRC/LPRC
Oscillators
SOSCO, SCLKI,
Secondary
Oscillator
AVDD, AVSS
I/O Change
Notification
HLVD
MIPS32® microAptiv™ UC
CPU Core
32
PORTD
DMA with
CRC
SOSCI
JTAG
BSCAN
32
Flash
Controller
32
USB
(write)
ICD
Flash Line
Buffer
1.0DEVICE OVERVIEW
Note:This data sheet summarizes the features
of the PIC32MM0256GPM064 family of
devices. It is not intended to be a comprehensive reference source. To complement
the information in this data sheet, refer to
the PIC32 Family Reference Manuals,
This data sheet contains device-specific information for
the PIC32MM0256GPM064 family devices.
Figure 1-1 illustrates a general block diagram of the core
and peripheral modules in the PIC32MM0256GPM064
family of devices.
Table 1-1 lists the pinout I/O descriptions for the pins
shown in the device pin tables.
which are available from the Microchip
website (www.microchip.com/PIC32). The
information in this data sheet supersedes
the information in the FRM.
DS60001387D-page 22 2016-2019 Microchip Technology Inc.
Page 23
PIC32MM0256GPM064 FAMILY
2.0GUIDELINES FOR GETTING
STARTED WITH 32-BIT
MICROCONTROLLERS
Note:This data sheet summarizes the features
of the PIC32MM0256GPM064 family of
devices. It is not intended to be a comprehensive reference source. To complement
the information in this data sheet, refer to the
“PIC32 Family Reference Manual”, which is
available from the Microchip website
www.microchip.com/PIC32). The infor-
(
mation in this data sheet supersedes the
information in the FRM.
2.1Basic Connection Requirements
Getting started with the PIC32MM0256GPM064 family
of 32-bit Microcontrollers (MCUs) requires attention to
a minimal set of device pin connections before pro
ceeding with development. The following is a list of pin
names, which must always be connected:
•All VDD and VSS pins
(see Section 2.2 “Decoupling Capacitors”)
•All AVDD and AVSS pins, even if the ADC module
is not used (see
Capacitors”)
• MCLR pin (see Section 2.3 “Master Clear
(MCLR) Pin”)
•VCAP pin (see Section 2.4 “Voltage Regulator
Pin (VCAP)”)
• PGECx/PGEDx pins, used for In-Circuit Serial
Programming™ (ICSP™) and debugging
purposes (see Section 2.5 “ICSP Pins”)
• OSC1 and OSC2 pins, when external oscillator
source is used (see
Oscillator Pins”)
•VUSB3V3 pin, this pin must be powered for USB
operation (see Section 18.4 “Powering the USB
Transceiver”)
The following pin(s) may be required as well:
VREF+/VREF- pins, used when external voltage
reference for the ADC module is implemented
Note:The AVDD and AVSS pins must be
Section 2.2 “Decoupling
Section 2.7 “External
.
connected, regardless of ADC use and
the ADC voltage reference source.
2.2Decoupling Capacitors
The use of decoupling capacitors on power supply
pins, such as V
Figure 2-1.
See
Consider the following criteria when using decoupling
capacitors:
• Value and type of capacitor: A value of 0.1 µF
(100 nF), 10-20V is recommended. The capacitor
should be a low Equivalent Series Resistance
(low-ESR) capacitor and have resonance frequency
in the range of 20
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 that the
capacitors be placed 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 one-quarter inch
mm) in length.
(6
• 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 capaci
tor. The value of the second capacitor can be in the
range of 0.01
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.
Note 1: 470 R1 1 k 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 VIH and VIL specifications are met without
interfering with the debugger/programmer tools.
2: The capacitor can be sized to prevent unintentional
Resets from brief glitches or to extend the device
Reset period during POR.
3: No pull-ups or bypass capacitors are allowed on active
debug/program PGECx/PGEDx pins.
R1
(1)
10k
V
DD
MCLR
PIC32
1 k
0.1 µF
(2)
PGECx
(3)
PGEDx
(3)
ICSP™
1
5
4
2
3
6
V
DD
VSS
NC
R
C
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.
For example, as illustrated in Figure 2-2, it is
recommended that the capacitor, C, be isolated from
the
MCLR pin during programming and debugging
operations.
Place the components illustrated in Figure 2-2 within
one-quarter inch (6 mm) from the MCLR pin.
FIGURE 2-2:EXAMPLE OF MCLR PIN
CONNECTIONS
(1,2,3)
2.3Master 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 illustrates 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
levels (V
not be adversely affected. Therefore, specific values
of R and C will need to be adjusted based on the
application and PCB requirements.
Note:When MCLR is used to wake the device
DS60001387D-page 24 2016-2019 Microchip Technology Inc.
MCLR pin. Consequently, specific voltage
IH and VIL) and fast signal transitions must
from Retention Sleep, a POR Reset will
occur.
Page 25
PIC32MM0256GPM064 FAMILY
10
1
0.1
0.01
0.001
0.010.11101001000 10,000
Frequency (MHz)
ESR ()
Note: Typical data measurement at +25°C, 0V DC bias.
2.4Voltage Regulator Pin (VCAP)
A low-ESR (< 5Ω) capacitor is required on the VCAP pin
to stabilize the output voltage of the on-chip voltage
regulator. The V
CAP pin must not be connected to VDD
FIGURE 2-3:FREQUENCY vs. ESR
PERFORMANCE FOR
SUGGESTED V
CAP
and must use a capacitor of 10 µF connected to ground.
The type can be ceramic or tantalum. Suitable examples
of capacitors are shown in
Table 2-1. Capacitors with
equivalent specification can be used.
The placement of this capacitor should be close to VCAP.
It is recommended that the trace length not exceed
inch (6 mm). Refer to Section 29.0 “Electrical
0.25
Characteristics” for additional information.
Designers may use Figure 2-3 to evaluate ESR
equivalence of candidate devices.
In recent years, large value, low-voltage, surface-mount
ceramic capacitors have become very cost effective in
sizes up to a few tens of microfarad. The low-ESR, small
physical size and other properties make ceramic
capacitors very attractive in many types of applications.
Ceramic capacitors are suitable for use with the internal voltage regulator of this microcontroller. However,
some care is needed in selecting the capacitor to
ensure that it maintains sufficient capacitance over the
intended operating range of the application.
Typical low-cost, 10 µF ceramic capacitors are available
in X5R, X7R and Y5V dielectric ratings (other types are
also available, but are less common). The initial
tolerance specifications for these types of capacitors
are often specified as ±10% to ±20% (X5R and X7R)
or -20%/+80% (Y5V). However, the effective capaci
tance that these capacitors provide in an application
circuit will also vary based on additional factors, such as
the applied DC bias voltage and the temperature. The
total in-circuit tolerance is, therefore, much wider than
the initial tolerance specification.
The X5R and X7R capacitors typically exhibit satisfactory temperature stability (ex: ±15% over a wide
temperature range, but consult the manufacturer’s data
sheets for exact specifications). However, Y5V capacitors typically have extreme temperature tolerance
specifications of +22%/-82%. Due to the extreme
temperature tolerance, a 10 µF nominal rated Y5V type
capacitor may not deliver enough total capacitance to
meet minimum internal voltage regulator stability and
transient response requirements. Therefore, Y5V
capacitors are not recommended for use with the
internal regulator.
In addition to temperature tolerance, the effective
capacitance of large value ceramic capacitors can vary
substantially, based on the amount of DC voltage applied
to the capacitor. This effect can be very significant, but is
often overlooked or is not always documented.
Typical DC bias voltage vs. capacitance graph for X7R
type capacitors is shown in
Figure 2-4.
-
When selecting a ceramic capacitor to be used with the
internal voltage regulator, it is suggested to select a
high-voltage rating, so that the operating voltage is a
small percentage of the maximum rated capacitor
voltage. The minimum DC rating for the ceramic
capacitor on V
shown in
CAP is 16V. Suggested capacitors are
Table 2-1.
2.5ICSP Pins
The PGECx and PGEDx pins are used for In-Circuit
Serial Programming™ (ICSP™) and debugging pur
poses. 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 connec
tor 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.
Alternatively, 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
IH) and Input Voltage Low (VIL) requirements.
(V
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 3 or MPLAB REAL ICE™ In-Circuit
Emulator.
For more information on MPLAB® ICD 3 and REAL ICE
connection requirements, refer to the following
documents that are available from the Microchip website.
• “Using MPLAB® ICD 3” (poster) (DS51765)
• “Development Tools Design Advisory” (DS51764)
• “MPLAB® REAL ICE™ In-Circuit Emulator User’s
Guide” (DS51616)
• “Using MPLAB® REAL ICE™ In-Circuit Emulator”
(poster) (DS51749)
-
-
FIGURE 2-4:DC BIAS VOLTAGE vs.
DS60001387D-page 26 2016-2019 Microchip Technology Inc.
CAPACITANCE
CHARACTERISTICS
Page 27
PIC32MM0256GPM064 FAMILY
Main Oscillator
Guard Ring
Guard Trace
Secondary
Oscillator
2.6JTAG
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 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
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.
Alternatively, 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
and Input Voltage Low (V
Note 1: The TMS pin function may be active
multiple times during ICSP device Erase,
Programming and Debugging. When the
TMS function is active, the integrated
pull-up resistor, ~6k, will pull the pin to
DD. When the TMS function is inactive,
V
the pin will be tri-state. The TMS function
being enabled and disabled repeatedly
results in the pin “toggling.”
• Do not connect circuity to the TMS
pin that could be adversely affected
by the toggling.
• If circuity connected to the TMS pin
is sensitive to the “toggling” do not
program the device in circuit.
• Use a strong pull-down resistor
such as 1k between the TMS pin to
ground to overpower the pull-up.
Ohms.
IH)
IL) requirements.
2.7External Oscillator Pins
This family of devices has options for two external
oscillators: a high-frequency Primary Oscillator and a
low-frequency Secondary Oscillator (refer to
Section 9.0 “Oscillator Configuration” 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 illustrated in
Figure 2-5.
For additional information and design guidance on
oscillator circuits, please refer to these Microchip
Application Notes, available at the corporate website:
(www.microchip.com).
•AN826, “Crystal Oscillator Basics and Crystal
Selection for rfPIC™ and PICmicro
•AN849, “Basic PICmicro® Oscillator Design”
•AN943, “Practical PICmicro® Oscillator Analysis
and Design”
•AN949, “Making Your Oscillator Work”
®
Devices”
FIGURE 2-5:SUGGESTED OSCILLATOR
CIRCUIT PLACEMENT
2.8Unused I/Os
To minimize power consumption, unused I/O pins
should not be allowed to float as inputs. They can be
configured as outputs and driven to a logic low or logic
high state.
Alternatively, inputs can be reserved by ensuring the
pin is always configured as an input and externally con
necting the pin to VSS or VDD. A current-limiting resistor
may be used to create this connection if there is any
risk of inadvertently configuring the pin as an output
with the logic output state opposite of the chosen power
rail.
DS60001387D-page 28 2016-2019 Microchip Technology Inc.
Page 29
PIC32MM0256GPM064 FAMILY
3.0CPU
Note:This data sheet summarizes the features
of the PIC32MM0256GPM064 family of
devices. It is not intended to be a
comprehensive reference source. To
complement the information in this data
sheet, refer to Section 50. “CPU for
Devices with MIPS32
M-Class Cores” (www.microchip.com/
DS60001192) in the “PIC32 Family Refer
ence Manual”. MIPS32® microAptiv™ UC
microprocessor core resources are available at: www.imgtec.com. The information
in this data sheet supersedes the
information in the FRM.
The MIPS32® microAptiv™ UC microprocessor core is
the heart of the PIC32MM0256GPM064 family
devices. The CPU fetches instructions, decodes each
instruction, fetches source operands, executes each
instruction and writes the results of the instruction
execution to the proper destinations.
3.1Features
The PIC32MM0256GPM064 family processor core key
features include:
• Five-Stage Pipeline
• 32-Bit Address and Data Paths
• MIPS32 Enhanced Architecture:
- Multiply-add and multiply-subtract instructions.
- Targeted multiply instruction.
- Zero and one detect instructions.
- WAIT instruction.
- Conditional move instructions.
- Vectored interrupts.
- Atomic interrupt enable/disable.
- One GPR shadow set to minimize latency of
interrupts.
- Bit field manipulation instructions.
• microMIPS™ Instruction Set:
- microMIPS allows improving the code size
density over MIPS32, while maintaining
MIPS32 performance.
- microMIPS supports all MIPS32 instructions
(except for branch-likely instructions) with
new optimized 32-bit encoding. Frequent
MIPS32 instructions are available as 16-bit
instructions.
- Added seventeen new and thirty-five
MIPS32
instructions in 16-bit opcode format.
- Stack Pointer implicit in instruction.
- MIPS32 assembly and ABI compatible.
®
corresponding, commonly used
®
microAptiv™ and
-
• Memory Management Unit with Simple Fixed
Mapping Translation (FMT) Mechanism
• Multiply/Divide Unit (MDU):
- Configurable using high-performance
multiplier array.
- Maximum issue rate of one 32x16 multiply
per clock.
- Maximum issue rate of one 32x32 multiply
every other clock.
- Early-in iterative divide. Minimum 11 and
maximum 33 clock latency (dividend (rs) sign
extension dependent).
• Power Control:
- No minimum frequency: 0 MHz.
- Power-Down mode (triggered by WAIT
instruction).
• EJTAG Debug/Profiling:
- CPU control with start, stop and single
stepping.
- Software breakpoints via the SDBBP
instruction.
- Simple hardware breakpoints on virtual
addresses, four instructions and
two data breakpoints.
- PC and/or load/store address sampling for
profiling.
- Performance counters.
- Supports Fast Debug Channel (FDC).
A block diagram of the PIC32MM0256GPM064 family
processor core is shown in
FIGURE 3-1:PIC32MM0256GPM064 FAMILY MICROPROCESSOR CORE BLOCK DIAGRAM
DS60001387D-page 30 2016-2019 Microchip Technology Inc.
Page 31
PIC32MM0256GPM064 FAMILY
3.2Architecture Overview
The MIPS32® microAptiv™ UC microprocessor core in
the PIC32MM0256GPM064 family devices contains
several logic blocks, working together in parallel, pro
viding an efficient high-performance computing engine.
The following blocks are included with the core:
• Execution Unit
• General Purpose Register (GPR)
• Multiply/Divide Unit (MDU)
• System Control Coprocessor (CP0)
• Memory Management Unit (MMU)
• Power Management
• microMIPS Instructions Decoder
• Enhanced JTAG (EJTAG) Controller
3.2.1EXECUTION UNIT
The processor core execution unit implements a load/
store architecture with single-cycle ALU operations
(logical, shift, add, subtract) and an autonomous Multiply/
Divide Unit (MDU). The core contains thirty-two 32-bit
General Purpose Registers (GPRs) 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 instruction streams where data producing instructions are followed closely by consumers
for their results
• Leading zero/one detect unit for implementing the
CLZ and CLO instructions
• Arithmetic Logic Unit (ALU) for performing
arithmetic and bitwise logical operations
• Shifter and store aligner
-
3.2.2MULTIPLY/DIVIDE UNIT (MDU)
The microAptiv UC 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 the longrunning 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
microAptiv UC core only checks the value of the 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 16-bit wide rs, 15 iterations are skipped, and for a
24-bit wide 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 has completed.
Table 3-1 lists the repeat rate (peak issue rate of cycles
until the operation can be re-issued), and latency
(number of cycles until a result is available) for the
microAptiv UC core multiply and divide instructions.
The approximate latency and repeat rates are listed in
terms of pipeline clocks.
TABLE 3-1:MULTIPLY/DIVIDE UNIT LATENCIES AND REPEAT RATES
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 MIPS
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 avoid
ing 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
multiply-accumulate and multiply-subtract operations.
The MADD instruction multiplies two numbers and then
adds 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. These
configuration options and other system information are
available by accessing the CP0 registers listed in
Table 3-2.
DS60001387D-page 32 2016-2019 Microchip Technology Inc.
Page 33
PIC32MM0256GPM064 FAMILY
TABLE 3-2:COPROCESSOR 0 REGISTERS
Register
Number
0-3
4UserLocalUser information that can be written by privileged software and read via
5-6
7HWREnaEnables access via the RDHWR instruction to selected hardware registers in
8BadVAddr
9Count
10Reserved Reserved in the microAptiv UC.
11Compare
12Status/
13Cause
14EPC
15PRId/
16CONFIG/
7-22
23 Debug/
24DEPC
25PerfCtl0/
26ErrCtlSoftware parity check enable.
27CacheErrRecords information about SRAM parity errors.
28-29
30ErrorEPC
31DeSAVE
Note 1:Registers used in exception processing.
2:Registers used in debug.
Register
Name
Reserved Reserved in the microAptiv™ UC.
RDHWR Register 29.
Reserved Reserved in the microAptiv UC.
Non-Privileged mode.
(1)
(1)
(1)
Reports the address for the most recent address related exception.
Processor cycle count.
Timer interrupt control.
Processor status and control; interrupt control and shadow set control.
IntCtl/
SRSCtl/
SRSMap1/
View_IPL/
SRSMAP2
(1)
/
Cause of last exception.
View_RIPL
(1)
Program Counter at last exception.
Processor identification and revision; exception base address; Common Device
EBase/
The processor 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 sup
ports slowing or halting of the clocks, which reduces
system power consumption during Idle periods.
The mechanism for invoking Power-Down mode is
implemented through execution of the WAIT instruc
tion, used to initiate Sleep or Idle. The majority of
the power consumed by the processor core is in the
clock tree and clocking registers. The PIC32MM
family makes extensive use of local gated clocks to
reduce this dynamic power consumption.
-
-
3.4EJTAG Debug Support
The microAptiv UC core has an Enhanced JTAG
(EJTAG) interface for use in the software debug. In
addition to the standard mode of operation, the
microAptiv UC core provides a Debug mode that is
entered after a debug exception (derived from a hard
ware 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 trans
ferring test data in and out of the microAptiv UC core.
In addition to the standard JTAG instructions, special
instructions defined in the EJTAG specification specify
which registers are selected and how they are used.
-
3.5MIPS32® microAptiv™ UC Core
Configuration
Register 3-1 through Register 3-4 show the default
configuration of the microAptiv UC core, which is
included on PIC32MM0256GPM064 family devices.
DS60001387D-page 34 2016-2019 Microchip Technology Inc.
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-1Unimplemented: Read as ‘0’
bit 0NF: Nested Fault bit
1 = Nested Fault feature is implemented
Bit
DS60001387D-page 38 2016-2019 Microchip Technology Inc.
Page 39
PIC32MM0256GPM064 FAMILY
4.0MEMORY ORGANIZATION
PIC32MM microcontrollers provide 4 GBytes of unified
virtual memory address space. All memory regions,
including program memory, data memory, SFRs and
Configuration registers, reside in this address space at
their respective unique addresses. The data memory
can be made executable, allowing the CPU to execute
code from data memory.
Key features include:
• 32-Bit Native Data Width
• Separate Boot Flash Memory (BFM) for
Protected Code
• Robust Bus Exception Handling to Intercept
Runaway Code
• Simple Memory Mapping with Fixed Mapping
Translation (FMT) Unit
The PIC32MM0256GPM064 family devices 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. Physical
addresses are used by peripherals, such as Flash
controllers, that access memory independently of the
CPU.
The virtual address space is divided into two segments
of 512 Mbytes each, labeled kseg0 and kseg1. The
Program Flash Memory (PFM) and Data RAM Memory
(DRM) are accessible from either kseg0 or kseg1, while
the Boot Flash Memory (BFM) and peripheral SFRs are
accessible only from kseg1.
The Fixed Mapping Translation (FMT) unit translates
the memory segments into corresponding physical
address regions.
trate the fixed mapping scheme, implemented by the
PIC32MM0256GPM064 family core, between the
virtual and physical address space.
The mapping of the memory segments depends on the
CPU error level, set by the ERL bit in the CPU STATUS
Register. Error level is set (ERL = 1) by the CPU on a
Reset, Soft Reset or Non-Maskable Interrupt (NMI). In
this mode, the CPU can access memory by the physi
cal address. This mode is provided for compatibility
with other MIPS processor cores that use a TLB-based
MMU. The C start-up code clears the ERL bit to zero,
so that when application software starts up, it sees the
proper virtual to physical memory mapping.
Figure 4-1 through Figure 4-3 illus-
-
4.1Alternate Configuration Bits
Space
Every Configuration Word has an associated Alternate
Word (designated by the letter A as the first letter in the
name of the word). During device start-up, Primary
Words are read, and if uncorrectable ECC errors are
found, the BCFGERR (RCON[27]) flag is set and
Alternate Words are used. If uncorrectable ECC errors
are found in Primary and Alternate Words, the
BCFGFAIL (RCON[26]) flag is set, and the default con
figuration is used. The Primary Configuration bits’ area
is located at the address range, from 0x1FC01780 to
0x1FC017E8. The Alternate Configuration bits’ area is
located at the address range, from 0x1FC01700 to
0x1FC01768.
-
4.2Bus Matrix (BMX)
The BMX is a switch fabric that connects the system
bus initiators (Flash controller, CPU instruction, CPU
data, system DMA and USB) to bus targets (RAM,
Flash and peripherals without integrated DMA). All data
and instructions are transferred through this bus. Only
one initiator can connect to a given target at a time.
Multiple initiators can be active at one time provided
each one has a separate target. Multiple priority modes
(Round Robin, Fixed CPU Highest and Fixed CPU
Lowest) are available to allow the priority to be tailored
to the application needs. Mode 0 is a Fixed Priority
mode with the CPU having the highest priority (refer to
Ta bl e 4-1). For most applications, this mode should be
sufficient; however, it is possible for the CPU to generate
sufficient bus traffic to ‘starve’ the other initiators
attempting to access Flash memory, preventing them
from performing transfers in the required time limit. If this
‘starvation’ occurs, the Round Robin or CPU Lowest
mode should be chosen.
Mode 1 is a Fixed Priority mode with the CPU having
the lowest priority (refer to
reduce the latency of DMA transfers because the DMA
engines have a higher priority than the CPU.
Mode 2 is a Round Robin or Rotating Priority mode. The
initiator’s priority for each target rotates with every
access. This ensures, not that the initiator is starved, but
the latency for accesses changes with every access; this
makes the latency variable.
The Arbitration mode is selected by the BMXARB[1:0]
bits (CFGCON[25:24]).
Note:The CPU has two initiators: one for data
and the other for instructions. In all Arbitra
tion modes, the CPU data initiator has
higher priority than the CPU instruction
initiator.
effect on system performance when a
contention for a target occurs.
The Flash controller, when programming
memory, always has the highest priority
regardless of the priority mode setting.
Refer to Section 48. “Memory Organization and Permissions” (www.microchip.com/DS60001214) in
the “PIC32 Family Reference Manual” for more
information regarding Bus Matrix operation.
4.3Flash Line Buffer
The Flash line buffer is a buffer that resides between
the Bus Matrix and the Flash memory. When a Flash
fetch is generated, an aligned double word (64 bits) is
read. This is then placed in the Flash line buffer. If the
next initiator requested address’s data are contained in
the Flash line buffer, they are read directly without
requiring another Flash fetch; if they are not in the
Flash line buffer, a Flash fetch is generated.
DS60001387D-page 40 2016-2019 Microchip Technology Inc.
Page 41
PIC32MM0256GPM064 FAMILY
Virtual
Memory Map
0x00000000
Reserved
0x7FFFFFFF
0x80000000
16 Kbytes RAM
0x80003FFF
0x80004000
Reserved
0x9CFFFFFF
0x9D000000
64 Kbytes Flash
0x9D00FFFF
0x9D010000
Reserved
Physical
Memory Map
0x9F7FFFFF
0x9F800000
SFRs
(2)
16 Kbytes RAM
0x00000000
0x9F80FFFF0x00003FFF
0x9F810000
ReservedReserved
0x00004000
0x9FBFFFFF0x1CFFFFFF
0x9FC00000
Boot Flash
(2)
64 Kbytes Flash
0x1D000000
0x9FC016FF0x1D00FFFF
0x9FC01700
Configuration Bits
(2,3)
Reserved
0x1D010000
0x9FC017FF0x1F7FFFFF
0x9FC01800
ReservedSFRs
0x1F800000
0x9FFFFFFF0x1F80FFFF
0xA0000000
16 Kbytes RAM
Reserved
0x1F810000
0xA0003FFF0x1FBFFFFF
0xA0004000
ReservedBoot Flash
0x1FC00000
0xBCFFFFFF0x1FC016FF
0xBD000000
64 Kbytes Flash
Configuration Bits
(3)
0x1FC01700
0xBD00FFFF0x1FC017FF
0xBD010000
ReservedReserved
0x1FC01800
0xBF7FFFFF0xFFFFFFFF
0xBF800000
SFRs
0xBF80FFFF
0xBF810000
Reserved
0xBFBFFFFF
0xBFC00000
Boot Flash
0xBFC016FF
0xBFC01700
Configuration Bits
(3)
0xBFC017FF
0xBFC01800
Reserved
0xFFFFFFFF
Note 1: Memory areas are not shown to scale.
2: This region should be accessed from kseg1 space only.
3: Primary Configuration bits’ area is located at the address range, from 0x1FC01780 to 0x1FC017E8.
Alternate Configuration bits’ area is located at the address range, from 0x1FC01700 to 0x1FC01768.
Refer to Section 4.1 “Alternate Configuration Bits Space” for more information.
kseg1
kseg0
FIGURE 4-1:MEMORY MAP FOR DEVICES WITH 64 Kbytes OF PROGRAM MEMORY
2: This region should be accessed from kseg1 space only.
3: Primary Configuration bits’ area is located at the address range, from 0x1FC01780 to 0x1FC017E8.
Alternate Configuration bits’ area is located at the address range, from 0x1FC01700 to 0x1FC01768.
Refer to Section 4.1 “Alternate Configuration Bits Space” for more information.
kseg1kseg0
FIGURE 4-2:MEMORY MAP FOR DEVICES WITH 128 Kbytes OF PROGRAM MEMORY
(1)
DS60001387D-page 42 2016-2019 Microchip Technology Inc.
Page 43
PIC32MM0256GPM064 FAMILY
Virtual
Memory Map
0x00000000
Reserved
0x7FFFFFFF
0x80000000
32 Kbytes RAM
0x80007FFF
0x80008000
Reserved
0x9CFFFFFF
0x9D000000
256 Kbytes Flash
0x9D003FFF
0x9D004000
Reserved
Physical
Memory Map
0x9F7FFFFF
0x9F800000
SFRs
(2)
32 Kbytes RAM
0x00000000
0x9F80FFFF0x00007FFF
0x9F810000
ReservedReserved
0x00008000
0x9FBFFFFF0x1CFFFFFF
0x9FC00000
Boot Flash
(2)
256 Kbytes Flash
0x1D000000
0x9FC016FF0x1D03FFFF
0x9FC01700
Configuration Bits
(2,3)
Reserved
0x1D040000
0x9FC017FF0x1F7FFFFF
0x9FC01800
ReservedSFRs
0x1F800000
0x9FFFFFFF0x1F80FFFF
0xA0000000
32 Kbytes RAM
Reserved
0x1F810000
0xA0007FFF0x1FBFFFFF
0xA0008000
ReservedBoot Flash
0x1FC00000
0xBCFFFFFF0x1FC016FF
0xBD000000
256 Kbytes FlashConfiguration Bits
(3)
0x1FC01700
0xBD03FFFF0x1FC017FF
0xBD040000
ReservedReserved
0x1FC01800
0xBF7FFFFF
0xFFFFFFFF
0xBF800000
SFRs
0xBF80FFFF
0xBF810000
Reserved
0xBFBFFFFF
0xBFC00000
Boot Flash
0xBFC016FF
0xBFC01700
Configuration Bits
(3)
0xBFC017FF
0xBFC01800
Reserved
0xFFFFFFFF
Note 1: Memory areas are not shown to scale.
2: This region should be accessed from kseg1 space only.
3: Primary Configuration bits’ area is located at the address range, from 0x1FC01780 to 0x1FC017E8.
Alternate Configuration bits’ area is located at the address range, from 0x1FC01700 to
0x1FC01768. Refer to Section 4.1 “Alternate Configuration Bits Space” for more information.
kseg1
kseg0
FIGURE 4-3:MEMORY MAP FOR DEVICES WITH 256 Kbytes OF PROGRAM MEMORY
of the PIC32MM0256GPM064 family of
devices. It is not intended to be a
comprehensive reference source. To com
plement the information in this data sheet,
refer to Section 5. “Flash Programming”
(www.microchip.com/DS60001121) in the “PIC32 Family Reference Manual”. The
information in this data sheet supersedes
the information in the FRM.
PIC32MM0256GPM064 family devices contain an
internal Flash program memory for executing user
code. The program and Boot Flash can be writeprotected. The erase page size is 512 32-bit words.
The program row size is 64 32-bit words. The memory
can be programmed by rows or by two 32-bit words,
called double-words.
Note:Double-words must be 64-bit aligned.
The devices implement a 6-bit Error Correcting Code
(ECC). The memory control block contains a logic to
write and read ECC bits to and from the Flash memory.
The Flash is programmed at the same time as the cor
responding ECC bits. The ECC provides improved
resistance to Flash errors. The ECC single-bit error
generates an interrupt and can be transparently
corrected. The ECC double-bit error results in a bus
error exception.
-
-
There are three methods by which the user can
program this memory:
• Run-Time Self-Programming (RTSP)
• EJTAG Programming
• In-Circuit Serial Programming™ (ICSP™)
RTSP is performed by software executing from either
Flash or RAM memory. Information about RTSP
techniques is described in Section 5. “Flash Programming” (www.microchip.com/DS60001121) in
the “PIC32 Family Reference Manual”. EJTAG pro
gramming is performed using the JTAG port of the
device. ICSP programming requires fewer connections
than for EJTAG programming. The EJTAG and ICSP
methods are described in the “PIC32 Flash Programming Specification” (DS60001145), which is available
for download from the Microchip website.
-
-
5.1Flash Controller Registers Write
Protection
The NVMPWP and NVMBWP registers, and the WR bit
in the NVMCON register are protected (locked) from an
accidental write. Each time a special unlock sequence
is required to modify the content of these registers or
bits. To unlock, the following steps should be done:
1.Disable interrupts prior to the unlock sequence.
2.Execute the system unlock sequence by writing
the key values of 0xAA996655 and 0x556699AA
to the NVMKEY register.
Legend:HS = Hardware Settable bitHC = Hardware Clearable bit
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedr = Reserved bit
bit 31-16 Unimplemented: Read as ‘0’
bit 15WR: Write Control bit
(1,3)
This bit cannot be cleared and can be set only when WREN = 1, and the unlock sequence has been performed.
1 = Initiates a Flash operation
0 = Flash operation is complete or inactive
bit 14WREN: Write Enable bit
(1)
1 = Enables writes to the WR bit and disables writes to the NVMOP[3:0] bits
0 = Disables writes to the WR bit and enables writes to the NVMOP[3:0] bits
bit 13WRERR: Write Error bit
(1,2)
This bit can be cleared only by setting the NVMOP[3:0] bits = 0000 and initiating a Flash operation.
1 = Program or erase sequence did not complete successfully
0 = Program or erase sequence completed normally
bit 12LVDERR: Low-Voltage Detect Error bit
(1,2)
This bit can be cleared only by setting the NVMOP[3:0] bits = 0000 and initiating a Flash operation.
1 = Low-voltage is detected (possible data corruption if WRERR is set)
0 = Voltage level is acceptable for programming
bit 11Reserved: Maintain as ‘0’
bit 10-4Unimplemented: Read as ‘0’
Bit
24/16/8/0
Note 1:These bits are only reset by a Power-on Reset (POR) and are not affected by other Reset sources.
2:These bits are cleared by setting NVMOP[3:0] = 0000 and initiating a Flash operation (i.e., WR).
3:This bit is only writable when the NVMKEY unlock sequence is followed. Refer to Example 5-1.
REGISTER 5-1:NVMCON: PROGRAMMING CONTROL REGISTER (CONTINUED)
bit 3-0NVMOP[3:0]: NVM Operation bits
These bits are only writable when WREN = 0.1111 = Reserved
•
•
•
1000 = Reserved
0111 = Program Erase Operation: Erases all of Program Flash Memory (all pages must be unprotected,
PWP[23:0] = 0x000000, Boot Flash Memory is not erased)
0110 = Reserved
0101 = Reserved
0100 = Page Erase Operation: Erases page selected by NVMADDR if it is not write-protected
0011 = Row Program Operation: Programs row selected by NVMADDR if it is not write-protected
0010 = Double-Word Program Operation: Programs two words to address selected by NVMADDR if it is not
write-protected
0001 = Reserved
0000 = No operation (clears the WRERR and LVDERR status bits when executed)
Note 1:These bits are only reset by a Power-on Reset (POR) and are not affected by other Reset sources.
2:These bits are cleared by setting NVMOP[3:0] = 0000 and initiating a Flash operation (i.e., WR).
3:This bit is only writable when the NVMKEY unlock sequence is followed. Refer to Example 5-1.
REGISTER 5-2:NVMKEY: PROGRAMMING UNLOCK REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-0NVMKEY[31:0]: Programming Unlock Register bits
Note:This register is used as part of the unlock sequence to prevent inadvertent writes to the PFM. Refer to
Bit
31/23/15/7
W-0W-0W-0W-0W-0W-0W-0W-0
W-0W-0W-0W-0W-0W-0W-0W-0
W-0W-0W-0W-0W-0W-0W-0W-0
W-0W-0W-0W-0W-0W-0W-0W-0
These bits are write-only and read as ‘0’ on any read.
Example 5-1.
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
NVMKEY[31:24]
NVMKEY[23:16]
NVMKEY[15:8]
NVMKEY[7:0]
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
DS60001387D-page 48 2016-2019 Microchip Technology Inc.
Page 49
PIC32MM0256GPM064 FAMILY
NVMOP[3:0]
Selection
Flash Address Bits (NVMADDR[31:0])
Page EraseAddress identifies the page to erase (NVMADDR[10:0] are ignored).
Row ProgramAddress identifies the row to program (NVMADDR[7:0] are ignored).
Double-Word Program Address identifies the double-word (64-bit) to program (NVMADDR[2:0] bits are
ignored).
Note: Must be 64-bit aligned.
Bit
(1)
(1)
(1)
(1)
Bit
26/18/10/2
Bit
25/17/9/1
24/16/8/0
REGISTER 5-3:NVMADDR: FLASH ADDRESS REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
27/19/11/3
NVMADDR[31:24]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMADDR[23:16]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMADDR[15:8]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMADDR[7:0]
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-0NVMADDR[31:0]: Flash Address bits
(1)
Bit
Note 1: For all other NVMOP[3:0] bits settings, the Flash address is ignored. See the NVMCON register
Register 5-1) for additional information on these bits.
(
Note:The bits in this register are only reset by a Power-on Reset (POR) and are not affected by other Reset sources.
REGISTER 5-4:NVMDATAx: FLASH DATA x REGISTER (x = 0-1)
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Bit
30/22/14/6
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
NVMDATAx[31:24]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMDATAx[23:16]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMDATAx[15:8]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMDATAx[7:0]
Bit
24/16/8/0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-0NVMDATAx[31:0]: Flash Data x bits
Double-Word Program: Writes NVMDATA1:NVMDATA0 to the target Flash address defined in NVMADDR.
NVMDATA0 contains the least significant instruction word.
Note:The bits in this register are only reset by a Power-on Reset (POR) and are not affected by other Reset sources.
REGISTER 5-5:NVMSRCADDR: SOURCE DATA ADDRESS REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-0NVMSRCADDR[31:0]: Source Data Address bits
Note:The bits in this register are only reset by a Power-on Reset (POR) and are not affected by other Reset sources.
Bit
31/23/15/7
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Bit
30/22/14/6
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
NVMSRCADDR[31:24]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMSRCADDR[23:16]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMSRCADDR[15:8]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
NVMSRCADDR[7:0]
The system physical address of the data to be programmed into the Flash when the NVMOP[3:0] bits
(NVMCON[3:0]) are set to perform row programming.
DS60001387D-page 50 2016-2019 Microchip Technology Inc.
Page 51
PIC32MM0256GPM064 FAMILY
REGISTER 5-6:NVMPWP: PROGRAM FLASH WRITE-PROTECT REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31PWPULOCK: Program Flash Memory Page Write-Protect Unlock bit
bit 30-24 Unimplemented: Read as ‘0’
bit 23-0PWP[23:0]: Flash Program Write-Protect (Page) Address bits
Bit
31/23/15/7
R/W-1U-0U-0U-0U-0U-0U-0U-0
PWPULOCK———————
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
1 = Register is not locked and can be modified
0 = Register is locked and cannot be modified
This bit is only clearable and cannot be set except by any Reset.
Physical memory below address, 0x1DXXXXXX, is write-protected, where ‘XXXXXX’ is specified by
PWP[23:0]. When the PWP[23:0] bits have a value of ‘0’, write protection is disabled for the entire Program
Flash Memory. If the specified address falls within the page, the entire page and all pages below the current
page will be protected.
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
PWP[23:16]
PWP[15:8]
PWP[7:0]
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
24/16/8/0
Bit
Note:The bits in this register are only writable when the NVMKEY unlock sequence is followed. Refer to
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0’
bit 15BWPULOCK: Boot Alias Write-Protect Unlock bit
bit 14-11 Unimplemented: Read as ‘0’
bit 10BWP2: Boot Alias Page 2 Write-Protect bit
bit 9BWP1: Boot Alias Page 1 Write-Protect bit
bit 8BWP0: Boot Alias Page 0 Write-Protect bit
bit 7-0Unimplemented: Read as ‘0’
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
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
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
R/W-1U-0U-0U-0U-0R/W-1R/W-1R/W-1
BWPULOCK————BWP2
U-0U-0U-0U-0U-0U-0U-0U-0
(1)
BWP1
(1)
————————
1 = BWPx bits are not locked and can be modified
0 = BWPx bits are locked and cannot be modified
This bit is only clearable and cannot be set except by any Reset.
(1)
1 = Write protection for physical address, 0x01FC08000 through 0x1FC0BFFF, is enabled
0 = Write protection for physical address, 0x01FC08000 through 0x1FC0BFFF, is disabled
(1)
1 = Write protection for physical address, 0x01FC04000 through 0x1FC07FFF, is enabled
0 = Write protection for physical address, 0x01FC04000 through 0x1FC07FFF, is disabled
(1)
1 = Write protection for physical address, 0x01FC00000 through 0x1FC03FFF, is enabled
0 = Write protection for physical address, 0x01FC00000 through 0x1FC03FFF, is disabled
24/16/8/0
Bit
BWP0
(1)
Note 1:These bits are only available when the NVMKEY unlock sequence is performed and the associated lock
bit (BWPULOCK) is set.
Note:The bits in this register are only writable when the NVMKEY unlock sequence is followed. Refer to
Example 5-1.
DS60001387D-page 52 2016-2019 Microchip Technology Inc.
Page 53
PIC32MM0256GPM064 FAMILY
// interrupts should be disabled
SYSKEY = 0;// force lock
SYSKEY = 0xAA996655;// unlock
SYSKEY = 0x556699AA;
RSWRST = 1;
unsigned long int bitBucket =RSWRST;
// initiate the reset
while(1);
MCLR
VDD
VDD Rise
Detect
POR
Sleep or Idle
Glitch Filter
BOR
Configuration
SYSRST
Software Reset
Voltage Regulator
Reset
WDTR
SWR
CMR
MCLR
Mismatch
NMI
Time-out
WDT
Time-out
Brown-out
Reset
Enabled
6.0RESETS
Note:This data sheet summarizes the features of
the PIC32MM0256GPM064 family of devices.
It is not intended to be a comprehensive refer
ence source. To complement the information in
this data sheet, refer to Section 7. “Resets”
(www.microchip.com/DS60001118) in the“PIC32 Family Reference Manual”. The infor
mation in this data sheet supersedes the
information in the FRM.
The Reset module combines all Reset sources and
controls the device Master Reset Signal, SYSRST. The
device Reset sources are as follows:
• Power-on Reset (POR)
• Master Clear Reset Pin (MCLR)
• Software Reset (SWR)
FIGURE 6-1:SYSTEM RESET BLOCK DIAGRAM
-
-
• Watchdog Timer Reset (WDTR)
• Brown-out Reset (BOR)
• Configuration Mismatch Reset (CMR)
EXAMPLE 6-1:SOFTWARE RESET CODE
A simplified block diagram of the Reset module is
illustrated in
Refer to Example 6-1 for example Software Reset code.
DS60001387D-page 54 2016-2019 Microchip Technology Inc.
6.1Reset Control Registers
PIC32MM0256GPM064 FAMILY
TABLE 6-1:RESETS REGISTER MAP
Bits
(1)
(BF80_#)
Virtual Address
26E0RCON
26F0 RSWRST
2700 RNMICON
2710 PWRCON
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses, plus offsets of 0x4, 0x8 and 0xC, respectively.
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31PORIO: V
Set by hardware at detection of a V
1 = A Power-on Reset has occurred due to V
0 = A Power-on Reset has not occurred due to V
DD POR Flag bit
DD POR event.
DD voltage
DD voltage
bit 30PORCORE: Core Voltage POR Flag bit
Set by hardware at detection of a core POR event.
1 = A Power-on Reset has occurred due to core voltage
0 = A Power-on Reset has not occurred due to core voltage
bit 29-28 Unimplemented: Read as ‘0’
bit 27BCFGERR: Primary Configuration Registers Error Flag bit
1 = An error occurred during a read of the Primary Configuration registers
0 = No error occurred during a read of the Primary Configuration registers
bit 26BCFGFAIL: Primary/Alternate Configuration Registers Error Flag bit
1 = An error occurred during a read of the Primary and Alternate Configuration registers
0 = No error occurred during a read of the Primary and Alternate Configuration registers
bit 25-10 Unimplemented: Read as ‘0’
bit 9CMR: Configuration Mismatch Reset Flag bit
1 = Configuration Mismatch Reset has occurred
0 = A Configuration Mismatch Reset has not occurred
bit 8Unimplemented: Read as ‘0’
bit 7EXTR: External Reset (MCLR
) Pin Flag bit
(1)
1 = Master Clear (pin) Reset has occurred
0 = Master Clear (pin) Reset has not occurred
bit 6SWR: Software Reset Flag bit
(1)
1 = Software Reset was executed
0 = Software Reset was not executed
bit 5Unimplemented: Read as ‘0’
bit 4WDTO: Watchdog Timer Time-out Flag bit
(1)
1 = WDT time-out has occurred
0 = WDT time-out has not occurred
Bit
(1)
Note 1:User software must clear these bits to view the next detection.
2:The IDLE bit will also be set when the device wakes from Sleep.
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-3Unimplemented: Read as ‘0’
bit 2SBOREN: BOR Enable bit
Enables the BOR for select BOREN Configuration bit settings.
1 = Writing a ‘1’ to this bit enables the BOR for select BOREN configuration values
0 = Writing a ‘0’ to this bit enables the BOR for select BOREN configuration values
bit 1RETEN: Output Level of the Regulator During Sleep Selection bit
(1)
1 = Writing a ‘1’ to this bit will cause the main regulator to be put in a low-power state during Sleep mode
0 = Writing a ‘0’ to this bit will have no effect
bit 0VREGS: Voltage Regulator Standby Enable bit
1 = Voltage regulator will remain active during Sleep mode
0 = Voltage regulator will go into Standby mode during Sleep mode
Bit
24/16/8/0
VREGS
(3)
Note 1:Refer to Section 25.0 “Power-Saving Features” for details.
2:The SYSKEY register is used to unlock this register.
3:The RETEN bit in the device configuration must also be set to enable this mode.
DS60001387D-page 58 2016-2019 Microchip Technology Inc.
Page 59
PIC32MM0256GPM064 FAMILY
Interrupt Requests
Vector Number and Offset
CPU Core
Priority Level
Shadow Set Number
SYSCLK
(Exception Handling)
Interrupt Controller
7.0CPU EXCEPTIONS AND
INTERRUPT CONTROLLER
Note:This data sheet summarizes the features
of the PIC32MM0256GPM064 family of
devices. It is not intended to be a
comprehensive reference source. To
complement the information in this data
sheet, refer to Section 8. “Interrupts”
(www.microchip.com/DS60001108) and
Section 50. “CPU for Devices with
MIPS32
Cores” (www.microchip.com/DS60001192)
in the “PIC32 Family Reference Manual”.
The information in this data sheet
supersedes the information in the FRM.
PIC32MM0256GPM064 family devices generate interrupt requests in response to interrupt events from
peripheral modules. The interrupt control module exists
externally to the CPU logic and prioritizes the interrupt
events before presenting them to the CPU.
The CPU handles interrupt events as part of the exception handling mechanism, which is described in
Section 7.1 “CPU Exceptions”.
®
microAptiv™ and M-Class
The PIC32MM0256GPM064 family device interrupt
module includes the following features:
• Single Vector or Multivector Mode Operation
• Five External Interrupts with Edge Polarity Control
• Interrupt Proximity Timer
• Module Freeze in Debug mode
• Seven User-Selectable Priority Levels for Each
Vector
• Four User-Selectable Subpriority Levels within
Each Priority
• One Shadow Register Set that can be Used for
Any Priority Level, Eliminating Software Context
Switch and Reducing Interrupt Latency
• Software can Generate any Interrupt
• User-Configurable Interrupt Vectors’ Offset and
Vector Table Location
Figure 7-1 shows the block diagram for the interrupt
controller and CPU exceptions.
FIGURE 7-1:CPU EXCEPTIONS AND INTERRUPT CONTROLLER MODULE BLOCK DIAGRAM
DS60001387D-page 60 2016-2019 Microchip Technology Inc.
7.1CPU Exceptions
PIC32MM0256GPM064 FAMILY
CPU Coprocessor 0 contains the logic for identifying and managing exceptions. Exceptions can be caused by a variety of sources, including boundary cases in data,
external events or program errors.
Ta bl e 7-1 lists the exception types in order of priority.
DS60001387D-page 62 2016-2019 Microchip Technology Inc.
7.2Interrupts
PIC32MM0256GPM064 FAMILY
The PIC32MM0256GPM064 family uses fixed offset for vector spacing. For details, refer to Section 8. “Interrupts” (DS61108) in the “PIC32 Family Reference Manual”.
Table 7-2 provides the interrupt related vectors and bits information.
All other values are reserved. The operation of this device is undefined if a reserved value is written to this
field. If MVEC = 0, this field is ignored.
1 = Interrupt controller is configured for Multivectored mode
0 = Interrupt controller is configured for Single Vectored mode
111 = Interrupts of Group Priority 7 or lower start the interrupt proximity timer
110 = Interrupts of Group Priority 6 or lower start the interrupt proximity timer
101 = Interrupts of Group Priority 5 or lower start the interrupt proximity timer
100 = Interrupts of Group Priority 4 or lower start the interrupt proximity timer
011 = Interrupts of Group Priority 3 or lower start the interrupt proximity timer
010 = Interrupts of Group Priority 2 or lower start the interrupt proximity timer
001 = Interrupts of Group Priority 1 start the interrupt proximity timer
000 = Disables interrupt proximity timer
DS60001387D-page 76 2016-2019 Microchip Technology Inc.
Page 77
PIC32MM0256GPM064 FAMILY
Channel 0 Control
Channel 1 Control
Channel 3 Control
Global Control
(DMACON)
Bus Matrix
Channel Priority Arbitration
BMXARB[1:0]
S
E
L
S
E
L
Y
I
0
I
1
I
2
I
3
System IRQINT Controller
Peripheral Bus
Address Decoder
8.0DIRECT MEMORY ACCESS
(DMA) CONTROLLER
Note 1: This data sheet summarizes the features of
the PIC32MM0256GPM064 family of
devices. It is not intended to be a comprehensive reference source. To complement
the information in this data sheet, refer
to Section 31. “DMA Controller”
(www.microchip.com/DS60001117) in the “PIC32 Family Reference Manual”.
The Direct Memory Access (DMA) Controller is a bus
master module useful for data transfers between
peripherals and memory without CPU intervention. The
source and destination of a DMA transfer can be any of
the memory-mapped modules, that do not have a ded
icated DMA, existent in the PIC32 (such as SPI, UART,
PMP, etc.) or the memory itself.
The following are some of the key features of the DMA
Controller module:
• Four Identical Channels, Each Featuring:
- Auto-Increment Source and Destination Address
registers
- Source and Destination Pointers
- Memory to memory and memory to
peripheral transfers
• Automatic Word Size Detection:
- Transfer granularity, down to byte level
- Bytes need not be word-aligned at source and
destination
• Fixed Priority Channel Arbitration
-
• Flexible DMA Channel Operating modes:
- Manual (software) or automatic (interrupt) DMA
requests
- One-Shot or Auto-Repeat Block Transfer modes
- Channel-to-channel chaining
• Flexible DMA Requests:
- A DMA request can be selected from any of the
peripheral interrupt sources
- Each channel can select any (appropriate)
observable interrupt as its DMA request source
- A DMA transfer abort can be selected from any of
the peripheral interrupt sources
- Pattern (data) match transfer termination
• Multiple DMA Channel Status Interrupts:
- DMA channel block transfer complete
- Source empty or half empty
- Destination full or half full
- DMA transfer aborted due to an external event
- Invalid DMA address generated
• DMA Debug Support Features:
- Most recent address accessed by a DMA channel
- Most recent DMA channel to transfer data
• CRC Generation module:
- CRC module can be assigned to any of the
available channels
- CRC module is highly configurable
• User Selectable Bus Arbitration Priority (refer to
DS60001387D-page 78 2016-2019 Microchip Technology Inc.
PIC32MM0256GPM064 FAMILY
8.1DMA Control Registers
TABLE 8-1:DMA CONTROLLER REGISTER MAP
Bits
(1)
Name
Register
(BF88_#)
Virtual Address
8900 DMACON
8910 DMASTAT
8920 DMAADDR
8930 DCRCCON
8940 DCRCDATA
8950 DCRCXOR
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses, plus offsets of 0x4, 0x8 and 0xC, respectively. See Section 10.1 “CLR, SET and INV Registers” for
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses, plus offsets of 0x4, 0x8 and 0xC, respectively. See Section 10.1 “CLR, SET and INV Registers” for
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses, plus offsets of 0x4, 0x8 and 0xC, respectively. See Section 10.1 “CLR, SET and INV Registers” for
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses, plus offsets of 0x4, 0x8 and 0xC, respectively. See Section 10.1 “CLR, SET and INV Registers” for
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: All registers in this table have corresponding CLR, SET and INV registers at their virtual addresses, plus offsets of 0x4, 0x8 and 0xC, respectively. See Section 10.1 “CLR, SET and INV Registers” for
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-4 Unimplemented: Read as ‘0’
bit 3RDWR: DMA Read/Write Status bit
1 = Last DMA bus access was a read
0 = Last DMA bus access was a write
bit 2-0DMACH[2:0]: DMA Channel bits
These bits contain the value of the most recent active DMA channel.
Bit
REGISTER 8-3:DMAADDR: DMA ADDRESS REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-0 DMAADDR[31:0]: DMA Module Address bits
Bit
31/23/15/7
R-0R-0R-0R-0R-0R-0R-0R-0
Bit
30/22/14/6
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
DMAADDR[31:24]
R-0R-0R-0R-0R-0R-0R-0R-0
DMAADDR[23:16]
R-0R-0R-0R-0R-0R-0R-0R-0
DMAADDR[15:8]
R-0R-0R-0R-0R-0R-0R-0R-0
DMAADDR[7:0]
These bits contain the address of the most recent DMA access.
24/16/8/0
Bit
DS60001387D-page 84 2016-2019 Microchip Technology Inc.
Page 85
PIC32MM0256GPM064 FAMILY
REGISTER 8-4:DCRCCON: DMA CRC CONTROL REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
U-0U-0R/W-0R/W-0R/W-0U-0U-0R/W-0
——BYTO[1:0]WBO
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
(1)
Bit
26/18/10/2
Bit
25/17/9/1
——BITO
————————
U-0U-0U-0R/W-0R/W-0R/W-0R/W-0R/W-0
———PLEN[4:0]
R/W-0R/W-0R/W-0U-0U-0R/W-0R/W-0R/W-0
CRCENCRCAPP
(1)
CRCTYP——CRCCH[2:0]
24/16/8/0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-30 Unimplemented: Read as ‘0’
bit 29-28 BYTO[1:0]: CRC Byte Order Selection bits
11 = Endian byte swap on half-word boundaries (source half-word order with reverse source byte order per
half-word)
10 = Swap half-words on word boundaries (reverse source half-word order with source byte order per
half-word)
01 = Endian byte swap on word boundaries (reverse source byte order)
00 = No swapping (source byte order)
bit 27WBO: CRC Write Byte Order Selection bit
(1)
1 = Source data are written to the destination re-ordered, as defined by BYTO[1:0]
0 = Source data are written to the destination unaltered
bit 26-25 Unimplemented: Read as ‘0’
bit 24BITO: CRC Bit Order Selection bit
When CRCTYP (DCRCCON[5]) =
1 (CRC module is in IP Header mode):
1 = The IP header checksum is calculated Least Significant bit (LSb) first (reflected)
0 = The IP header checksum is calculated Most Significant bit (MSb) first (not reflected)
When CRCTYP (DCRCCON[5]) =
0 (CRC module is in LFSR mode):
1 = The LFSR CRC is calculated Least Significant bit first (reflected)
0 = The LFSR CRC is calculated Most Significant bit first (not reflected)
bit 23-13 Unimplemented: Read as ‘0’
bit 12-8PLEN[4:0]: Polynomial Length bits
When CRCTYP (DCRCCON[5]) =
1 (CRC module is in IP Header mode):
These bits are unused.
When CRCTYP (DCRCCON[5]) =
0 (CRC module is in LFSR mode):
Denotes the length of the polynomial – 1.
bit 7CRCEN: CRC Enable bit
1 = CRC module is enabled and channel transfers are routed through the CRC module
0 = CRC module is disabled and channel transfers proceed normally
bit 6CRCAPP: CRC Append Mode bit
(1)
1 = The DMA transfers data from the source into the CRC but not to the destination; when a block transfer
completes, the DMA writes the calculated CRC value to the location given by CHxDSA
0 = The DMA transfers data from the source through the CRC, obeying WBO as it writes the data to the
destination
Bit
Note 1:When WBO = 1, unaligned transfers are not supported and the CRCAPP bit cannot be set.
REGISTER 8-4:DCRCCON: DMA CRC CONTROL REGISTER (CONTINUED)
bit 5CRCTYP: CRC Type Selection bit
1 = The CRC module will calculate an IP header checksum
0 = The CRC module will calculate an LFSR CRC
bit 4-3Unimplemented: Read as ‘0’
bit 2-0CRCCH[2:0]: CRC Channel Select bits
111 = CRC is assigned to Channel 7
110 = CRC is assigned to Channel 6
101 = CRC is assigned to Channel 5
100 = CRC is assigned to Channel 4
011 = CRC is assigned to Channel 3
010 = CRC is assigned to Channel 2
001 = CRC is assigned to Channel 1
000 = CRC is assigned to Channel 0
Note 1:When WBO = 1, unaligned transfers are not supported and the CRCAPP bit cannot be set.
DS60001387D-page 86 2016-2019 Microchip Technology Inc.
Page 87
PIC32MM0256GPM064 FAMILY
REGISTER 8-5:DCRCDATA: DMA CRC DATA REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Bit
30/22/14/6
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
DCRCDATA[31:24]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
DCRCDATA[23:16]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
DCRCDATA[15:8]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
DCRCDATA[7:0]
24/16/8/0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-0 DCRCDATA[31:0]: CRC Data Register bits
Writing to this register will seed the CRC generator. Reading from this register will return the current value of
the CRC. Bits greater than PLEN will return ‘0’ on any read.
When CRCTYP (DCRCCON[5]) =
1 (CRC module is in IP Header mode):
Only the lower 16 bits contain IP header checksum information. The upper 16 bits are always ‘0’. Data written
to this register are converted and read back in ‘1’s complement form (current IP header checksum value).
When CRCTYP (DCRCCON[5]) =
0 (CRC module is in LFSR mode):
Bits greater than PLEN will return ‘0’ on any read.
Bit
REGISTER 8-6:DCRCXOR: DMA CRCXOR ENABLE REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-0 DCRCXOR[31:0]: CRC XOR Register bits
Bit
31/23/15/7
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Bit
30/22/14/6
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
24/16/8/0
DCRCXOR[31:24]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
DCRCXOR[23:16]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
DCRCXOR[15:8]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
DCRCXOR[7:0]
When CRCTYP (DCRCCON[5]) = 1 (CRC module is in IP Header mode):
This register is unused.
When CRCTYP (DCRCCON[5]) = 0 (CRC module is in LFSR mode):
1 = Enables the XOR input to the Shift register
0 = Disables the XOR input to the Shift register; data are shifted in directly from the previous stage in the register
REGISTER 8-7:DCHxCON: DMA CHANNEL x CONTROL REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
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
24/16/8/0
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
R/W-0U-0U-0U-0U-0U-0U-0R/W-0
CHBUSY————— —CHCHNS
R/W-0R/W-0R/W-0R/W-0U-0R-0R/W-0R/W-0
(2)
CHEN
CHAEDCHCHNCHAEN—CHEDETCHPRI[1:0]
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0’
bit 15CHBUSY: Channel Busy bit
1 = Channel is active or has been enabled
0 = Channel is inactive or has been disabled
bit 14-9Unimplemented: Read as ‘0’
bit 8CHCHNS: Chain Channel Selection bit
(1)
1 = Chain to channel lower in natural priority (CH1 will be enabled by CH2 transfer complete)
0 = Chain to channel higher in natural priority (CH1 will be enabled by CH0 transfer complete)
bit 7CHEN: Channel Enable bit
(2)
1 = Channel is enabled
0 = Channel is disabled
bit 6CHAED: Channel Allow Events if Disabled bit
1 = Channel start/abort events will be registered, even if the channel is disabled
0 = Channel start/abort events will be ignored if the channel is disabled
bit 5CHCHN: Channel Chain Enable bit
1 = Allows channel to be chained
0 = Does not allow channel to be chained
bit 4CHAEN: Channel Automatic Enable bit
1 = Channel is continuously enabled and not automatically disabled after a block transfer is complete
0 = Channel is disabled on a block transfer complete
bit 3Unimplemented: Read as ‘0’
bit 2CHEDET: Channel Event Detected bit
1 = An event has been detected
0 = No events have been detected
bit 1-0CHPRI[1:0]: Channel Priority bits
11 = Channel has Priority 3 (highest)
10 = Channel has Priority 2
01 = Channel has Priority 1
00 = Channel has Priority 0
Bit
(1)
Note 1:The chain selection bit takes effect when chaining is enabled (CHCHN = 1).
2:When the channel is suspended by clearing this bit, the user application should poll the CHBUSY bit (if
available on the device variant) to see when the channel is suspended, as it may take some clock cycles
to complete a current transaction before the channel is suspended.
DS60001387D-page 88 2016-2019 Microchip Technology Inc.
Page 89
PIC32MM0256GPM064 FAMILY
REGISTER 8-8:DCHxECON: DMA CHANNEL x EVENT CONTROL REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
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
24/16/8/0
————————
R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1
CHAIRQ[7:0]
R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1R/W-1
CHSIRQ[7:0]
S-0S-0R/W-0R/W-0R/W-0U-0U-0U-0
(1)
(1)
CFORCECABORTPATENSIRQENAIRQEN———
Legend:S = Settable bit
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-24 Unimplemented: Read as ‘0’
bit 23-16 CHAIRQ[7:0]: Channel Transfer Abort IRQ bits
(1)
11111111 = Interrupt 255 will abort any transfers in progress and sets the CHTAIF flag
•
•
•
00000001 = Interrupt 1 will abort any transfers in progress and sets the CHTAIF flag
00000000 = Interrupt 0 will abort any transfers in progress and sets the CHTAIF flag
bit 15-8CHSIRQ[7:0]: Channel Transfer Start IRQ bits
(1)
11111111 = Interrupt 255 will initiate a DMA transfer
•
•
•
00000001 = Interrupt 1 will initiate a DMA transfer
00000000 = Interrupt 0 will initiate a DMA transfer
bit 7CFORCE: DMA Forced Transfer bit
1 = A DMA transfer is forced to begin when this bit is written to a ‘1’
0 = This bit always reads ‘0’
bit 6CABORT: DMA Abort Transfer bit
1 = A DMA transfer is aborted when this bit is written to a ‘1’
0 = This bit always reads ‘0’
bit 5PAT EN: Channel Pattern Match Abort Enable bit
1 = Aborts transfer and clears CHEN on pattern match
0 = Pattern match is disabled
bit 4SIRQEN: Channel Start IRQ Enable bit
1 = Starts channel cell transfer if an interrupt matching CHSIRQx occurs
0 = Interrupt number CHSIRQx is ignored and does not start a transfer
bit 3AIRQEN: Channel Abort IRQ Enable bit
1 = Channel transfer is aborted if an interrupt matching CHAIRQx occurs
0 = Interrupt number CHAIRQx is ignored and does not terminate a transfer
bit 2-0Unimplemented: Read as ‘0’
Bit
Note 1:See Table 7-2 for the list of available interrupt IRQ sources.
REGISTER 8-14:DCHxSPTR: DMA CHANNEL x SOURCE POINTER REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
R-0R-0R-0R-0R-0R-0R-0R-0
CHSPTR[15:8]
R-0R-0R-0R-0R-0R-0R-0R-0
CHSPTR[7:0]
(1)
Bit
25/17/9/1
24/16/8/0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0’
bit 15-0CHSPTR[15:0]: Channel Source Pointer bits
1111111111111111 = Points to Byte 65,535 of the source
•
•
•
0000000000000001 = Points to Byte 1 of the source
0000000000000000 = Points to Byte 0 of the source
Bit
Note 1:When in Pattern Detect mode, this register is reset on a pattern detect.
REGISTER 8-15:DCHxDPTR: DMA CHANNEL x DESTINATION POINTER REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0’
bit 15-0CHDPTR[15:0]: Channel Destination Pointer bits
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
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
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
R-0R-0R-0R-0R-0R-0R-0R-0
CHDPTR[15:8]
R-0R-0R-0R-0R-0R-0R-0R-0
CHDPTR[7:0]
1111111111111111 = Points to Byte 65,535 of the destination
•
•
•
0000000000000001 = Points to Byte 1 of the destination
0000000000000000 = Points to Byte 0 of the destination
24/16/8/0
Bit
DS60001387D-page 94 2016-2019 Microchip Technology Inc.
Page 95
PIC32MM0256GPM064 FAMILY
REGISTER 8-16:DCHxCSIZ: DMA CHANNEL x CELL SIZE REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
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
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
CHCSIZ[15:8]
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
CHCSIZ[7:0]
24/16/8/0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0’
bit 15-0CHCSIZ[15:0]: Channel Cell Size bits
1111111111111111 = 65,535 bytes are transferred on an event
•
•
•
0000000000000010 = 2 bytes are transferred on an event
0000000000000001 = 1 byte is transferred on an event
0000000000000000 = 65,536 bytes are transferred on an event
Bit
REGISTER 8-17:DCHxCPTR: DMA CHANNEL x CELL POINTER REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
R-0R-0R-0R-0R-0R-0R-0R-0
CHCPTR[15:8]
R-0R-0R-0R-0R-0R-0R-0R-0
CHCPTR[7:0]
(1)
25/17/9/1
Bit
24/16/8/0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0’
bit 15-0CHCPTR[7:0]: Channel Cell Progress Pointer bits
1111111111111111 = 65,535 bytes have been transferred since the last event
•
•
•
0000000000000001 = 1 byte has been transferred since the last event
0000000000000000 = 0 bytes have been transferred since the last event
Bit
Note 1:When in Pattern Detect mode, this register is reset on a pattern detect.
REGISTER 8-18:DCHxDAT: DMA CHANNEL x PATTERN DATA REGISTER
Bit
Range
31:24
23:16
15:8
7:0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 31-8 Unimplemented: Read as ‘0’
bit 7-0CHPDAT[7:0]: Channel Data Register bits
Bit
31/23/15/7
U-0U-0U-0U-0U-0U-0U-0U-0
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
U-0U-0U-0U-0U-0U-0U-0U-0
————————
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Pattern Terminate mode:
Data to be matched must be stored in this register to allow terminate on match.
All Other modes:
Unused.
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
CHPDAT[7:0]
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
24/16/8/0
Bit
DS60001387D-page 96 2016-2019 Microchip Technology Inc.
Page 97
PIC32MM0256GPM064 FAMILY
9.0OSCILLATOR
CONFIGURATION
Note:This data sheet summarizes the features
of the PIC32MM0256GPM064 family of
devices. It is not intended to be a
comprehensive reference source. To com
plement the information in this data sheet,
refer to Section 59. “Oscillators with DCO” (www.microchip.com/DS60001329)
in the “PIC32 Family Reference Manual”.
The information in this data sheet
supersedes the information in the FRM.
The PIC32MM0256GPM064 family oscillator system
has the following modules and features:
• A Total of Five External and Internal Oscillator
Options as Clock Sources
• On-Chip PLL with User-Selectable Multiplier and
Output Divider to Boost Operating Frequency on
Select Internal and External Oscillator Sources
• On-Chip User-Selectable Divisor Postscaler on
Select Oscillator Sources
• Software-Controllable Switching between
Various Clock Sources
• A Fail-Safe Clock Monitor (FSCM) that Detects
Clock Failure and Permits Safe Application
Recovery or Shutdown
• Flexible Reference Clock Output
A block diagram of the oscillator system is provided in
Figure 9-1.
9.1Fail-Safe Clock Monitor (FSCM)
The PIC32MM0256GPM064 family oscillator system
includes a Fail-Safe Clock Monitor (FSCM). The FSCM
monitors the SYSCLK for continuous operation. If it
detects that the SYSCLK has failed, it switches the
SYSCLK over to the FRC oscillator and triggers a NonMaskable Interrupt (NMI). When the NMI is executed,
software can attempt to restart the main oscillator or
shut down the system.
In Sleep mode, both the SYSCLK and the FSCM halt,
which prevents FSCM detection.
-
9.2Clock Switching Operation
With few limitations, applications are free to switch
between any of the four clock sources (POSC, SOSC,
FRC and LPRC) under software control and at any
time. To limit the possible side effects that could result
from this flexibility, PIC32 devices have a safeguard
lock built into the switching process.
Note:The Primary Oscillator mode has three
different submodes (XT, HS and EC), which
are determined by the POSCMOD[1:0]
Configuration bits. While an application
can switch to and from Primary Oscillator
mode in software, it cannot switch
between the different primary submodes
without reprogramming the device.
9.2.1ENABLING CLOCK SWITCHING
To enable clock switching, the FCKSM1 Configuration
bit in FOSC must be programmed to ‘0’. (Refer to
Section 26.1 “Configuration Bits” for further details.)
If the FCKSM1 Configuration bit is unprogrammed (‘1’),
the clock switching function and Fail-Safe Clock
Monitor function are disabled; this is the default setting.
The NOSC[2:0] control bits (OSCCON[10:8]) do not
control the clock selection when clock switching is
disabled. However, the COSC[2:0] bits
(OSCCON[14:12]) will reflect the clock source selected
by the FNOSC[2:0] Configuration bits.
The OSWEN control bit (OSCCON[0]) has no effect
when clock switching is disabled; it is held at ‘0’ at all
times.
9.2.2OSCILLATOR SWITCHING
SEQUENCE
At a minimum, performing a clock switch requires this
basic sequence:
1.If desired, read the COSC[2:0] bits
(OSCCON[14:12]) to determine the current
oscillator source.
2.Perform the unlock sequence to allow a write to
the OSCCON register.
3.Write the appropriate value to the NOSC[2:0]
bits (OSCCON[10:8]) for the new oscillator
source.
Once the basic sequence is completed, the system
clock hardware responds automatically as follows:
1.The clock switching hardware compares the
COSCx bits with the new value of the NOSCx
bits. If they are the same, then the clock switch
is a redundant operation. In this case, the
OSWEN bit is cleared automatically and the
clock switch is aborted.
2.If a valid clock switch has been initiated, the
LOCK (OSCTUN[11]) and CF (OSCCON[3]) bits
are cleared.
3.The new oscillator is turned on by the hardware
if it is not currently running. If a crystal oscillator
must be turned on, the hardware will wait until
the OST expires. If the new source is using the
PLL, then the hardware waits until a PLL lock is
detected (LOCK = 1).
4.The hardware waits for ten clock cycles from the
new clock source and then performs the clock
switch.
5.The hardware clears the OSWEN bit to indicate a
successful clock transition. In addition, the
NOSC[2:0] bits values are transferred to the
COSC[2:0] bits.
6.The old clock source is turned off if it is not being
used by a peripheral, or enabled by device
configuration or a control register.
Note 1: The processor will continue to execute
code throughout the clock switching
sequence. Timing-sensitive code should
not be executed during this time.
2: Direct clock switches between any
Primary Oscillator mode with PLL and
FRCPLL mode are not permitted. This
applies to clock switches in either direc
tion. In these instances, the application
must switch to FRC mode as a transi
tional clock source between the two PLL
modes.
A recommended code sequence for a clock switch
includes the following:
1.Disable interrupts during the OSCCON register
unlock and write sequence.
2.Execute the unlock sequence for OSCCON by
writing 0xAA996655 and 0x556699AA to the
SYSKEY register.
3.Write the new oscillator source to the NOSC[2:0]
bits.
4.Set the OSWEN bit.
5.Relock the OSCCON register.
6.Continue to execute code that is not clock-sensitive
(optional).
The core sequence for unlocking the OSCCON register
and initiating a clock switch is shown in
Example 9-1.
EXAMPLE 9-1:BASIC CODE SEQUENCE
FOR CLOCK SWITCHING
9.3Two-Speed Start-up
Two-Speed Start-up is enabled by the IESO Configuration bit. When enabled, the device will start operating
from a POR or any Reset with the FRC as the clock
source. When the PLL is ready, the clock module will
automatically switch to the PLL source using the PLL
settings from the SPLLCON register.
DS60001387D-page 98 2016-2019 Microchip Technology Inc.
Note:If using PLL operation, with PLL configu-
ration values other than the default
values, Two-Speed start-up should not be
used. In this case, it is recommended that
the device be configured with FRC as the
clock source. After start-up, user code can
modify the PLL configuration and then
request a clock switch to the PLL source.
Page 99
PIC32MM0256GPM064 FAMILY
9.4FRC Active Clock Tuning
PIC32MM0256GPM064 family devices include an automatic mechanism to calibrate the FRC during run time.
This system uses active clock tuning from a source of
known accuracy to maintain the FRC within a very
narrow margin of its nominal 8 MHz frequency. This
allows for a frequency accuracy that is well within the
requirements of the “USB 2.0 Specification” regarding
full-speed USB devices.
Note:The self-tune feature maintains sufficient
accuracy for operation in USB Device
mode. For applications that function as a
USB host, a high-accuracy clock source
(±0.05%) is still required.
The self-tune system is controlled by the bits in the upper
half of the OSCTUN register. Setting the ON bit
(OSCTUN[15]) enables the self-tuning feature, allowing
the hardware to calibrate to a source selected by the
SRC bit (OSCTUN[12]). When SRC = 1, the system
uses the Start-of-Frame (SOF) packets from an external
USB host for its source. When SRC = 0, the system uses
the crystal-controlled SOSC for its calibration source.
Regardless of the source, the system uses the TUN[5:0]
bits (OSCTUN[5:0]) to change the FRC Oscillator’s
frequency. Frequency monitoring and adjustment is
dynamic, occurring continuously during run time. While
the system is active, the TUNx bits cannot be written to
by software.
The self-tune system can generate a hardware interrupt,
FSTIF. The interrupt can result from a drift of the FRC
from the reference, by greater than 0.2% in either direction, or whenever the frequency deviation is beyond
the ability of the TUNx bits to correct (i.e., greater
than 1.5%). The LOCK and ORNG status bits
(OSCTUN[11,9]) are used to indicate these conditions.
The POL and ORPOL bits (OSCTUN[10,8]) configure
the FSTIF interrupt to occur in the presence or the
absence of the conditions. It is the user’s responsibility
to monitor both the LOCK and ORNG bits to determine
the exact cause of the interrupt.
Note:The POL and ORPOL bits should be
ignored when the self-tune system is
disabled (ON = 0).
Note:After exiting out of self-tune, six writes
may be required to update the TUN[5:0]
bits.
Note:To use the USB as a reference clock tuning
source (SRC = 1), the microcontroller must
be configured for USB device operation
and connected to a non-suspended USB
host or hub port.
If the SOSC is to be used as the reference
clock tuning source (SRC = 0), the SOSC
must also be enabled for clock tuning to
occur.