Pic 32 MX
Pic 32 MX
Pic 32 MX
Data Sheet
64/100-Pin General Purpose and USB
32-Bit Flash Microcontrollers
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
High-Performance 32-bit RISC CPU: • Separate PLLs for CPU and USB Clocks
• Two I2C™ Modules
• MIPS32® M4K™ 32-bit Core with 5-Stage Pipeline
• Two UART Modules with:
• 80 MHz Maximum Frequency
- RS-232, RS-485 and LIN 1.2 support
• 1.56 DMIPS/MHz (Dhrystone 2.1) Performance
at 0 Wait State Flash Access - IrDA® with On-Chip Hardware Encoder and
Decoder
• Single-Cycle Multiply and High-Performance
Divide Unit • Parallel Master and Slave Port (PMP/PSP) with
8-bit and 16-bit Data and Up to 16 Address Lines
• MIPS16e™ Mode for Up to 40% Smaller Code
Size • Hardware Real-Time Clock/Calendar (RTCC)
• User and Kernel Modes to Enable Robust • Five 16-bit Timers/Counters (two 16-bit pairs com-
Embedded System bine to create two 32-bit timers)
• Two Sets of 32 Core Register Files (32-bit) to • Five Capture Inputs
Reduce Interrupt Latency • Five Compare/PWM Outputs
• Prefetch Cache Module to Speed Execution from • Five External Interrupt Pins
Flash • High-Speed I/O Pins Capable of Toggling at Up to
80 MHz
Microcontroller Features: • High-Current Sink/Source (18 mA/18 mA) on
All I/O Pins
• Operating Voltage Range of 2.3V to 3.6V
• Configurable Open-Drain Output on Digital I/O
• 32K to 512K Flash Memory (plus an additional Pins
12KB of Boot Flash)
• 8K to 32K SRAM Memory Debug Features:
• Pin-Compatible with Most PIC24/dsPIC® Devices
• Multiple Power Management Modes • Two Programming and Debugging Interfaces:
• Multiple Interrupt Vectors with Individually - 2-Wire Interface with Unintrusive Access and
Programmable Priority Real-time Data Exchange with Application
• Fail-Safe Clock Monitor Mode - 4-wire MIPS Standard Enhanced JTAG
interface
• Configurable Watchdog Timer with On-Chip
Low-Power RC Oscillator for Reliable Operation • Unintrusive Hardware-Based Instruction Trace
• IEEE Std 1149.2 Compatible (JTAG) Boundary
Peripheral Features: Scan
TQFP 64-Pin
10 x 10 mm
TQFP 100-Pin
12 x 12 mm
DMA Channels
Programmable
Comparators
PMP/PSP
Program/ Data Timers/ EUART/
VREG
Trace
JTAG
10-bit
Device Pins MHz Memory Capture/ SPI/
A/D (ch)
(KB) Compare I2C™
DMA Channels
Programmable
Comparators
PMP/PSP
Trace
JTAG
10-bit
Device Pins MHz Memory Capture/ SPI/
2 A/D (ch)
(KB) Compare I C™
PMWR/OC5/IC5/CN13/RD4
PMRD/CN14/RD5
VCAP/VDDCORE
PMD4/RE4
PMD3/RE3
PMD2/RE2
PMD1/RE1
PMD0/RE0
CN16/RD7
CN15/RD6
OC4/RD3
OC3/RD2
OC2/RD1
ENVREG
RF1
RF0
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
1 48 SOSCO/T1CK/CN0/RC14
PMD5/RE5
47 SOSCI/CN1/RC13
PMD6/RE6 2
PMD7/RE7 46 OC1/RD0
3
PMA5/SCK2/CN8/RG6 4 45 IC4/PMCS1/PMA14/INT4/RD11
PMA4/SDI2/CN9/RG7 5 44 IC3/PMCS2/PMA15/INT3/RD10
PMA3/SDO2/CN10/RG8 6 43 IC2/U1CTS/INT2/RD9
MCLR 7 42 IC1/RTCC/INT1/RD8
PMA2/SS2/CN11/RG9 8 PIC32MX3XXH 41 Vss
VSS 9 40 OSC2/CLKO/RC15
VDD 10 39 OSC1/CLKI/RC12
C1IN+/AN5/CN7/RB5 11 38 VDD
C1IN-/AN4/CN6/RB4 12 37 SCL1/RG2
C2IN+/AN3/CN5/RB3 13 36 SDA1/RG3
C2IN-/AN2/SS1/CN4/RB2 14 35 U1RTS/BCLK1/SCK1/INT0/RF6
PGC1/EMUC1/AN1/VREF-/CVREF-/CN3/RB1 15 34 U1RX/SDI1/RF2
PGD1/EMUD1/PMA6/AN0/VREF+/CVREF+/CN2/RB0 16 33 U1TX/SDO1/RF3
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
VSS
PMALL/PMA0/AN15/OCFB/CN12/RB15
PGD2/EMUD2/AN7/RB7
PGC2/EMUC2/AN6/OCFA/RB6
AVDD
U2CTS/C1OUT/AN8/RB8
PMA7/C2OUT/AN9/RB9
TDO/PMA12/AN11/RB11
TCK/PMA11/AN12/RB12
PMALH/PMA1/U2RTS/BCLK2/AN14/RB14
PMA9/U2RX/SDA2/CN17/RF4
PMA8/U2TX/SCL2/CN18/RF5
TMS/CVREFOUT/PMA13/AN10/RB10
VDD
TDI/PMA10/AN13/RB13
AVSS
PMWR/OC5/CN13/RD4
PMD13/CN19/RD13
PMD15/CN16/RD7
PMD14/CN15/RD6
PMRD/CN14/RD5
PMD12/IC5/RD12
VCAP/VDDCORE
TRD0/RG13
TRD1/RG12
TRD2/RG14
TRCLK/RA6
PMD10/RF1
PMD11/RF0
PMD8/RG0
PMD9/RG1
PMD4/RE4
PMD3/RE3
PMD2/RE2
PMD1/RE1
PMD0/RE0
TRD3/RA7
OC4/RD3
OC3/RD2
OC2/RD1
ENVREG
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
RG15 1 75 VSS
VDD 2 74 SOSCO/T1CK/CN0/RC14
PMD5/RE5 3 73 SOSCI/CN1/RC13
PMD6/RE6 4 72 OC1/RD0
PMD7/RE7 5 71 IC4/PMCS1/PMA14/RD11
T2CK/RC1 6 70 IC3/PMCS2/PMA15/RD10
T3CK/RC2 7 69 IC2/RD9
T4CK/RC3 8 68 IC1/RTCC/RD8
T5CK/RC4 9 67 INT4/RA15
PMA5/SCK2/CN8/RG6 10 66 INT3/RA14
PMA4/SDI2/CN9/RG7 11 65 VSS
PMA3/SDO2/CN10/RG8 12 64 OSC2/CLKO/RC15
MCLR 13 PIC32MX3XXL 63 OSC1/CLKI/RC12
PMA2/SS2/CN11/RG9 14 62 VDD
VSS 15 61 TDO/RA5
VDD 16 60 TDI/RA4
TMS/RA0 17 59 SDA2/RA3
INT1/RE8 18 58 SCL2/RA2
INT2/RE9 19 57 SCL1/RG2
C1IN+/AN5/CN7/RB5 20 56 SDA1/RG3
C1IN-/AN4/CN6/RB4 21 55 SCK1/INT0/RF6
C2IN+/AN3/CN5/RB3 22 54 SDI1/RF7
C2IN-/AN2/SS1/CN4/RB2 23 53 SDO1/RF8
PGC1/EMUC1/AN1/CN3/RB1 24 52 U1RX/RF2
PGD1/EMUD1/AN0/CN2/RB0 25 51 U1TX/RF3
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
VDD
VSS
PGC2/EMUC2/AN6/OCFA/RB6
CVREFOUT/PMA13/AN10/RB10
PMA9/U2RX/CN17/RF4
PMA7/VREF-/CVREF-/RA9
PMA6/VREF+/CVREF+/RA10
C1OUT/AN8/RB8
C2OUT/AN9/RB9
PMA12/AN11/RB11
TCK/RA1
U2RTS/BCLK2/RF13
U2CTS/RF12
PMA11/AN12/RB12
PMA10/AN13/RB13
PMALH/PMA1/AN14/RB14
CN20/U1CTS/RD14
U1RTS/BCLK1/CN21/RD15
PMA8/U2TX/CN18/RF5
PGD2/EMUD2/AN7/RB7
PMALL/PMA0/AN15/OCFB/CN12/RB15
AVSS
VSS
AVDD
VDD
PMWR/OC5/IC5/CN13/RD4
OC2/U1RTS/BCLK1/RD1
PMRD/CN14/RD5
OC3/U1RX/RD2
OC4/U1TX/RD3
VCAP/VDDCORE
PMD4/RE4
PMD3/RE3
PMD2/RE2
PMD1/RE1
PMD0/RE0
CN16/RD7
CN15/RD6
ENVREG
RF1
RF0
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
1 48 SOSCO/T1CK/CN0/RC14
PMD5/RE5
47 SOSCI/CN1/RC13
PMD6/RE6 2
PMD7/RE7 46 OC1/INT0/RD0
3
PMA5/SCK2/CN8/RG6 45 IC4/PMCS1/PMA14/INT4/RD11
4
PMA4/SDI2/CN9/RG7 5 44 IC3/PMCS2/PMA15/INT3/SCL1/RD10
PMA3/SDO2/CN10/RG8 6 43 IC2/U1CTS//INT2/SDA1/RD9
MCLR 7 42 IC1/RTCC/INT1/RD8
PMA2/SS2/CN11/RG9 8 PIC32MX4XXH 41 Vss
VSS 9 40 OSC2/CLKO/RC15
VDD 10 39 OSC1/CLKI/RC12
VBUSON/C1IN+/AN5/CN7/RB5 11 38 VDD
C1IN-/AN4/CN6/RB4 12 37 D+/RG2
C2IN+/AN3/CN5/RB3 13 36 D-/RG3
C2IN-/AN2/CN4/RB2 14 35 VUSB
PGC1/EMUC1/AN1/VREF-/CVREF-/CN3/RB1 15 34 VBUS
PGD1/EMUD1/PMA6/AN0/VREF+/CVREF+/CN2/RB0 16 33 USBID/RF3
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PGC2/EMUC2/AN6/OCFA/RB6
PGD2/EMUD2/AN7/RB7
U2CTS/C1OUT/AN8/RB8
PMA7/C2OUT/AN9/RB9
TMS/CVREFOUT/PMA13/AN10/RB10
TDO/PMA12/AN11/RB11
TCK/PMA11/AN12/RB12
TDI/PMA10/AN13/RB13
PMALH/PMA1/U2RTS/BCLK2/AN14/RB14
PMA9/U2RX/SDA2/CN17/RF4
PMALL/PMA0/AN15/OCFB/CN12/RB15
PMA8/U2TX/SCL2/CN18/RF5
VSS
AVDD
VDD
AVSS
PMWR/OC5/CN13/RD4
PMD13/CN19/RD13
PMD15/CN16/RD7
PMD14/CN15/RD6
PMRD/CN14/RD5
PMD12/IC5/RD12
VCAP/VDDCORE
TRD0/RG13
TRD1/RG12
TRD2/RG14
TRCLK/RA6
PMD10/RF1
PMD11/RF0
PMD8/RG0
PMD9/RG1
PMD4/RE4
PMD3/RE3
PMD2/RE2
PMD1/RE1
PMD0/RE0
TRD3/RA7
OC4/RD3
OC3/RD2
OC2/RD1
ENVREG
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
RG15 1 75 VSS
VDD 2 74 SOSCO/T1CK/CN0/RC14
PMD5/RE5 3 73 SOSCI/CN1/RC13
PMD6/RE6 4 72 SDO1/OC1/INT0/RD0
PMD7/RE7 5 71 IC4/PMCS1/PMA14/RD11
T2CK/RC1 6 70 IC3/SCKI/PMCS2/PMA15/RD10
T3CK/RC2 7 69 IC2/SS1/RD9
T4CK/RC3 8 68 IC1/RTCC/RD8
SDI1/T5CK/RC4 9 67 SDA1/INT4/RA15
PMA5/SCK2/CN8/RG6 10 66 SCL1/INT3/RA14
PMA4/SDI2/CN9/RG7 11 65 VSS
PMA3/SDO2/CN10/RG8 12 64 OSC2/CLKO/RC15
MCLR 13 PIC32MX4XXL 63 OSC1/CLKI/RC12
PMA2/SS2/CN11/RG9 14 62 VDD
VSS 15 61 TDO/RA5
VDD 16 60 TDI/RA4
TMS/RA0 17 59 SDA2/RA3
INT1/RE8 18 58 SCL2/RA2
INT2/RE9 19 57 D+/RG2
VBUSON/C1IN+/AN5/CN7/RB5 20 56 D-/RG3
C1IN-/AN4/CN6/RB4 21 55 VUSB
C2IN+/AN3/CN5/RB3 22 54 VBUS
C2IN-/AN2/CN4/RB2 23 53 U1TX/RF8
PGC1/EMUC1/AN1/CN3/RB1 24 52 U1RX/RF2
PGD1/EMUD1/AN0/CN2/RB0 25 51 USBID/RF3
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
VSS
VDD
PMALL/PMA0/AN15/OCFB/CN12/RB15
PGD2/EMUD2/AN7/RB7
PMA7/VREF-/CVREF-/RA9
PMA10/AN13/RB13
U2RTS/BCLK2/RF13
U2CTS/RF12
PMA11/AN12/RB12
PMALH/PMA1/AN14/RB14
PGC2/EMUC2/AN6/OCFA/RB6
PMA6/VREF+/CVREF+/RA10
AVDD
C1OUT/AN8/RB8
C2OUT/AN9/RB9
CVREFOUT/PMA13/AN10/RB10
PMA12/AN11/RB11
VDD
TCK/RA1
CN20/U1CTS/RD14
U1RTS/BCLK1/CN21/RD15
PMA9/U2RX/CN17/RF4
PMA8/U2TX/CN18/RF5
AVSS
VSS
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
PIC32MX320F032H
PIC32MX320F064H
PIC32MX320F128H
PIC32MX340F256H
PIC32MX320F128L
PIC32MX360F256L
PIC32MX360F512L
Features
PIC32MX340F128H
PIC32MX340F512H
PIC32MX340F128L
Features
PIC32MX420F032H
PIC32MX440F128H
PIC32MX440F256H
PIC32MX440F512H
PIC32MX440F128L
PIC32MX460F256L
PIC32MX460F512L
Features
CN1-22(1)
PORTA(1,4)
JTAG Interrupt
BSCAN Controller
PWM
OC1-5
PORTB
PORTC(1)
IS DS
32 32 SPI1,2(1)
32
32 32
(1)
PORTD
Bus Matrix
I2C1,2
32 32 32
32
PORTE(1)
Prefetch
Peripheral Bridge PMP(1)
Module(2) Data RAM
PORTF(1)
128 UART1,2
Controller
Flash
128-bit Wide
PORTG(1) Program Flash Memory
Comparators
Note 1: Not all pins or features are implemented on all device pinout configurations. See Table 1-4 for I/O port pin descriptions.
2: Some features are not available on certain devices.
3: BOR functionality is provided when the on-board voltage regulator is enabled.
4: PORTA is not present on 64-pin devices
CN1-22(1)
PORTA(1,4)
Priority
JTAG Interrupt
BSCAN Controller
PWM
OC 1,5
PORTB
PORTC(1)
IS DS
32 32 32 SPI 1,2(1)
32
32 32
PORTD(1)
Bus Matrix
I2C 1,2
32 32 32
32
PORTE(1)
Pre-Fetch
Peripheral Bridge PMP(1)
Module(1) Data RAM
PORTF(1)
128 UART 1,2
Controller
Flash
128-bit wide
PORTG(1) Program Flash Memory
Comparators
Note 1: Not all pins or features are implemented on all device pinout configurations. See Table 1-5 for I/O port pin descriptions.
2: Some features are not available on certain device variants.
3: BOR functionality is provided when the on-board voltage regulator is enabled.
4: PORTA is not present on 64 pin devices
PMD0 60 93 I/O ST/TTL Parallel Master Port Data (Demultiplexed Master mode) or
PMD1 61 94 I/O ST/TTL Address/Data (Multiplexed Master modes)
PMA0 30 44 O — Parallel Master Port Address Bit 0 Input (Buffered Slave modes) and
Output (Master modes)
PMA1 29 43 O — Parallel Master Port Address Bit 1 Input (Buffered Slave modes) and
Output (Master modes)
PMA2 8 14 O — Parallel Master Port Address (Demultiplexed Master modes)
PMA3 6 12 O —
PMA4 5 11 O —
PMA5 4 10 O —
PMA6 16 29 O —
PMA7 22 28 O —
PMA8 32 50 O —
PMA9 31 49 O —
PMA10 28 42 O —
PMA11 27 41 O —
PMA12 24 35 O —
PMA13 23 34 O —
PMA14 45 71 O — Address bit 14
PMA15 44 70 O — Address bit 15
PMCS1 45 71 O — Parallel Master Port Chip Select 1 Strobe
PMCS2 44 70 O — Parallel Master Port Chip Select 2 Strobe
PMD0 60 93 I/O ST/TTL Parallel Master Port Data (Demultiplexed Master mode) or
PMD1 61 94 I/O ST/TTL Address/Data (Multiplexed Master modes)
Trace
MDU Off-Chip
TAP
Debug I/F
Execution
Bus Matrix
Core FMT Bus Interface Dual Bus I/F
(RF/ALU/Shift)
System Power
Coprocessor
Mgmt
The PIC32MX3XX/4XX Family core execution unit The PIC32MX3XX/4XX Family core includes a
implements a load/store architecture with single-cycle multiply/divide unit (MDU) that contains a separate
ALU operations (logical, shift, add, subtract) and an pipeline for multiply and divide operations. This pipeline
autonomous multiply/divide unit. The core contains operates in parallel with the integer unit (IU) pipeline
thirty-two 32-bit general purpose registers used for and does not stall when the IU pipeline stalls. This
integer operations and address calculation. One allows MDU operations to be partially masked by
additional register file shadow set (containing thirty-two system stalls and/or other integer unit instructions.
registers) is added to minimize context switching
overhead during interrupt/exception processing. The The high-performance MDU consists of a 32x16 booth
register file consists of two read ports and one write recoded multiplier, result/accumulation registers (HI
port and is fully bypassed to minimize operation latency and LO), a divide state machine, and the necessary
in the pipeline. multiplexers and control logic. The first number shown
(‘32’ of 32x16) represents the rs operand. The second
The execution unit includes: number (‘16’ of 32x16) represents the rt operand. The
• 32-bit adder used for calculating the data address PIC32MX core only checks the value of the latter (rt)
operand to determine how many times the operation
• Address unit for calculating the next instruction
must pass through the multiplier. The 16x16 and 32x16
address
operations pass through the multiplier once. A 32x32
• Logic for branch determination and branch target operation passes through the multiplier twice.
address calculation
• Load aligner The MDU supports execution of one 16x16 or 32x16
• Bypass multiplexers used to avoid stalls when multiply operation every clock cycle; 32x32 multiply
executing instructions streams where data operations can be issued every other clock cycle.
producing instructions are followed closely by Appropriate interlocks are implemented to stall the
consumers of their results issuance of back-to-back 32x32 multiply operations.
The multiply operand size is automatically determined
• Leading Zero/One detect unit for implementing the by logic built into the MDU.
CLZ and CLO instructions
• Arithmetic Logic Unit (ALU) for performing bitwise Divide operations are implemented with a simple 1 bit
logical operations per clock iterative algorithm. An early-in detection
• Shifter and Store Aligner 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 is completed.
Table 2-1 lists the repeat rate (peak issue rate of cycles
until the operation can be reissued) and latency
(number of cycles until a result is available) for the
PIC32MX core multiply and divide instructions. The
approximate latency and repeat rates are listed in
terms of pipeline clocks.
The PIC32MX3XX/4XX Family core includes support Release 2 of the MIPS32 Architecture optionally
for peripheral interrupts, two software interrupts, and a removes the need to save and restore GPRs on entry
timer interrupt. to high priority interrupts or exceptions, and to provide
The PIC32MX MCU uses the MIPS External Interrupt specified processor modes with the same capability.
Controller (EIC) mode, which redefines the way in This is done by introducing multiple copies of the
which interrupts are handled to provide full support for GPRs, called “shadow sets”, and allowing privileged
an external interrupt controller handling prioritization software to associate a shadow set with entry to kernel
and vectoring of interrupts. This presence of this mode mode via an interrupt vector or exception. The normal
denoted by the VEIC bit in the Config3 register. On the GPRs are logically considered shadow set zero.
PIC32MX core, the VEIC bit is always set to ‘1’ to
indicate the presence of an external interrupt controller. The PIC32MX3XX/4XX Family core implements two
sets of registers, the normal GPRs, and one shadow
Note: Although EIC mode is designated as set. This is indicated by the SRSCtlHSS field.
“External”, the interrupt controller is
on-chip.
0xFFFFFFFF
Fixed Mapped
0xFF400000
0xFF3FFFFF
0xFF200000 Memory/EJTAG(1) kseg3
0xF1FFFFFF
Fixed Mapped
0xE0000000
0xDFFFFFFF
Kernel Virtual Address Space
kseg2
Fixed Mapped, 512 MB
0xC0000000
0xBFFFFFFF Kernel Virtual Address Space
Unmapped, 512 MB kseg1
0xA0000000 Uncached
0x9FFFFFFF
Kernel Virtual Address Space
Unmapped, 512 MB kseg0
0x80000000
0x7FFFFFFF
0x00000000
Note 1: This space is mapped to memory in user or kernel mode, and by the EJTAG module in Debug mode.
Virtual
Address Physical
Address
Instruction
Address
Instn
Calculator
SRAM
SRAM
FMT Interface
Data
Data SRAM
Address
Calculator
Physical
Virtual Address
Address
FIGURE 2-4: FMT MEMORY MAP (ERL = 0) IN THE PIC32MX3XX/4XX FAMILY CORE
useg/kuseg 0x4000_0000
reserved
0x2000_0000
kseg0/kseg1
0x0000_0000 0x0000_0000
useg/kuseg useg/kuseg
kseg0/kseg1
0x0000_0000 0x0000_0000
The SRAM interface includes dual instruction and data When the core is operating in MIPS16e mode,
interfaces. instruction fetches only require 16 bits of data to be
The dual interface enables independent connection to returned. For improved efficiency, however, the core
instruction and data devices. It yields the highest per- will fetch 32 bits of instruction data whenever the
formance, since the pipeline can generate simultane- address is word-aligned. Thus for sequential MIPS16e
ous I and D requests which are then serviced in code, fetches only occur for every other instruction,
parallel. resulting in better performance and reduced system
power.
The internal buses are connected to the Bus Matrix
unit, which is a switch fabric that provides this parallel
operation.
The PIC32MX3XX/4XX Family core offers a number of Three debug registers (DEBUG, DEPC, and DESAVE)
power management features, including low-power have been added to the MIPS Coprocessor 0 (CP0)
design, active power management, and power-down register set. The DEBUG register shows the cause of
modes of operation. The core is a static design that the debug exception and is used for setting up single-
supports slowing or halting the clocks, which reduces step operations. The DEPC, or Debug Exception
system power consumption during idle periods. Program Counter, register holds the address on which
the debug exception was taken. This is used to resume
2.4.1 INSTRUCTION-CONTROLLED program execution after the debug operation finishes.
POWER MANAGEMENT Finally, the DESAVE, or Debug Exception Save,
register enables the saving of general purpose
The mechanism for invoking power-down mode is registers used during execution of the debug exception
through execution of the WAIT instruction. For more handler.
information on power management, see Section 23.0
“Power Saving”. To exit debug mode, a Debug Exception Return
(DERET) instruction is executed. When this instruction
2.4.2 LOCAL CLOCK GATING is executed, the system exits debug mode, allowing
normal execution of application and system code to
The majority of the power consumed by the resume.
PIC32MX3XX/4XX Family core is in the clock tree and
clocking registers. The PIC32MX family uses extensive 2.5.2 EJTAG HARDWARE BREAKPOINTS
use of local gated-clocks to reduce this dynamic power
consumption. There are several types of simple hardware
breakpoints defined in the EJTAG specification. These
2.5 EJTAG Debug Support stop the normal operation of the MCU and force the
system into debug mode. There are two types of simple
The PIC32MX3XX/4XX Family core provides for an hardware breakpoints implemented in the
Enhanced JTAG (EJTAG) interface for use in the PIC32MX3XX/4XX Family core: Instruction
software debug of application and kernel code. In breakpoints and Data breakpoints.
addition to standard user mode and kernel modes of
operation, the PIC32MX3XX/4XX Family core provides The PIC32MX3XX/4XX Family core has two data and
a Debug mode that is entered after a debug exception six instruction breakpoints
(derived from a hardware breakpoint, single-step
exception, etc.) is taken and continues until a debug Instruction breaks occur on instruction fetch
exception return (DERET) instruction is executed. operations, and the break is set on the virtual address.
During this time, the processor executes the debug A mask can be applied to the virtual address to set
exception handler routine. breakpoints on a range of instructions.
The EJTAG interface operates through the Test Access Data breakpoints occur on load/store transactions.
Port (TAP), a serial communication port used for Breakpoints are set on virtual address values, similar to
transferring test data in and out of the the Instruction breakpoint. Data breakpoints can be set
PIC32MX3XX/4XX Family core. In addition to the on a load, a store, or both. Data breakpoints can also
standard JTAG instructions, special instructions be set based on the value of the load/store operation.
defined in the EJTAG specification define what Finally, masks can be applied to both the virtual
registers are selected and how they are used. address and the load/store value.
Primary Oscillator
(POSC)
UFIN USB Clock (48 MHz)
div x PLL x24 div 2
OSCI 4 MHz ≤ UFIN ≤ 5 MHz UFRCEN
PLLDIV<2:0> UPLLEN
XT, HS, EC
OSCO
Peripherals
PBCLK out 4 MHz ≤ FIN ≤ 5 MHz Postscaler
available on XTPLL, HSPLL, div x
FIN ECPLL, FRCPLL PBCLK
OSCO pin div x PLL div y
in certain
clock modes
PLL Input Divider PLL Output Divider PBDIV<2:0>
FPLLIDIV<2:0> PLLODIV<2:0>
FRC
Oscillator PLL Multiplier
8 MHz typical COSC<2:0> PLLMULT<2:0>
FRC CPU & Select Peripherals
TUN<5:0>
FRC /16
div 16
FRCDIV
Postscaler
FRCDIV<2:0>
LPRC LPRC
Oscillator 32 kHz typical
SOSCI
Clock Control Logic
Fail-Safe FSCM INT
Clock
Monitor FSCM Event
NOSC<2:0>
COSC<2:0>
FSCMEN<1:0> OSWEN
WDT, PWRT
Timer1, RTCC
Note 1: This summary table contains partial register definitions that only pertain to the Oscillator peripheral. Refer to the
“PIC32MX Family Reference Manual” (DS61132) for a detailed description of these registers.
BF88_1070 IEC1 15:8 RTCCIE FSCMIE I2C2MIE I2C2SIE I2C2BIE U2TXIE U2RXIE U2EIE
BF88_1040 IFS1 15:8 RTCCIF FSCMIF I2C2MIF I2C2SIF I2C2BIF U2TXIF U2RXIF U2EIF
BF88_1110 IPC8 23:16 — — — FSCMIP<2:0> FSCMIS<1:0>
Note 1: This summary table contains partial register definitions that only pertain to the Oscillator peripheral. Refer to the
“PIC32MX Family Reference Manual” (DS61132) for a detailed description of these registers.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 15-14 FCKSM<1:0>: Fail-safe Clock Monitor (FSCM) and Clock Switch Configuration bits
1x = FSCM and Clock Switching are disabled
01 = Clock Switching is enabled, FSCM is disabled
00 = Clock Switching and FSCM are enabled
bit 13-12 FPBDIV<1:0>: Peripheral Bus Clock divisor default value
11 = PBCLK is SYSCLK divided by 8
10 = PBCLK is SYSCLK divided by 4
01 = PBCLK is SYSCLK divided by 2
00 = PBCLK is SYSCLK divided by 1
bit 10 OSCIOFNC: CLKO Enable Configuration bit
1 = CLKO output signal active on the OSCO pin; primary oscillator must be disabled or configured for
the External Clock mode (EC) for the CLKO to be active (POSCMD<1:0> = 11 or = 00)
0 = CLKO output disabled
bit 9-8 POSCMD<1:0>: Primary Oscillator Configuration bits
11 = Primary Oscillator Disabled
10 = HS mode
01 = XT Mode
00 = EC Mode
bit 7 IESO: Internal External Clock Switchover Select bit
1 = Internal External Clock Switchover mode enabled; Two-Speed Start-up mode
0 = Internal External Clock Switchover mode disabled; Single-Speed Start-up mode
bit 5 FSOSCEN: Secondary Oscillator Enable bit
1 = Enable secondary oscillator
0 = Disable secondary oscillator
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
FIGURE 4-2: CRYSTAL OR CERAMIC RESONATOR OPERATION (XT, XTPLL, HS, OR HSPLL
OSCILLATOR MODE)
To Internal Logic
OSCI
C1(3)
XTAL Enable
RF(2)
OSCO
RS(1)
C2(3)
PIC32MX3XX/4XX
Note 1: A series resistor, Rs, may be required for AT strip cut crystals.
2: The internal feedback resistor, RF, is typically in the range of 2 to 10 MΩ.
3: Refer to the “PIC32MX Family Reference Manual” (DS61132) for help determining the best oscillator components.
4.2.1.6 Internal Fast RC Oscillator (FRC) 4.2.1.6.3 Oscillator Tune Register (OSCTUN)
The FRC oscillator is a fast (8 MHz nominal), user trim- The FRC Oscillator Tuning register OSCTUN allows
mable, internal RC oscillator with user selectable input the user to fine tune the FRC oscillator over a range of
divider, PLL multiplier, and output divider. approximately ±12% (typical). Each bit increment or
decrement changes the factory calibrated frequency of
4.2.1.6.1 FRC Postscaler Mode (FRCDIV)
the FRC oscillator by a fixed amount.
Users are not limited to the nominal 8 MHz FRC output
if they wish to use the fast internal oscillator as a clock 4.2.1.7 Internal Low-Power RC Oscillator
source. An additional FRC mode, FRCDIV, implements (LPRC)
a selectable output divider that allows the choice of a The LPRC oscillator is separate from the FRC. It oscil-
lower clock frequency from 7 different options, plus the lates at a nominal frequency of 31.25 kHz. The LPRC
direct 8 MHz output. The output divider is configured oscillator is the clock source for the Power-up Timer
using the FRCDIV<2:0> bits (OSCCON<26:24>). (PWRT), Watchdog Timer (WDT), Fail Safe Clock Mon-
Assuming a nominal 8 MHz output, available lower fre- itor (FSCM) and PLL reference circuits. It may also be
quency options range from 4 MHz (divide-by-2) to used to provide a low-frequency clock source option for
31 kHz (divide-by-256). The range of frequencies the device in those applications where power
allows users the ability to save power at any time in an consumption is critical, and timing accuracy is not
application by simply changing the FRCDIV bits. The required.
FRCDIV mode is selected whenever the COSC bits
(OSCCON<14:12>) are ‘111’.
The effect of changing the PBCLK fre- 1. Enable USB PLL by setting FUPLLEN bit in
quency on individual peripherals should be DEVCFG2 register.
taken into account when selecting or 2. Based on the source clock, calculate the UPLL
changing the PBDIV value. input divider value such that the PLL input is 4
MHz
Performing back-to-back operations on
PBCLK peripheral registers when the PB 3. Set the UPLL input divider FUPLLIDIV bits in the
divisor is not set at 1:1 will cause the CPU DEVCFG2 register when programming the part.
to stall for a number of cycles. This stall 4.2.3.0.2 USB PLL Lock Status
occurs to prevent an operation from occur-
ring before the pervious one has com- The ULOCK bit (OSCCON<6>) is a read-only status bit
pleted. The length of the stall is that indicates the lock status of the USB PLL. It is auto-
determined by the ratio of the CPU and matically set after the typical time delay for the PLL to
PBCLK and synchronizing time between achieve lock, also designated as TULOCK. If the PLL
the two busses. does not stabilize properly during start-up, ULOCK may
Changing the PBCLK frequency has no not reflect the actual status of PLL lock, nor does it
effect on the SYSCLK peripherals detect when the PLL loses lock during normal opera-
operation. tion.
The ULOCK bit is cleared at a Power-on Reset. It
remains clear when any clock source not using the PLL
is selected.
Refer to the Electrical Characteristics section in the
specific device data sheet for further information on the
USB PLL lock interval.
4.2.6.4 Entering Sleep Mode During a Clock used as SYSCLK, such as after a clock switch, it can-
Switch not be disabled by writing to the SOSCEN bit. If the
SOSC is enabled by the SOSCEN bit, it will continue to
If the device enters Sleep mode during a clock switch
operate when the device is in SLEEP. To prevent inad-
operation, the clock switch operation is aborted. The
vertent clock changes the OSCCON register is locked.
processor keeps the old clock selection and the
It must be unlocked prior to software enabling or
OSWEN bit (OSCCON<0>) is cleared. The WAIT
disabling the SOSC.
instruction is then executed normally.
MCLR
MCLR
Glitch Filter
Brown-out BOR
Reset
Configuration
Mismatch
Reset CMR
SWR
Software Reset
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
SLEEP
WDTO
EXTR
SWR
IDLE
BOR
POR
CM
Condition Program Counter
TABLE 5-4: CODE EXECUTION START TIME FOR VARIOUS DEVICE RESETS
System Clock
Reset Type Clock Source Power-Up Delay(1)(2)(3) FSCM Delay(6)
Delay(4)(5)
POR EC, FRC, FRCDIV, LPRC (TPU OR TPWRT) + TSYSDLY — —
ECPLL, FRCPLL (TPU OR TPWRT) + TSYSDLY TLOCK TFSCM
XT, HS, SOSC (TPU OR TPWRT) + TSYSDLY TOST TFSCM
XTPLL, HSPLL (TPU OR TPWRT) + TSYSDLY TOST + TLOCK TFSCM
BOR EC, FRC, FRCDIV, LPRC TSYSDLY — —
ECPLL, FRCPLL TSYSDLY TLOCK TFSCM
XT, HS, SOSC TSYSDLY TOST TFSCM
XTPLL TSYSDLY TOST + TLOCK TFSCM
MCLR, CMR, Any Clock TSYSDLY — —
SWR, WDTO
Note 1: TPU = Power-up Period with on-chip regulator enabled.
2: TPWRT = Power-up Period (POWER-UP TIMER) with on-chip regulator disabled.
3: TSYSDLY = Time required to reload Device Configuration Fuses plus 8 SYSCLK cycles.
4: TOST = Oscillator Start-up Timer.
5: TLOCK = PLL lock time.
6: TFSCM = Fail-Safe Clock Monitor delay.
Note: For parameter specifications, see Section 30.2 “AC Characteristics and Timing Parameters.”
0x8FFFFFFF
Reserved
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
R R R R R R R R
BMXDRMSZ<23:16>
bit 23 bit 16
R R R R R R R R
BMXDRMSZ<15:8>
bit 15 bit 8
R R R R R R R R
BMXDRMSZ<7:0>
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
R R R R R R R R
BMXPFMSZ<23:16>
bit 23 bit 16
R R R R R R R R
BMXPFMSZ<15:8>
bit 15 bit 8
R R R R R R R R
BMXPFMSZ<7:0>
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
R R R R R R R R
BMXBOOTSZ<23:16>
bit 23 bit 16
R R R R R R R R
BMXBOOTSZ<15:8>
bit 15 bit 8
R R R R R R R R
BMXBOOTSZ<7:0>
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
0xFFFFFFFF
KERNEL
SEGMENTS
(KSEG 0,1,2,3)
0x80000000
0x7FFFFFFF
USER / KERNEL
SEGMENT
(USEG / KUSEG)
0x00000000
Memory Type Begin Address End Address Begin Address End Address Calculation
Boot Flash 0xBFC00000 0xBFC02FFF 0x1FC00000 0x1FC02FFF 12 KB
Program 0xBD000000 0xBD000000 + 0x1D000000 0x1D00000 + BMXPUPBA
Kernel Address Space
KSEG0: 0x9D000000
+BMXPUPBA
0x00000000
KSEG0: 0x80000000
+BMXDUDBA 0x00000000
RAM Size(2)
+BMXDUDBA Optional
Kernel Program Partition
KSEG 0/1
KSEG0: 0x80000000
+BMXDKPBA 0x00000000
KSEG1: 0xA0000000 +BMXDKPBA
RAM Size(1)
+BMXDKPBA
Kernel Data Partition
KSEG 0/1
0x00000000
0x7D00_0000 + 0xBD00_0000 +
BMXPUPBA - 1 BMXPUPBA - 1
0x7D00_0000 + 0xBD00_0000 + PFM PFM PFM PFM PFM
BMXPUPBA BMXPUPBA User Program User Program User Program User Program User Program
0x7D00_7FFF 0xBD00_7FFF
RSVD
0x7D00_FFFF 0xBD00_FFFF
RSVD
0x7D01_FFFF 0xBD01_FFFF
RSVD
0x7D03_FFFF 0xBD03_FFFF
RSVD
0x7D07_FFFF 0xBD07_FFFF
0x7D08_0000 0xBD08_0000 RSVD
0x7D08_0000 + 0xBD08_0000 +
BMXDUPBA - 1 BMXDUPBA - 1
0x7F00_0000 + 0xBF00_0000 + DRM DRM DRM DRM DRM
BMXDUDBA BMXDUDBA User Data User Data User Data User Data User Data
0x7F00_0000 + 0xBF00_0000 +
BMXDUPBA - 1 BMXDUPBA - 1
0x7F00_0000 + 0xBF00_0000 + DRM DRM DRM DRM DRM
BMXDUPBA BMXDUPBA User Program User Program User Program User Program User Program
0x7FFF_FFFF 0xBFFF_FFFF
Note 1: Not available in KSEG0 if mapped to USEG/KUSEG (i.e. BMXDUDBA or BMXDUPBA non-zero).
2: Not available in KSEG0 if mapped in USEG/KUSEG (i.e. BMXPUPBA non-zero).
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
// Write Keys
NVMKEY = 0xAA996655;
NVMKEY = 0x556699AA;
// Restore Interrupts
if (status & 0x00000001
asm volatile (“ei”);
else
asm volatile (“di”);
// Return Result
return res;
}
// Write Keys
NVMKEY = 0xAA996655;
NVMKEY = 0x556699AA;
// Restore Interrupts
if (status & 0x00000001
asm volatile (“ei”);
else
asm volatile (“di”);
// Return Result
return res;
}
// Write Keys
NVMKEY = 0xAA996655;
NVMKEY = 0x556699AA;
// Restore Interrupts
if (status & 0x00000001
asm volatile (“ei”);
else
asm volatile (“di”);
// Return Result
return res;
}
// Write Keys
NVMKEY = 0xAA996655;
NVMKEY = 0x556699AA;
// Restore Interrupts
if (status & 0x00000001
asm volatile (“ei”);
else
asm volatile (“di”);
// Return Result
return res;
}
Vector Number
Note: Several of the registers cited in this section are not in the interrupt controller module. These registers (and
bits) are associated with the CPU. Details about them are available in Section 2.0 "PIC32MX MCU".
To avoid confusion, a typographic distinction is made for registers in the CPU. The register names in this
section, and all other sections of this manual, are signified by uppercase letters only.CPU register names
are signified by upper and lowercase letters. For example, INTSTAT is an Interrupts register; whereas,
IntCtl is a CPU register.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit value at POR (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit value at POR (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit value at POR (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit value at POR (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit value at POR (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit value at POR (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
StatusIPL
RIPL Any Request
Interrupt Request
>
IPL
•
StatusIE
Interrupt Exception
Load IntCtlVS
Fields
Vector Number
Interrupt Sources
Interrupt Module
Generator
Offset
CauseRIPL
Requested IPL Exception Vector Offset
Note: SRSCtl, Cause, Status, and IntCtl registers are CPU registers and are described in Section 2. “CPU”.
This code example uses MPLAB C32 intrinsic functions to access CP0 registers.
Check your compiler documentation to find equivalent functions or use inline assembly
*/
unsigned int temp;
/*
Set the CP0 registers for multi-vector interrupt
Place EBASE at 0xBD000000 and Vector Spacing to 32 bytes
This code example uses MPLAB C32 intrinsic functions to access CP0 registers.
Check your compiler documentation to find equivalent functions or use inline assembly
*/
unsigned int temp;
8.5.2 INTERRUPT SUBPRIORITY IPCx register contains subpriority bits for four of the
interrupt vectors. These bits define the subpriority
The user can assign a subpriority level within each
within the priority level of the vector. The user-
group priority. The subpriority will not cause preemption
selectable subpriority levels range from 0 (the lowest
of an interrupt in the same priority; rather, if two inter-
subpriority) to 3 (the highest).
rupts with the same priority are pending, the interrupt
with the highest subpriority will be handled first. The
subpriority bits are located in the IPCx register. Each
8.8 Temporal Proximity Interrupt Interrupt proximity interrupt uses the interrupt proximity
Coalescing timer, IPTMR, to create a temporal window in which a
group of interrupts of the same, or lower, priority will be
The PIC32MX3XX/4XX CPU responds to interrupt held off. The user can activate temporal proximity inter-
events as if they are all immediately critical because rupt coalescing by performing the following steps:
the interrupt controller asserts the interrupt request to
• Set the TPC<2:0> INTCON<10:8> bit to the pre-
the CPU when the interrupt request occurs. The CPU
ferred priority level. (Setting TPC to zero will dis-
immediately recognizes the interrupt if the current CPU
able the proximity timer.)
priority is lower than the pending priority. Entering and
exiting an ISR consumes clock cycles for saving and • Load the preferred 32-bit value to IPTMR.
restoring context. Events are asynchronous with The interrupt proximity timer will trigger when an inter-
respect to the main program and have a limited rupt request of a priority equal, or lower, matches the
possibility of occurring simultaneously or close together TPC value.
in time. This prevents the ability of a shared ISR to
process multiple interrupts at one time.
FSM CTRL
CTRL
Bus Ctrl
BMX/CPU
Cache Ctrl
Prefetch Ctrl
Cache
Line RDATA
Hit LRU
Address
Encode
Miss LRU
Hit Logic
PreFetch PreFetch
Pre-Fetch Pre-Fetch
Tag
RDATA
CTRL
PFM
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 31 CHEWEN: Cache Access Enable bits for registers CHETAG, CHEMSK, CHEW0, CHEW1, CHEW2,
and CHEW3
1 = The cache line selected by CHEIDX is writable
0 = The cache line selected by CHEIDX is not writable
bit 30-4 Reserved: Write ‘0’; ignore read
bit 3-0 CHEIDX<3:0>: Cache Line Index bits
The value selects the cache line for reading or writing.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 15 bit 8
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Memory to Peripheral
Channel Auto-Enable
Unaligned Transfers
Memory to Memory
Channel Chaining
Events Start/Stop
CRC Calculation
Different Source
Transfer Length
Pattern Match
Detection
Transfers
Transfers
<= 256B Yes Yes Yes Yes Yes Yes Yes Yes Yes
SE
L
Peripheral Bus Address Decoder Channel 0 Control I0
I2
Channel Priority
Arbitration
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
•••
00000001 = Interrupt 1 will abort any transfers in progress and set CHAIF flag
00000000 = Interrupt 0 will abort any transfers in progress and set CHAIF flag
bit 15-8 CHSIRQ<7:0>: IRQ that will Start Channel Transfer bits
11111111 = Interrupt 255 will initiate a DMA transfer
•••
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
•••
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
•••
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
•••
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
•••
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
•••
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
•••
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
// initiate a transfer
DCH0ECONSET=0x00000080; // set CFORCE to 1
// do something else
while(TRUE)
{
register int pollCnt; // use a poll counter.
// polling continuously the DMA controller in a tight
// loop would affect the performance of the DMA transfer
int dmaFlags=DCH0INT;
if( (dmaFlags&0xb)
{ // one of CHERIF (DCHxINT<0>), CHTAIF (DCHxINT<1>)
// or CHBCIF (DCHxINT<3>) flags set
break; // transfer completed
}
pollCnt=100; // use an adjusted value here
while(pollCnt--); // wait before reading again the DMA controller
}
DCH0ECON=(27 <<8)| 0x30; // start irq is UART1 RX, pattern match enabled
DCH0DAT=’\r’; // pattern value, carriage return
// do something else
/*
The following code example illustrates the DMA channel 0 configuration for data transfer
with pattern match enabled. DMA channel 0 transfer from the UART1 to a RAM buffer while DMA
channel 1 transfers data from the RAM buffer to UART2. Transferred strings are at most 256
characters long. Transfer on UART2 will start as soon as the UART1 transfer is completed.
*/
// do something else
DCH0CONSET=0x80; // channel 0 on
// initiate a transfer
DCH0ECONSET=0x00000080; // set CFORCE to 1
BOOL error=FALSE;
while(TRUE)
{
register int pollCnt; // don’t poll in a tight loop
int dmaFlags=DCH0INT;
if( (dmaFlags& 0x3)
{ // CHERIF (DCHxINT<0>) or CHTAIF (DCHxINT<1> set
error=TRUE; // error or aborted...
break;
}
else if (dmaFlags&0x8)
{ // CHBCIF (DCHxINT<3>) set
break; // transfer completed normally
}
pollCnt=100; // use an adjusted value here
while(pollCnt--); // wait before polling again
}
if(!error)
{
blockCrc=DCRDATA; // read the CRC of the transferred flash block
}
else
{
// process error
}
DCH0CONSET=0x80; // channel 0 on
// initiate a transfer
DCH0ECONSET=0x00000080; // set CFORCE to 1
if(error)
{
// process error
}
// do something else
USBEN
FRC
USB Suspend Oscillator
8 MHz Typical
CPU Clock Not POSC
Sleep TUN<5:0>(4)
Primary Oscillator
(POSC)
UFIN(5)
Div x PLL Div 2
OSC1 UFRCEN(3)
FUPLLIDIV(6) FUPLLEN(6)
USB Suspend To Clock Generator for Core and Peripherals
OSC2 Sleep or Idle
(PB out)(1)
USB Module
USB
SRP Charge Voltage
VBUS Comparators
SRP Discharge
D+(2)
Registers
and
Control
Host Pull-down Interface
SIE
Transceiver
Low Speed Pull-up
D-(2)
DMA System
controller RAM
Host Pull-down
ID Pull-up
ID(8)
VBUSON(8)
To prevent colliding a packet data with the SOF token 11.1.20 CLEARING USB OTG INTERRUPTS
that is sent every 1 ms, the USB module will not send
Unlike other device-level interrupts, the USB OTG
any new transactions within the last U1SOF byte times.
interrupt status flags are not freely writable in software.
The USB module will complete any transactions that
All USB OTG flag bits are implemented as hardware-
are in progress. In Host mode, the SOF interrupt occurs
set bits. These bits can only be cleared in software by
when this threshold is reached, not when the SOF
writing a ‘1’ to their locations. Writing a ‘0’ to a flag bit
occurs. In Device mode, the interrupt occurs when a
has no effect.
SOF is received. Transactions started within the SOF
threshold are held by the USB module until after the Note: Throughout this section, a bit that can only
SOF token is sent. be cleared by writing a ‘1’ to its location is
referred to as “Write ‘1’ to clear bit”. In reg-
11.1.16 U1BDTP1, U1BDTP2 AND U1BDTP3 ister descriptions, this function is indicated
REGISTERS by the descriptor ‘K’.
These registers (Register 11-17, Register 11-18 and
Register 11-19) are read/write registers that define the
upper 23 bits of the 32-bit base address of the Buffer
Descriptor Table (BDT) in the system memory. The
BDT is forced to be 512 byte-aligned. This register
allows relocation of the BDT in real time.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit K = Write ‘1’ to clear -n = Bit Value at POR: (‘0’, ‘1’, x = unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit K = Write ‘1’ to clear -n = Bit Value at POR: (‘0’, ‘1’, x = unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit K = Write ‘1’ to clear -n = Bit Value at POR: (0, 1, x = unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit K = Write ‘1’ to clear -n = Bit Value at POR: (‘0’, ‘1’, x = unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Address Offset +0
31 26 25 16 15 8 7 6 5 4 3 2 1 0
DATA0/1
— BYTE COUNT<9:0> —
BSTALL
—
UOWN
KEEP
NINC
DTS
Address Offset +4
31 0
BUFFER ADDRESS<31:0>
Address Offset +0
Address Offset +4
31 26 25 16 15 8 7 6 5 4 3 2 1 0
DATA0/1
— BYTE COUNT<9:0> — PID<3:0> —
UOWN
Address Offset +4
31 0
BUFFER ADDRESS<31:0>
Address Offset +0
Address Offset +4
VUSB
3.3V
D+
2
USB Module
D-
3
VUSB
External Power 3.3V
5V
VBUSON
USB Module
D+
2
D-
3
VUSB
External Power 3.3V
5V
VBUSON
USB Type
Micro ‘AB’
Connector
D+
2 USB Module
D-
3
ID
4
1 Full-Speed Frame
SOF Threshold
U1SOF * 8
bit times
SOF SOF
Note 1: While the U1SOF register value is described in terms of bytes, these examples show the result in terms
of bits.
2: In the second table, the IN, DATA, and HANDSHAKE packets are transmitted at low speed (8 times slower
than full speed).
3: These calculations do not take the possibility that the packet data needs to be bit-stuffed for NRZI encoding
into account.
SOFIF
URSTIF Interrupt Generated
Interrupt Generated
Control
SETUP TOKEN DATA ACK
TRNIF
Interrupt Generated
TRNIF
Interrupt Generated
TRNIF
Interrupt Generated
= Host = Function
STALLIF
STALLIE
ATTACHIF
ATTACHIE
RESUMEIF
RESUMEIE
IDLEIF
IDLEIE
TRNIF
TRNIE
BTSEF SOFIF
SOFIE
BTSEE
DMAEF
DMAEE DETACHIF/URSTIF USB Interrupt
DETACHIE/URSTIE
BTOEF
BTOEE UERRIF
DFN8EF UERRIE
DFN8EE
CRC16EF IDIF
CRC16EE IDIE
CRC5EF/EOFEF T1MSECIF
CRC5EE/EOFEE T1MSECIE
PIDEF LSTATEIF
PIDEE LSTATEIE
BMXEF ACTVIF
BMXEE ACTVIE
SESVDIF
SESVDIE
SESENDIF
SESENDIE
VBUSVDIF
VBUSVDIE
Note 1: All pins are subject to the device pin priority control. See the specific device data sheet for further
information.
2: When USB is enabled, this pin is controlled by the USB module and therefore is not available as a
comparator input.
Note 1: All pins are subject to the device pin priority control. See the specific device data sheet for further
information.
2: When USB is enabled, this pin is controlled by the USB module and therefore is not available as a
comparator input.
RD ODC
Data Bus D Q
SYSCLK CK ODC
Q
EN
WR ODC
RD TRIS I/O Cell
0
1
D Q
CK TRIS
Q
EN
WR TRIS
D Q
CK LAT I/O pin
Q
EN
WR LAT
WR PORT
RD LAT
RD PORT 0
Q D Q D
Sleep Q CK Q CK
SYSCLK
Synchronization
PIO Module
RD ODC
Data Bus D Q
SYSCLK CK ODC
Q
EN
WR ODC
1 IO Cell
RD TRIS 0
0
1
D Q
TRIS 1
CK
Q 0
EN
WR TRIS
Output Multiplexers
D Q
CK LAT IO Pin
Q
EN
WR LAT
WR PORT
RD LAT
RD PORT 0
Q D Q D
Sleep Q CK Q CK
SYSCLK
Synchronization
Peripheral Input R
Peripheral Input Buffer
Notes: This block diagram is a general representation of a shared port/peripheral structure for illustration purposes
only. The actual structure for any specific port/peripheral combination may be different than what is shown
here.
Legend: R = Peripheral input buffer types may vary. Refer to the specific PIC32MX3XX/4XX data sheet for peripheral
details.
BF88_1070 IEC1 7:0 SPI2RXIE SPI2TXIE SPI2EIE CMP2IE CMP1IE PMPIE AD1IE CNIE
BF88_1040 IFS1 7:0 SPI2RXIF SPI2TXIF SPI2EIF CMP2IF CMP1IF PMPIF AD1IF CNIF
BF88_10F0 IPC6 23:16 — — — CNIP<2:0> CNIS<1:0>
Note: This summary table contains partial register definitions that only pertain to the GPIO peripheral. Refer to the “PIC32MX Family
Reference Manual” (DS61132) for a detailed description of these registers.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable r = Reserved bit
U = Unimplemented bit, read as ‘0’ -n = Bit value at POR: (‘0’, ‘1’, x = unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Note: The CN ISR code example shows MPLAB® C32 C compiler-specific syntax. Refer to your compiler manual
regarding support for ISRs.
PR1
Equal
16-bit Comparator TSYNC (T1CON<2>)
1 Sync
TMR1
Reset
0
0
T1IF
Event Flag 1 Q D TGATE (T1CON<7>)
Q
TCS (T1CON<1>)
TGATE (T1CON<7>)
ON (T1CON<15>)
SOSCO/T1CK x1
Gate Prescaler
SOSCEN
Sync 10 1, 8, 64, 256
SOSCI
PBCLK 00
2
TCKPS<1:0>
(T1CON<5:4>)
Note 1: The default state of the SOSCEN (OSCCON<1>) during a device Reset is controlled by the FSOSCEN bit in
Configuration Word DEVCFG1.
BF88_1060 IEC0 7:0 INT1IE OC1IE IC2IE T1IE INT0IE CS1IE CS0IE CTIE
BF88_1030 IFS0 7:0 INT1IF OC1IF IC2IF T1IF INT0IF CS1IF CS0IF CTIF
BF88_10A0 IPC1 7:0 — — — T1IP<2:0> T1IS<1:0>
Note 1: This summary table contains partial register definitions that only pertain to the Timer1 peripheral. Refer to the “PIC32MX
Family Reference Manual” (DS61132) for a detailed description of these registers.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Note: The timer ISR code example shows MPLAB® C32 C Compiler specific syntax. Refer to your compiler
manual regarding support for ISRs.
Legend:
CMOS = CMOS compatible input or output ST = Schmitt Trigger input with CMOS levels
I = Input O = Output
Note 1: This pin is only required for Gated Timer or External Synchronous Clock modes. Otherwise, this pin can be used for general
purpose I/O and requires the user to set the corresponding TRIS control register bits.
2: This bit is located in the T1CON register.
TMRx Sync
(Note 1)
ADC Event
Trigger Comparator x 16
Equal
PRx
Reset
0
TxIF
Event Flag 1 Q D TGATE (TxCON<7>)
Q TCS (TxCON<1>)
TGATE (TxCON<7>)
ON (TxCON<15>)
(Note 2)
TxCK x1
Prescaler
Gate 1, 2, 4, 8, 16,
Sync 10
32, 64, 256
PBCLK 00
3
Note 1: ADC event trigger is available on Timer3 only. TCKPS (TxCON<6:4>)
2: TxCK pins not available on 64-pin devices.
Reset
TMRy TMRx Sync
(Note 3)
MSHalfWord LSHalfWord
ADC Event
Trigger 32-bit Comparator
Equal
PRy PRx
TyIF Event 0
Flag
1 Q D TGATE (TxCON<7>)
Q TCS (TxCON<1>)
TGATE (TxCON<7>)
ON (TxCON<15>)
(Note 2)
TxCK x1
Prescaler
Gate 1, 2, 4, 8, 16,
Sync 10
32, 64, 256
PBCLK 00
3
TCKPS (TxCON<6:4>)
Note 1: In this diagram, the use of “x’ in registers TxCON, TMRx, PRx, TxCK refers to either
Timer2 or Timer4; the use of ‘y’ in registers TyCON, TMRy, PRy, TyIF refers to either Timer3 or Timer5.
2: TxCK pins not available on 64-pin devices.
3: ADC event trigger is available only on Timer2/3 pair.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
14.3.6 CONSIDERATIONS
• 32-bit timer pairs can be created using Timer2
with Timer3, or Timer4 with Timer5.
• With Timer2 or Timer4 enabled, setting the T32 bit
(T2CON<3> or T4CON<3>) = 1 automatically
enables the corresponding Timer3 or Timer5
module. For this reason, it is not necessary to
manually enable Timer3 or Timer5.
• T2CON and T4CON control registers are used for
configuring the 32-bit timer operations; Writes to
T3CON and T5CON are ignored.
• T2CK and T4CK input pins are utilized for the 32-
bit gated timer or external synchronous counter
operations; T3CK and T5CK are ignored.
• 32-bit timer interrupts use Timer3 or Timer5 inter-
rupt enable bits and interrupt flag bits; Timer2 and
Timer4 interrupt enable and interrupt flag bits are
ignored.
• Load TMRxy pair by writing the 32-bit value to
TMRx.
• Load PRxy pair by writing the 32-bit value to PRx.
14.3.10 CONSIDERATIONS
Associated with the clock prescale selection bits is a
prescale counter. The timer prescale counter is cleared
when any of the following conditions occur:
1. Any device Reset, except a Power-on Reset.
2. The timer is disabled.
3. Any write to the TMR register.
Note: When the timer clock source is external and
the timer clock prescale = N (other than
1:1), 2 to 3 external clock cycles are
required to reset and synchronize the
prescaler.
• When the timer clock source is external and the
timer clock prescale = N (other than 1:1), 2 to 3
external clock cycles are required, after the timer
ON bit is set = 1, before the TMRx Count register
increments.
• After a timer match event (TMRx = PRx) and
depending on the timer clock prescale setting N
(other than 1:1), the timer will require N additional
(PBCLK or external) clock cycles before the
TMRx Counter register resets to 0x0000. Reading
the TMRx Count register just after the timer match
event, but before the TMRx Count register is
reset, will return the timer match value.
Note: The timer ISR code example shows MPLAB® C32 Compiler specific syntax. Refer to your compiler manual
regarding support for ISRs.
TABLE 14-2: I/O PIN CONFIGURATION FOR USE WITH TIMER MODULES
Required Settings for Module
Pin Control
Legend:
CMOS = CMOS compatible input or output ST = Schmitt Trigger input with CMOS levels
I = Input O = Output
Note 1: These pins are only required for modes using gated timer or external clock inputs. Otherwise, these pins can be used for
general purpose I/O and require the user to set the corresponding TRIS register bits. TxCK pins not available on 64-pin
devices.
2: These bits are located in the TxCON register.
ICTMR
0 1
ICC32
FIFO Control
ICxBUF<31:16> ICxBUF<15:0>
Prescaler
Edge Detect
1, 4, 16
ICM<2:0> ICBNE
ICFEDGE ICOV
ICM<2:0>
Interrupt
ICxCON Event
ICI<1:0> Generation
BF88_1060 IEC0 23:16 SPI1EIE OC5IE IC5IE T5IE INT4IE OC4IE IC4IE T4IE
BF88_1030 IFS0 23:16 SPI1EIF OC5IF IC5IF T5IF INT4IF OC4IF IC4IF T4IF
BF88_10D0 IPC4 15:8 — — — IC4IP<2:0> IC4IS<1:0>
Note 1: This summary table contains partial register definitions that only pertain to the Input Capture4 peripheral. Refer to the “PIC32MX Family
Reference Manual” (DS61132) for a detailed description of these registers.
BF88_1060 IEC0 23:16 SPI1EIE OC5IE IC5IE T5IE INT4IE OC4IE IC4IE T4IE
BF88_1030 IFS0 23:16 SPI1EIF OC5IF IC5IF T5IF INT4IF OC4IF IC4IF T4IF
BF88_10E0 IPC5 15:8 — — — IC5IP<2:0> IC5IS<1:0>
Note 1: This summary table contains partial register definitions that only pertain to the Input Capture5 peripheral. Refer to the “PIC32MX Family
Reference Manual” (DS61132) for a detailed description of these registers.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
The timers clock can be setup using the internal periph- Note: Since the capture input must be synchro-
eral clock source, or using a synchronized external nized to the peripheral clock, the module
clock source applied at the TxCK pin. captures the timer count value, which is valid
2-3 peripheral clock cycles (TPB) after the
capture event.
An input capture interrupt event is generated after one,
two, three or four timer count captures, as configured
by ICI (ICxCON<6:5>).
FIGURE 15-2: SIMPLE CAPTURE EVENT TIMING DIAGRAM CAPTURE EVERY RISING EDGE
Peripheral Clock
ICx Input
Synchronized Capture
Capture Interrupt
TICX_IN_L
TICX_IN_H
Capture Input
Prescaler Count 1 2 3 4
Prescaler Output
Synchronized Capture
Capture Interrupt
15.4 Edge Detect (Hall Sensor) Mode 15.5 Interrupt Only Mode
In Edge Detect mode, the input capture module cap- When the Input Capture module is set for Interrupt
tures a timer count value on every edge of the capture Only mode (ICM = ‘111’) and the device is in Sleep or
input. Edge Detect mode is selected by setting the ICM Idle mode, the capture input functions as an interrupt
bit to ‘001’. In this mode, the capture prescaler is not pin. Any rising edge on the capture input triggers an
used and the capture overflow bit, ICOV (ICxCON<4>) interrupt. No timer values are captured and the FIFO
is not updated. In this mode, the Interrupt Control bits buffer is not updated. When the device leaves Sleep or
(ICI, ICxCON<6:5>) are ignored and an interrupt event Idle mode, the interrupt signal is deasserted.
is generated for every timer count capture In this mode, since no timer values are captured, the
Timer Select bit ICTMR (ICxCON<7>) is ignored and
there is no need to configure the timer source. A wake-
up interrupt is generated on the first rising edge, there-
fore the Interrupt Control bits ICI (ICxCON<6:5>) are
also ignored. The prescaler is not used in this mode.
OCxRS(1)
Output S Q
OCxR(1) OCx(1)
Logic R
3 Output Enable
OCM<2:0>
Mode Select OCFA or OCFB
Comparator (see Note 2)
0 1 OCTSEL 0 1
16 16
Note 1: Where ‘x’ is shown, reference is made to the registers associated with the respective output compare
channels 1 through 5.
2: The OCFA pin controls the OC1-OC4 channels. The OCFB pin controls the OC5 channel.
3: Each output compare channel can use one of two selectable 16-bit time bases or a single 32-bit timer base.
BF88_1060 IEC0 23:16 SPI1EIE OC5IE IC5IE T5IE INT4IE OC4IE IC4IE T4IE
BF88_1030 IFS0 23:16 SPI1EIF OC5IF IC5IF T5IF INT4IF OC4IF IC4IF T4IF
BF88_10D0 IPC4 23:16 — — — OC4IP<2:0> OC4IS<1:0>
Note 1: This summary table contains partial register definitions that only pertain to the Output Compare4 peripheral. Refer to the “PIC32MX Family
Reference Manual” (DS61132) for a detailed description of these registers.
BF88_1060 IEC0 23:16 SPI1EIE OC5IE IC5IE T5IE INT4IE OC4IE IC4IE T4IE
BF88_1030 IFS0 23:16 SPI1EIF OC5IF IC5IF T5IF INT4IF OC4IF IC4IF T4IF
BF88_10E0 IPC5 23:16 — — — OC5IP<2:0> OC5IS<1:0>
Note 1: This summary table contains partial register definitions that only pertain to the Output Compare5 peripheral. Refer to the “PIC32MX Family
Reference Manual” (DS61132) for a detailed description of these registers.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 31-16 OCxR<31:16>: Upper 16 bits of 32-bit compare value when OC32 (OCxCON<5>) = 1
bit 15-0 OCxR<15:0>: Lower 16 bits of 32-bit compare value or entire 16 bits of 16-bit compare value
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 31-16 OCxRS<31:16>: Upper 16 bits of 32-bit compare value, when OC32 (OCxCON<5>) = 1
bit 15-0 OCxRS<15:0>: Lower 16 bits of 32-bit compare value or entire 16 bits of 16-bit compare value
// configure int
IF0CLR = 0x00000080; // Clear the OC1 interrupt flag
IE0SET = 0x00000080; // Enable OC1 interrupt
IPC1SET = 0x0030000; // Set OC1 interrupt subpriority to 3,
// the highest level
IPC1SET = 0x00000003; // Set subpriority to 3, maximum
FPB
log10 (F PWM • ) bits
TMRy • Prescaler
Maximum PWM Resolution (bits) =
log10(2)
Find the maximum resolution of the duty cycle that can be used with a 52.08 kHz PWM frequency
and a 10 MHz peripheral bus clock rate.
Note: If the PR value exceeds 16 bits the module must be used in 32-bit mode to maintain the calculated PWM
resolution. If reduced resolution is acceptable the timer prescaler may be increased and the calculation
repeated until the result is a 16-bit value. Increasing the timer prescaler to allow operation in 16-bit mode
may result in reduced PWM resolution.
EXAMPLE 16-3: PWM MODE PULSE SETUP AND INTERRUPT SERVICING (32-BIT MODE)
// The following code example will set the Output Compare 1 module
// for PWM mode with FAULT pin disabled, a 50% duty cycle and a
// PWM frequency of 52.08 kHz at FPB = 40 MHz. Timer2 is selected as
// the clock for the PWM time base and Output Compare 1 interrupts
// are enabled.
// configure int
IFS0 &= ~0x00000080; // Clear the OC1 interrupt flag
IEC0 |= 0x00000080; // Enable OC1 interrupt
IPC1 |= 0x001C0000; // Set OC1 interrupt priority to 7,
// the highest level
IPC1 |= 0x00000003; // Set subpriority to 3, maximum
TABLE 16-13: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS WITH PERIPHERAL BUS
CLOCK OF 30 MHZ (16-BIT MODE)
PWM Frequency 58 Hz 458 Hz 916 Hz 7.32 kHz 29.3 kHz 234 kHz 938 kHz
Timer Prescaler Ratio 8 1 1 1 1 1 1
Period Register Value (hex) 0xFC8E 0xFFDD 0x7FEE 0x1001 0x03FE 0x007F 0x001E
Resolution (bits) (decimal) 16 16 15 12 10 7 5
TABLE 16-14: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS WITH PERIPHERAL BUS
CLOCK OF 50 MHZ (16-BIT MODE)
PWM Frequency 58 Hz 458 Hz 916 Hz 7.32 kHz 29.3 kHz 234 kHz 938 kHz
Timer Prescaler Ratio 64 8 1 1 1 1 1
Period Register Value (hex) 0x349C 0x354D 0xD538 0x1AAD 0x06A9 0x00D4 0x0034
Resolution (bits) (decimal) 13.7 13.7 15.7 12.7 10.7 7.7 5.7
TABLE 16-15: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS WITH PERIPHERAL BUS
CLOCK OF 50 MHZ (16-BIT MODE)
PWM Frequency 100 Hz 200 Hz 500 Hz 1 kHz 2 kHz 5 kHz 10 kHz
Timer Prescaler Ratio 8 8 8 1 8 1 1
Period Register Value (hex) 0xF423 0x7A11 0x30D3 0xC34F 0x0C34 0x270F 0x1387
Resolution (bits) (decimal) 15.9 14.9 13.6 15.6 11.6 13.3 12.3
TABLE 16-16: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS WITH PERIPHERAL BUS
CLOCK OF 50 MHZ (16-BIT MODE)
PWM Frequency 100 Hz 200 Hz 500 Hz 1 kHz 2 kHz 5 kHz 10 kHz
Timer Prescaler Ratio 8 4 2 1 1 1 1
Period Register Value (hex) 0xF423 0xF423 0xC34F 0x0C34F 0x61A7 0x270F 0x1387
Resolution (bits) (decimal) 15.9 15.9 15.6 15.6 14.6 13.3 12.3
TABLE 16-17: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS WITH PERIPHERAL BUS
CLOCK OF 50 MHZ (32-BIT MODE)
PWM
100 Hz 200 Hz 500 Hz 1 kHz 2 kHz 5 kHz 10 kHz
Frequency
Period Register 1 1 1 1 1 8 1
Value (hex)
Resolution (bits) 0x0007A11F 0x0003D08F 0x0001869F 0x0000C34F 0x000061A7 0x000004E1 0x00001387
(decimal)
Resolution (bits) 18.9 17.9 16.6 15.6 14.6 10.3 12.3
Internal
Data Bus
SPIxBUF
Read Write
Registers share address SPIxBUF
SPIxRXB SPIxTXB
Transmit
Receive
SPIxSR
SDIx bit 0
SDOx Shift
Control
Slave Select Clock Edge
and Frame Control Select
SSx/FSYNC Sync Control
Baud Rate
PBCLK
Generator
SCKx
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
PIC32MX3XX/4XX PROCESSOR 2
[SPI Master] [SPI Slave]
SDOx SDIx
SDIx SDOx
Shift Register Shift Register
(SPIxSR) (SPIxSR)
Serial Clock
SCKx SCKx SPI Buffer
SPI Buffer
(SPIxBUF) (SPIxBUF)
GPIO/SSx SSx(1)
.
User writes
to SPIxBUF User writes new data
SPIxTXB to SPIxSR(3) during transmission
SPITBE
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
SDIx(2)
(SMP = 0) bit 7 bit 0
Input
Sample(2) Two modes
(SMP = 0) available for
SMP control
SDIx bit(4)
(SMP = 1) bit 7 bit 0
Input
Sample
(SMP = 1)
SPIxRXIF
SPIxSR moved
SPIRBF into SPIxRXB
(SPIxSTAT<0>)
User reads
SPIxBUF
Note 1: Four SPI Clock modes are shown here to demonstrate the functionality of bits CKP (SPIxCON<6>) and CKE
(SPIxCON<8>). Only one of the four modes can be chosen for operation.
2: The SDI and input samples shown here for two different values of the SMP bit (SPIxCON<9>) are strictly for
demonstration purposes. Only one of the two configurations of the SMP bit can be chosen during operation.
3: If there are no pending transmissions, SPIxTXB is transferred to SPIxSR as soon as the user writes to SPIxBUF.
4: The operation for 8-bit mode is shown. The 16-bit and 32-bit modes are similar.
SCKx Input(1)
(CKP = 0
CKE = 0)
SCKx Input(1)
(CKP = 1
CKE = 0)
SDIx Input
(3)
(SMP = 0) bit 7 bit 0
Input
Sample
(SMP = 0)
User writes to
SPIxBUF(2)
SPITBE
SPIxSR to
SPIxRXB
SPIRBF
Note 1: Two SPI Clock modes shown only to demonstrate CKP (SPIxCON<6>) and CKE (SPIxCON<8>) bit functionality.
Any combination of CKP and CKE bits can be chosen for module operation.
2: If there are no pending transmissions or a transmission in progress, SPIxBUF is transferred to SPIxSR as soon as
the user writes to SPIxBUF.
3: The operation for 8-bit mode is shown. The 16-bit and 32-bit modes are similar.
// from now on, the device is ready to receive and transmit data
PIC32MX3XX/4XX PROCESSOR 2
[SPI Master, Frame Master] [SPI Slave, Frame Slave]
SDOx SDIx
Serial Clock
SPI Buffer SCKx SCKx SPI Buffer
(SPIxBUF) (SPIxBUF)
SSx SSx
Frame Sync
Pulse(1, 2)
Note 1: In Framed SPI modes, the SSx pin is used to transmit/receive the frame synchronization pulse.
2: Framed SPI modes require the use of all four pins, i.e., using the SSx pin is not optional.
3: The SPIxTXB and SPIxRXB registers are memory mapped to the SPIxBUF register.
SCKx
(CKP = 1)
SCKx
(CKP = 0)
SSx
SCKx
(CKP = 1)
SCK
(CKP = 0)
FSYNC
PIC32MX3XX/4XX PROCESSOR 2
[SPI Master, Frame Slave] [SPI Slave, Frame Master]
SDOx SDIx
SDIx SDOx
Serial Clock
SCKx SCKx
SSx SSx
Frame Sync
Pulse(1,2)
Note 1: In Framed SPI modes, the SSx pin is used to transmit/receive the frame synchronization pulse.
2: Framed SPI modes require the use of all four pins (i.e., using the SSx pin is not optional).
17.2.4.8 Slave SPIxCON Configuration Note 1: The user must turn off the SPI device
The following bits must be configured as shown for the prior to changing the CKE or CKP bits.
Slave mode of operation when configuring the Otherwise, the behavior of the device is
SPIxCON register: not ensured.
• Enable Slave Mode – MSTEN (SPIxCON<5>) = 1 2: The SPIxSR register cannot be written
into directly by the user. All writes to the
• Enable Framed SPI support – FRMEN
SPIxSR register are performed through
(SPIxCON<31>) = 1
the SPIxBUF register.
• Select SSx pin as Frame Master (output) –
FRMSYNC(SPIxCON<30>) = 0
The remaining bits are shown with example
configurations and may be configured as desired:
• Enable module control of SDO pin –
DISSDO (SPIxCON<12>) = 0
• Configure SCK clock polarity to Idle high –
CKP (SPIxCON<6>) = 1
• Configure SCK clock edge transition from Idle to
active – CKE (SPIxCON<8>) = 0
• Select SSx active low pin polarity –
FRMPOL (SPIxCON<29>) = 0
• Select 16-bit data width – MODE<32,16>
(SPIxCON<11:10>) = 01
• Sample data input at middle –
SMP (SPIxCON<9>) = 0
• Enable SPI module when CPU Idle –
SIDL (SPIxCON<13>) = 0
PIC32MX3XX/4XX PROCESSOR 2
[SPI Slave, Frame Master] [SPI Master, Frame Slave]
SDOx SDIx
SDIx SDOx
Serial Clock
SCKx SCKx
SSx SSx
Frame Sync
Pulse(1)(2)
Note 1: In Framed SPI modes, the SSx pin is used to transmit/receive the frame synchronization pulse.
2: Framed SPI modes require the use of all four pins (i.e., using the SSx pin is not optional).
17.2.4.10 SPI Slave Mode and Frame Slave 17.2.4.11 Slave SPIxCON Configuration
Mode The following bits must be configured as shown for the
This Framed SPI mode is enabled by setting bits Slave mode of operation when configuring the
MSTEN (SPIxCON<5>) to ‘0’, FRMEN SPIxCON register:
(SPIxCON<31>) to ‘1’, and FRMSYNC • Enable Slave Mode –
(SPIxCON<30>) to ‘1’. Therefore, both the SCKx and MSTEN (SPIxCON<5>) = 0
SSx pins will be inputs. The SSx pin will be sampled on
• Enable Framed SPI support –
the sample edge of the SPI clock. When SSx is sam-
FRMEN (SPIxCON<31>) = 1
pled active, high or low depending on bit, FRMPOL
(SPIxCON<29>), data will be transmitted on the next • Select SSx pin as Frame Slave (input) –
transmit edge of SCKx. A connection diagram FRMSYNC(SPIxCON<30>) = 1
indicating signal directions for this operating mode is The remaining bits are shown with example
shown in Figure 17-10. configurations and may be configured as desired:
The SDO pins is an output and the SCK, SDI and SSx • Enable module control of SDO pin –
pins are inputs. Setting the control bit, DISSDO DISSDO (SPIxCON<12>) = 0
(SPIxCON<12>), disables transmission at the SDO pin • Configure SCK clock polarity to Idle high –
if Receive Only mode of operation is desired; refer to CKP (SPIxCON<6>) = 1
Table 17-7. • Configure SCK clock edge transition from Idle to
The SDI pin must be configured to properly sample the active – CKE (SPIxCON<8>) = 0
data received from the slave device by configuring the • Select SSx active-low pin polarity –
sample bit, SMP (SPIxCON<9>). FRMPOL (SPIxCON<29>) = 0
Refer to timing diagram shown in Figure 17-7 to • Select 16-bit data width –
determine the appropriate settings. MODE<32,16> (SPIxCON<11:10>) = ‘01’
• Sample data input at middle –
SMP (SPIxCON<9>) = 0
• Enable SPI module when CPU Idle –
SIDL (SPIxCON<13>) = 0
PIC32MX3XX/4XX PROCESSOR 2
[SPI Slave, Frame Slave] [SPI Master, Frame Master]
SDOx SDIx
SDIx SDOx
Serial Clock
SCKx SCKx
SSx SSx
Frame Sync
Pulse(1)(2)(3)
Note 1: In Framed SPI modes, the SSx pin is used to transmit/receive the frame synchronization pulse.
2: Framed SPI modes require the use of all four pins (i.e., using the SSx pin is not optional).
3: Slave Select is not available when using Frame mode as a slave device.
FPB
FSCK =
2 * (SPIxBRG+1)
int rData;
TABLE 17-7: I/O PIN CONFIGURATION FOR USE WITH SPI MODULES
Required Settings for Module Pin Control
Module Bit
IO Pin Name Required TRIS(4) Pin Type Buffer Type Description
Control(3) Field(3)
ON SPI1, SPI2 module Clock
SCK1, SCK2 Yes and — X O CMOS Output in Master Mode.
MSTEN
ON SPI1, SPI2 module Clock
SCK1, SCK2 Yes and — X(5) I CMOS Input in Slave Mode.
MSTEN
SDI1, SDI2 Yes ON — X(5) I CMOS SPI1, SPI2 module Data
Receive pin.
SDO1, SDO2 Yes(1) ON DISSDO X O CMOS SPI1, SPI2 module Data
Transmit pin.
ON
SS1, SS2 Yes(2) and SSEN X(5) I CMOS SPI1, SPI2 module Slave
FRMEN Select Control pin.
and
MSTEN
ON
SS1, SS2 Yes and — X(5) I CMOS SPI1, SPI2 Frame Sync
FRMEN Pulse input in Frame Mode.
and
FRMSYNC
ON
SS1, SS2 Yes and — X O CMOS SPI1,SPI2 Frame Sync
FRMEN Pulse output in Frame Mode.
and
FRMSYNC
Legend: CMOS = CMOS compatible input or output; ST = Schmitt Trigger input with CMOS levels; I = Input;
O = Output; X = Don’t Care
Note 1: The SDO pins are only required when SPI data output is needed. Otherwise, these pins can be used for
general purpose I/O and require the user to set the corresponding TRIS control register bits.
2: The Slave Select pins are only required when a select signal to the slave device is needed. Otherwise,
these pins can be used for general purpose I/O and require the user to set the corresponding
TRIS control register bits.
3: These bits are contained in the SPIxCON register.
4: The setting of the TRIS bit is irrelevant.
5: If the input pin is shared with an analog input, then the AD1PCFG and the corresponding TRIS register
have to be properly set to configure this input as digital.
Internal
Data Bus
I2CxRCV
Read
Shift
SCLx Clock
I2CxRSR
LSB
I2CxMSK
Write Read
I2CxADD
Read
Read
Collision Write
Detect
I2CxCON
Acknowledge
Generation Read
Clock
Stretching
Write
I2CxTRN
LSB
Shift Clock Read
Reload
Control
Write
Read
PBCLK
VDD VDD
SDAX SDA
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
IrDA® BCLKx
UxRTS
Hardware Flow Control
UxCTS
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
ST = Schmitt Trigger input with CMOS levels I = Input
O = Output A = Analog D = Digital
Note 1: All pins are subject to the Device Pin Priority Control.
2: Bits are contained in the UxMODE register.
3: Bits are contained in the UxSTA register.
Address Bus
Data Bus
Control Lines
PIC32MX3XX/4XX PMA0
PMALL
Parallel
Master Port
PMA1
PMALH
Up to 16-bit Address FLASH
PMA<13:2> EEPROM
SRAM
PMA14
PMCS1
PMA15
PMCS2
PMRD
PMRD/PMWR
FIFO
PMWR Microcontroller LCD
PMENB buffer
PMD<7:0>
PMD<15:8>(1)
16/8-bit Data (with or without multiplexed addressing)
Note 1: On 64-pin devices, data pins PMD<15:8> are not available in 16-bit Master modes
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Note 1: These bits have no effect when their corresponding pins are used as address lines
Note 1: These bits have no effect when their corresponding pins are used as address lines
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 15-0 DATAOUT<31:0>: Output Data Port bits for 8-bit write operations in Slave modes.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 31-0 DATAIN<31:0>: Input and Output Data Port bits for 8-bit or 16-bit read/write operations in Master
modes; Input Data Port bits for read operations in Slave modes.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Address Bus
Multiplexed Data
and Address Bus
Data Bus
Control Lines
PIC32MX3XX/4XX PMA<13:8>
20.2.15 FULL MULTIPLEXED MODE (16-BIT
PMD<7:0>
DATA PINS)
PMD<15:8> (1)
In Full 16-bit Multiplexed mode, the entire 16 bits of the
PMA14/PMCS1 address are multiplexed with the data pins on
PMD<15:0>. Pins PMA<0> and PMA<1> provide
PMA15/PMCS2 Address Latch Low enable PMALL and Address Latch
PMA0 / PMALL
High enable PMALH strobes, respectively, and at the
same time. Pins PMA<13:2> are not used as address
PMRD pins and can be used as general purpose I/O pins. In
the event address bits PMA15 or PMA14 are config-
PMWR
ADRMUX<1:0> = 01 ured as Chip Selects, the corresponding address bits
PMADDR<15> and PMADDR<14> are automatically
Address Bus forced = 0. Full 16-bit Multiplexed mode is selected by
Multiplexed Address/Data Bus configuring bits:
Data Bus ADRMUX<1:0>(PMCON<12:11>) = 11
Control Lines
Note 1: PMA15 is not available if PMCS2 is enabled.
PMA14 is not available if PMCS1 is enabled.
PMA14/PMCS1
Note: When using Auto-Increment Address
mode, PMCS2 and PMCS1 do not partic-
PMA15/PMCS2 ipate and must be controlled by the user’s
software by writing to ‘ 1’ to
PMA0 / PMALL
PMADDR<15:14> explicitly.
PMA1 / PMALH
Disabling one or both Chip Selects PMCS2 and
PMRD
PMCS1 makes these pins available as address lines
ADRMUX<1:0> = 11 A15 and A14.
PMWR
In Full Multiplexed mode, address bits
Fully Multiplexed Address/Data Bus PMADDR<15:0> are multiplexed with the data bus and
Control Lines in the event address bits PMA15 or PMA14 are config-
Note 1: PMA15 is not available if PMCS2 is enabled.
PMA14 is not available if PMCS1 is enabled. ured as Chip Selects, the corresponding
PMADDR<15:14> address bits are automatically
forced = 0. Disabling one or both PMCS2 and PMCS1
20.2.16 ADDRESSING CONSIDERATIONS makes these bits available as address bits
PMADDR<15:14>.
PMCS2 and PMCS1 Chip Select pins share functional-
ity with address lines A15 and A14. It is possible to In any of the Master mode multiplexing schemes, dis-
enable both PMCS2 and PMCS1 as Chip Selects, or abling both Chip Select pins PMCS2 and PMCS1
enable only PMCS2 as a Chip Select, allowing PMCS1 requires the user to provide Chip Select line control
to function strictly as address line A14. It is not possible through some other I/O pin under software control. See
to enable only PMCS1. Figure 20-7.
FIGURE 20-7: PMP CHIP SELECT ADDRESS MAPPING (DEMULTIPLEXED AND PARTIAL
MULTIPLEXED MODES)
0x0000
2 - Chip Selects 1 - Chip Select IO-pin = Software controlled CS
2 - 16K Address Ranges 1 - 32K Address Range 1 - 64K Address Range
20.3.3 READ OPERATION Note: The read data obtained from the PMDIN
To perform a read on the parallel bus, the user reads register is actually the read value from the
the PMDIN register. The effect of reading the PMDIN previous read operation. Hence, the first
register retrieves the current value and causes the user read will be a dummy read to initiate
PMP to activate the Chip Select lines and the address the first bus read and fill the read register.
bus. The read line PMRD is strobed and the new data Also, the requested read value will not be
is latched into the PMDIN register, making it available ready until after the BUSY bit is observed
for the next time the PMDIN register is read. low. Therefore, in a back-to-back read
operation, the data read from the register
will be the same for both reads. The next
read of the register will yield the new
value.
20.3.11 Buffered Slave Mode When the Buffered mode is active, the module uses the
PMDIN register as write buffers and the PMDOUT reg-
Buffered Parallel Slave Port mode is functionally iden-
ister as read buffers, with respect to the master device.
tical to the Legacy Parallel Slave Port mode with one
Each register is divided into four 8-bit buffer registers,
exception: the implementation of 4-level read and write
four read buffers in PMDOUT and four write buffers in
buffers. Buffered Slave mode is enabled by setting the
PMDIN. Buffers are numbered 0 through 3, starting
PMMODE<INCM1:INCM0> bits to ‘11’.
with the lower byte <7:0> and progressing upward
through the high byte <31:24>.
PIC32MX3XX/4XX Slave
Master
PMD<7:0> Write Read
D<7:0> Address Address
Pointer Pointer
CS PMCS1
PMDOUT (0) PMDIN (0)
RD PMRD
PMDOUT (1) PMDIN (1)
WR PMWR
PMDOUT (2) PMDIN (2)
PMDOUT (3) PMDIN (3)
//Same as...
//IPC7SET=0x001F
/*
The following code example demonstrates a simple interrupt
service routine for PMP interrupts. The user’s code at this
vector should perform any application specific operations and must
clear the PMP interrupt status flag before exiting.
*/
void __ISR(_PMP_VECTOR, ipl5) PMP_Interrupt_ISR(void)
{
... perform application specific operations in response to the interrupt
MTH, DAY
Compare Registers ALRMVAL WKDAY
with Masks
HR, MIN, SEC
Repeat Counter
RTCC Interrupt
RTCC Interrupt Logic
Alarm Pulse
Seconds Pulse
RTCC Pin
RTCOE
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 31-28 YEAR10<3:0>: Binary Coded Decimal Value of Years bits (10 digits)
bit 27-24 YEAR01<3:0>: Binary Coded Decimal Value of Years bits (1 digit)
bit 23-20 MONTH10<3:0>: Binary Coded Decimal Value of Months bits (10 digits; contains a value from 0 to 1)
Note: MONTH10<3:1> bits are always read ‘0’.
bit 19-16 MONTH01<3:0>: Binary Coded Decimal Value of Months bits (1 digit; contains a value from 0 to 9)
bit 15-12 DAY10<3:0>: Binary Coded Decimal Value of Days bits (10 digits; contains a value from 0 to 3)
Note: DAY10<3:2> bits are always read ‘0’.
bit 11-8 DAY01<3:0>: Binary Coded Decimal Value of Days bits (1 digit; contains a value from 0 to 9)
bit 7-4 Reserved: Write ‘0’; ignore read
bit 3-0 WDAY01<3:0>: Binary Coded Decimal Value of Weekdays bits (1 digit; contains a value from 0 to 6)
Note: WDAY01<3> bit is always read ‘0’.
Note 1: This register is only writable when RTCWREN = 1 (RTCCON<3>).
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 31-28 HR10<3:0>: Binary Coded Decimal Value of Hours bits (10 digit; contains a value from 0 to 2)
Note: HR10<3:2> bits are always read ‘0’.
bit 27-24 HR01<3:0>: Binary Coded Decimal Value of Hours bits (1 digit; contains a value from 0 to 9)
bit 23-20 MIN10<3:0>: Binary Coded Decimal Value of Minutes bits, (10 digit; contains a value from 0 to 5)
Note: MIN10<3> bit is always read ‘0’.
bit 19-16 MIN01<3:0>: Binary Coded Decimal Value of Minutes bits (1 digit; contains a value from 0 to 9)
bit 15-12 SEC10<3:0>: Binary Coded Decimal Value of Seconds bits (10 digit; contains a value from 0 to 5)
Note: SEC10<3> bit is always read ‘0’.
bit 11-8 SEC01<3:0>: Binary Coded Decimal Value of Seconds bits (1 digit; contains a value from 0 to 9)
bit 7-0 Reserved: Write ‘0’; ignore read
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
1/2 SECOND
HOURS BIT
(24-hr format) MINUTES SECONDS (binary format)
/*
The following code example will update the RTCC time and date.
*/
// assume the secondary oscillator is enabled and ready, i.e.
// OSCCON<1>=1, OSCCON<22>=1, and RTCC write is enabled i.e.
// RTCWREN (RTCCON<3>) =1;
EXAMPLE 21-2: UPDATING THE RTCC TIME USING THE RTCSYNC WINDOW
/*
The following code example will update the RTCC time and date.
*/
21.2.3 WRITE LOCK Note that steps 2 through 4 must be followed exactly to
unlock RTCC write operations. If the sequence is not
In order to perform a write to any of the RTCC Time reg-
followed exactly, the RTCWREN bit will not be set.
isters, the RTCWREN bit (RTCCON<3>) must be set.
Refer to Example 21-3 for a “C” language
Setting of the RTCWREN bit is only allowed once the
implementation of the write unlock operation.
device level unlocking sequence has been executed.
The unlocking sequence is as follows:
1. Suspend or disable all initiators that can access
the peripheral bus and interrupt the unlock
sequence. (i.e., DMA and Interrupts).
2. Store 0xAA996655 to the SYSKEY register.
3. Store 0x556699AA to the SYSKEY register.
4. Set RTCWREN bit into the RTCCON register.
5. Perform the device relock by writing a dummy
value to the SYSKEY register.
6. Re-enable DMA and interrupts.
Note: To avoid accidental writes to the RTCC time values, it is recommended that the RTCWREN bit
(RTCCON<3>) is kept clear at any other time.
The RTCC alarm functions are configurable from a 0111 – Every week d h h m m s s
half-second to one year and can repeat the alarm at 1000 – Every month d d h h m m s s
preconfigured intervals. The chime feature provides
(1)
indefinite repetition of the alarm. 1001 – Every year m m d d h h m m s s
To enable the alarm feature, configure the ALRMEN bit Note 1: Annually, except when configured for February 29.
(RTCALRM<15>) = 1. To disable the alarm feature,
configure the ALRMEN bit = 0. An alarm event is
generated when the RTCC timer matches the masked
21.3.2 ONE-TIME ALARM
alarm registers. A single, one-time alarm can be generated by configur-
ing the Alarm Repeat Counter bits, ARPT
Note 1: Once the timer value reaches the alarm
(RTCALRM<7:0>) = 0, and the CHIME bit,
setting, one RTCC clock period will (RTCALRM<14>) = 0. Once the alarm event occurs,
elapse prior to setting the alarm interrupt.
the ALRMEN bit is automatically cleared in hardware,
2: IF RTCC is off (RTCCON<15> = 0) the disabling future alarms. The user must re-enable this
writable fields in the RTCALRM register bit for any new alarm configuration.
can be safely modified. If RTCC is ON, It is suggested to read and verify the Alarm Sync bit,
the write of the RTCALRM register has to
ALRMSYNC (RTCALRM<12>) = 0, before performing
be done while ALRMSYNC = 0. Not fol-
the following configuration:
lowing the above steps can result in a
false alarm event. • Disable Alarm – ALRMEN (RTCALRM<15>) = 0.
3: The same applies to the ALRMTIME and • Disable Chime – CHIME (RTCALRM<14>) = 0.
ALRMDATE registers: They can be safely • Clear Alarm Repeat Counter – ARPT
modified only when ALRMSYNC = 0. (RTCALRM<7:0>) = 0.
The remaining bits are shown with example configura-
21.3.1 ALARM CONFIGURATION tions and may be configured as desired:
The ALRMTIME and ALRMDATE registers can be pro- • Configure alarm date and time – Load
grammed with the desired time and date numeric val- ALRMDATE and ALRMTIME registers with the
ues expressed in Binary Coded Decimal (BCD) format. desired alarm date/time values.
This simplifies users’ firmware as each of the digit • Configure mask – Load the desired AMASK
values is contained within its own 4-bit value (see value.
Figure 21-3).
• Enable Alarm – ALRMEN (RTCALRM<15>) = 0.
HOURS
(24-hr format) MINUTES SECONDS
/*
The following code example will update the RTCC one-time alarm.
Assumes the interrupts are disabled.
*/
RTCALRMSET=0x8000|0x00000600; // re-enable the alarm, set alarm mask at once per day
21.3.3 REPEAT ALARM It is recommended to read and verify the Alarm Sync bit
ALRMSYNC (RTCALRM<12>) = 0, before performing
A repeat alarm can be generated by configuring the
the following configuration steps:
Alarm Repeat Counter bits, ARPT (RTCALRM<7:0>) =
0x00 to 0xFF (0 to 255), and the CHIME bit • Disable alarm – ALRMEN (RTCALRM<15>) = 0.
(RTCALRM<14>) = 0. Once the alarm is enabled and • Disable chime – CHIME (RTCALRM<14>) = 0.
an alarm event occurs, the ARPT count is decre- • Configure alarm repeat counter – ARPT
mented by one. Once the register reaches 0, the alarm (RTCALRM<7:0>) = 0x00 to 0xFF.
will be generated one last time; after which point,
• Configure alarm date and time – Load
ALRMEN bit is cleared automatically and the alarm will
ALRMDATE and ALRMTIME registers with the
turn off. The user must re-enable this bit for any new
desired alarm date/time values.
alarm configuration.
• Configure mask – Load the desired AMASK
Note: An alarm event is generated when ARPT value.
bits are = 0x00. • Enable alarm – ALRMEN (RTCALRM<15>) = 0.
Refer to Example 21-5.
EXAMPLE 21-5: CONFIGURING THE RTCC FOR A TEN TIMES PER HOUR ALARM
/*
The following code example will update the RTCC repeat alarm.
Assumes the interrupts are disabled.
*/
/*
The following code example will update the RTCC calibration.
*/
if(RTCCON&0x8000)
{ // RTCC is ON
unsigned intt0, t1;
do
{
t0=RTCTIME;
t1=RTCTIME;
}while(t0!=t1); // read valid time value
if((t0&0xFF)==00)
{ // we’re at second 00, wait auto-adjust to be performed
while(!(RTCCON&0x2)); // wait until second half...
}
}
21.5 RTCC Interrupts The interrupt priority level bits and interrupt subpriority
level bits must be also be configured:
The RTCC alarm can be configured to generate an
interrupt at every alarm event. Refer to Section 21.3 • RTCCIP<2:0> (IPC8<28:26>)
“Alarm Mode” for details regarding the various alarm • RTCCIS<1:0> (IPC8<25:24>)
events. In addition to enabling the RTCC interrupt, an Interrupt
The RTCC module is enabled as a source of interrupts Service Routine, ISR, is required (see Example 21-9).
via the respective RTCC interrupt enable bit: Note: It is the user’s responsibility to clear the
• RTCCIE (IEC1<15>). corresponding interrupt flag bit before
The alarm interrupt is signalled by the corresponding returning from an ISR.
RTCC interrupt flag bit:
• RTCCIF (IFS1<15>).
This interrupt flag must be cleared in software.
/*
The following code example illustrates an RTCC initialization with interrupts enabled.
When the RTCC alarm interrupt is generated, the cpu will jump to the vector assigned to
RTCC interrupt.
*/
// assume RTCC write is enabled i.e. RTCWREN (RTCCON<3>) =1;
IEC1CLR=0x00008000; // disable RTCC interrupts
RTCALRMSET=0x8000|0x00000600; // re-enable the alarm, set alarm mask at once per day
/*
The following code example demonstrates a simple interrupt service routine for RTCC
interrupts. The user’s code at this vector should perform any application specific
operations and must clear the RTCC interrupt flag before exiting.
*/
Note: The RTCC ISR code example shows MPLAB® C32 C compiler specific syntax. Refer to your compiler
manual regarding support for ISRs.
TABLE 21-3: I/O PIN CONFIGURATION FOR USE WITH RTCC MODULE
Required Settings for Module Pin Control
IO Pin Module Bit Pin Buffer
Required TRIS(4) Description
Name Control Field Type Type
ON RTCC Seconds Clock
RTCC Yes(1) and RTSECSEL = 1 X O CMOS
RTCOE(2)
ON RTCC Alarm Pulse
RTCC Yes(1) and RTSECSEL = 0 X O CMOS
RTCOE(2) and ALRMEN
and PIV(3)
Legend: CMOS = CMOS compatible input or output; ST = Schmitt Trigger input with CMOS levels; I = Input;
O = Output
Note 1: The RTCC pin is only required when seconds clock or alarm pulse output is needed. Otherwise, this pin can
be used for general purpose IO and require the user to set the corresponding TRIS control register bit.
2: The ON (RTCCON<15>) and RTCOE (RTCCON<0>) bits are always required to validate the output function
of the RTCC pin, either seconds clock or alarm pulse.
3: When RTSECSEL (RTCCON<7>) = 0, the RTCC pin output is the alarm pulse. If the ALRMEN
(RTCALRM<15>) = 0, PIV (RTCALRM<13>) selects the value at the RTCC pin. When the ALRMEN = 1, the
RTCC pin reflects the state of the alarm pulse.
4: The setting of the TRIS bit is irrelevant.
Start
RTCCON.ON Yes
?
di
No
No
Yes
ei ei
While(pulse);
RTCON.ON=0;
di
ei
ei
End
Start
No RTCC.ON? Yes
di
W rite RTCALRM,
Yes
ALRMTIME,
ALRMDATE
ei
ei
End
AVDD
VR+ 32
VR Select
AVSS
VREF+
VR-
VREF- Comparator
VINH
+ VR- VR+
SHA DAC
VINL -
AN0
AN1 VINH
10-bit SAR Conversion Logic
AN2 +
MUX A
AN3
AN4
–
AN5
VINL
AN6 CH0NA ADC1BUF0: Data
ADC1BUFF Formatting
AN7
AN8 AD1CON1
AD1CON2
AN9
AD1CON3
+
AN10 VINH AD1CHS
MUX B
AD1PCFG
AN11
AD1CSSL
AN12 –
VINL
AN13
CH0NB
AN14 Sample Control Control Logic
Conversion Control
AN15
Pin Config Control
Input MUX Control
BF80_9054 AD1CSSLCLR 31:0 Write clears selected bits in AD1CSSL, read yields undefined value
BF80_9058 AD1CSSLSET 31:0 Write sets selected bits in AD1CSSL, read yields undefined value
BF80_905C AD1CSSLINV 31:0 Write inverts selected bits in AD1CSSL, read yields undefined value
BF80_9070 ADC1BUF0 31:0 ADC Result Word 0 (ADC1BUF0<31:0>)
BF80_9080 ADC1BUF1 31:0 ADC Result Word 1 (ADC1BUF1<31:0>)
BF80_9090 ADC1BUF2 31:0 ADC Result Word 2 (ADC1BUF2<31:0>)
BF80_90A0 ADC1BUF3 31:0 ADC Result Word 3 (ADC1BUF3<31:0>)
BF80_90B0 ADC1BUF4 31:0 ADC Result Word 4 (ADC1BUF4<31:0>)
BF80_90C0 ADC1BUF5 31:0 ADC Result Word 5 (ADC1BUF5<31:0>)
BF80_90D0 ADC1BUF6 31:0 ADC Result Word 6 (ADC1BUF6<31:0>)
BF80_90E0 ADC1BUF7 31:0 ADC Result Word 7 (ADC1BUF7<31:0>)
BF80_90F0 ADC1BUF8 31:0 ADC Result Word 8 (ADC1BUF8<31:0>)
BF80_9100 ADC1BUF9 31:0 ADC Result Word 9 (ADC1BUF9<31:0>)
BF80_9110 ADC1BUFA 31:0 ADC Result Word A (ADC1BUFA<31:0>)
BF80_9120 ADC1BUFB 31:0 ADC Result Word B (ADC1BUFB<31:0>)
BF80_9130 ADC1BUFC 31:0 ADC Result Word C (ADC1BUFC<31:0>)
BF80_9140 ADC1BUFD 31:0 ADC Result Word D (ADC1BUFD<31:0>)
BF80_9150 ADC1BUFE 31:0 ADC Result Word E (ADC1BUFE<31:0>)
BF80_9160 ADC1BUFF 31:0 ADC Result Word F (ADC1BUFF<31:0>)
BF88_1040 IFS1 7:0 SPI2RXIF SPI2TXIF SPI2EIF CMP2IF CMP1IF PMPIF AD1IF CNIF
BF88_1070 IEC1 7:0 SPI2RXIE SPI2TXIE SPI2EIE CMP2IE CMP1IE PMPIE AD1IE CNIE
BF88_10F0 IPC6 31:24 — — — AD1IP<2:0> AD1IS<1:0>
Note 1: This summary table contains partial register definitions that only pertain to the ADC peripheral. Refer to the PIC32MX Family Reference
Manual (DS61132) for a detailed description of these registers.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
1. To configure the ADC module, perform the Note: Steps A through E, above, can be per-
following steps: formed in any order, but Step F must be
the final step in every case.
A-1. Configure analog port pins in
AD1PCFG<15:0>, as described in Section 2. To configure ADC interrupt (if required).
22.3.1 “Configuring Analog Port Pins”.
A-1. Clear AD1IF bit (IFS1<1>), as described in
B-1. Select the analog inputs to the ADC MUXs in Section 8.0 “Interrupts”.
AD1CHS<32:0>, as described in Section A-2. Select ADC interrupt priority AD1IP<2:0>
22.3.2 “Selecting the Analog Inputs to the (IPC<28:26>) and sub priority AD1IS<1:0>
ADC MUXs”. (IPC<24:24>), as described in Section 8.0
“Interrupts”, if interrupts are to be used.
C-1. Select the format of the ADC result using
FORM<2:0> (AD1CON1<10:8>), as 3. Start the conversion sequence by initiating
described in Section 22.3.3 “Selecting the sampling, as described in Section 22.3.14 “Ini-
Format of the ADC Result”. tiating Sampling”.
TSAMP TSAMP
= 2 TAD = 2 TAD
ADCLK
TCONV TCONV
= 12 TAD = 12 TAD
SAMP
DONE
ADC1BUF0
ADC1BUF1
AD1PCFG = ~(1 << 5); // all PORTB = Digital but RB5 = analog
AD1CON1 = 0x00E0; // SSRC bit = 111 internal
// counter ends sampling and starts
// converting.
AD1CHS = 5 << 16; // Connect RB5/AN5 as CH0 input
// in this example RB2/AN2 is the input
AD1CSSL = 0;
AD1CON3 = 0x0F00; // Sample time = 15 Tad
AD1CON2 = 0x0004; // Interrupt after every 2 samples
AD1CON1SET = 0x8000; // turn ADC ON
AD1CON1SET = 0x0004; // auto start sampling
while (1) // repeat continuously
{
int main(void)
{
AD1PCFG = ~(1 << 5); // Configure RB5 as an analog input
IPC6CLR = 0x1F << 24; // clear the ADC interrupt priority bits
IPC6SET = (0x07 << 26) | (1 << 24);
// Configure ADC interrupt priority bits
// priority = 3, sub-priority = 1
while(1) {}
} // main
10 μF
VDD
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
VDD 1 75
2 74
3 73
4 72
5 71
6 70
7 69
8 68
VDD 9 67
10 66
10K 11 65
12 64
VDD
13 63
14 62
VDD 15 61
16 60
17 59
18 58
19 57
20 56
21 55
22 54
23 53
24 52
AVDD
25 51
R2
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
10
VDD VDD
C2 C1 R1 AVSS
0.1 μF 0.01 μF 10
AVDD
AVSS AVSS
VDD VDD VDD
AVSS
C8 C7 C6
1 μF 0.1 μF 0.01 μF
C5 C4 C3
1 μF 0.1 μF 0.01 μF
TAD Sampling
ADC Speed RS Max VDD Temperature ADC Channels Configuration
Minimum Time Min
500 ksps(1) 100 nsec 2 TAD 500Ω 3.0V to 3.6V -40°C to +85°C
VREF- VREF+
CHX
ANx
SHA ADC
ANx CHX
SHA ADC
ANx or VREF-
ANx CHX
SHA ADC
ANx or VREF-
Note 1: External VREF- and VREF+ pins must be used for correct operation.
CHOLD
VA CPIN ILEAKAGE = DAC Capacitance
VT = 0.6V ± 500 nA = 4.4 pF
VSS
Note: CPIN value depends on device package and is not tested. Effect of CPIN negligible if Rs ≤ 5 kΩ.
Legend
CPIN = input capacitance VT = threshold voltage
RSS = sampling switch resistance RIC = interconnect resistance
RS = source resistance CHOLD = sample/hold capacitance (from DAC)
ILEAKAGE = leakage current at the pin due to various junctions
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
while (1)
{
... user code ...
// The following code fragment is at the beginning of the ‘C’ start-up code
// Code example to put the Device in Idle and then Wake the device when the ADC completes
// a conversion
SYSKEY = 0x0; // write invalid key to force lock
SYSKEY = 0xAA996655; // Write Key1 to SYSKEY
SYSKEY = 0x556699AA; // Write Key2 to SYSKEY
OSCCONCLR = 0x10; // set Power-Saving mode to Idle
SYSKEY = 0x0; // write invalid key to force lock
// interrupt handler
void __ISR(_ADC_VECTOR, ipl7) ADC_HANDLER(void)
{
// interrupt handler
unsigned long int result;
Comparator 1
CCH<1:0> C1
C1IN-
COE
C1IN+
C2IN+
IVREF(3)
Comparator 2
CCH<1:0> C2
C2IN-
COE
C2IN+
C1IN+
IVREF(3)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
VDD
VSS
void__ISR(_COMPARATOR_2_VECTOR, ipl4)Cmp2_IntHandler(void)
{
// Insert user code here
IFS1CLR = 0x00000010; // Clear the CMP2 interrupt flag
}
void__ISR(_COMPARATOR_1_VECTOR, ipl4)Cmp1_IntHandler(void)
{
// Insert code user here
IFS1CLR = 0x00000008; // Clear the CMP1 interrupt flag
}
CVRSS = 1
VREF+
AVDD
CVRSS = 0 8R
CVR3:CVR0
CVREN R
R CVREFIN
R
16-to-1 MUX
R
16 Steps
CVREF
CVRCON<CVROE-
R
R
R
CVRR 8R
CVRSS = 1
VREF-
AVSS
CVRSS = 0
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
25.2.2 INITIALIZATION
This initialization sequence, shown in Example 25-1,
configures the CVREF module for: module enabled, out-
put enabled, high range, and set output for maximum
(2.37V).
PWRT Enable
Clock
25-bit Counter
WDTCLR = 1
25
WDT Enable
0 Device Reset
WDT Counter Reset
Wake 1
NMI (Wake-up)
Power Save
Decoder
FWDTPS<4:0>(DEVCFG1<20:16>)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Note 1: A read of this bit will result in a ‘1’ if the WDT is enabled by the device configuration or by software.
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Note 1: All combinations not listed result in operation as if the selection was 10100.
2: Do not disable POSC (POSCMD = 00) when using this oscillator source.
Note 1: All combinations not listed result in operation as if the selection was 10100.
2: Do not disable POSC (POSCMD = 00) when using this oscillator source.
main
{
WDTCONSET = 0x01; // Service the WDT
while (1)
{
... user code ...
// The following code fragment is at the top of the device start-up code
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
VDDCORE/VCAP
27.4.1 ON-CHIP REGULATOR AND POR
When the voltage regulator is enabled, it takes approxi- VSS
mately 10 μs for it to generate output. During this time,
designated as TSTARTUP, code execution is disabled.
Note 1: These are typical operating voltages. Refer
TSTARTUP is applied every time the device resumes
to Section 30.1 “DC Characteristics” for
operation after any power-down, including Sleep mode. the full operating ranges of VDD and
If the regulator is disabled, a separate Power-Up Timer VDDCORE.
(PWRT) is automatically enabled. The PWRT adds a
fixed delay of 64 ms nominal delay at device start-up.
PGC1
PGD1
ICSP™
Controller
PGC2
PGD2
ICESEL
TDI
TDO JTAG
Controller Core
TCK
TMS
JTAGEN DEBUG<1:0>
TRCLK
TRD0
Instruction Trace
TRD1
Controller
TRD2
TRD3
DEBUG<1:0>
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
PIC32MX PIC32MX
(or other
JTAG compliant
device)
TDO
TMS
TCK
TDO
TMS
TCK
TDI
TDI
JTAG
Controller
JTAG Connector
TDI
TDO
TCK
TMS
In PIC32MX3XX/4XX devices, the hardware for the The PIC32MX3XX/4XX implements a 4-pin JTAG
JTAG boundary scan is implemented as a peripheral interface with these pins:
module (i.e., outside of the CPU core) with additional • TCK (Test Clock Input): Provides the clock for test
integrated logic in all I/O ports. A logical block diagram logic.
of the JTAG module is shown in Figure 28-1. It consists
• TMS (Test Mode Select Input): Used by the TAP
of the following key elements:
to control test operations.
• TAP Interface Pins (TDI, TMS, TCK and TDO) • TDI (Test Data Input): Serial input for test
• TAP Controller instructions and data.
• Instruction Shift register and Instruction Register • TDO (Test Data Output): Serial output for test
(IR) instructions and data.
• Data Registers (DR)
28.2.4.2 JTAG Registers
28.2.4.1 Test Access Port (TAP) and TAP The JTAG module uses a number of registers of vari-
Controller ous sizes as part of its operation. In terms of bit count,
The Test Access Port (TAP) on the PIC32MX3XX/4XX most of the JTAG registers are single bit register cells,
device is a general purpose port that provides test integrated into the I/O ports. Regardless of their loca-
access to many built-in support functions and test logic tion within the module, none of the JTAG registers are
defined in IEEE 1149.1. The TAP is enabled by the located within the device data memory space, and
JTAGEN bit in the DDPCON register. The TAP is cannot be directly accessed by the user in normal
enabled, JTAGEN = 1, by default when the device exits operating modes.
Power-on-Reset (POR) or any device Reset. Once
enabled, the designated I/O pins become dedicated
TAP pins.
Load Condition 1 – for all pins except OSC2 Load Condition 2 – for OSC2
VDD/2
RL Pin CL
VSS
CL
Pin RL = 464Ω
CL = 50 pF for all pins
VSS 50 pF for OSC2 pin (EC mode)
OSC1
OS30 OS31
I/O Pin
(Input)
DI35
DI40
I/O Pin
(Output)
DO31
DO32
Note: Refer to Figure 30-1 for load conditions.
VDD
VPOR
(TSYSDLY)
SY02
Power Up Sequence
(See Note 2)
VPOR (TSYSDLY)
SY02
Power Up Sequence
(See Note 2)
VPOR VDDCORE
(TSYSDLY)
SY02
Power Up Sequence
(See Note 3)
CPU starts fetching code
SY01
(TPWRT)
(See Note 1)
Note 1: The Power Up Period will be extended if the Power Up Sequence completes before the device
exits from BOR (VDD < VDDMIN).
2: Includes Interval Voltage Regulator stabilization delay.
3: Power-Up Timer (PWRT); only active when the Internal Voltage Regulator is disabled
Clock Sources = (FRC, FRCDIV, FRCDIV16, FRCPLL, EC, ECPLL and LPRC)
MCLR
TMCLR
(SY20)
BOR
TBOR (TSYSDLY)
(SY30) SY02
Reset Sequence
TxCK
Tx10 Tx11
Tx15 Tx20
OS60
TMRx
ICx
IC10 IC11
IC15
OCx
(Output Compare
or PWM Mode) OC11 OC10
OC20
OCFA/OCFB
OC15
OCx
SCKx
(CKP = 0)
SCKx
(CKP = 1)
SP31 SP30
SP40 SP41
SP36
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP35
SP20 SP21
SP30,SP31
SSX
SP50 SP52
SCKX
(CKP = 0)
SP71 SP70
SP73 SP72
SCKX
(CKP = 1)
SP72 SP73
SP35
SP30,SP31 SP51
SP60
SSx
SP50 SP52
SCKx
(CKP = 0)
SCKx
(CKP = 1)
SP35
SP72 SP73
SP52
SP30,SP31 SP51
SDIx
SDI
MSb In Bit 14 - - - -1 LSb In
SP40 SP41
SCLx
IM31 IM34
IM30 IM33
SDAx
Start Stop
Condition Condition
SDAx
Out
SCLx
IS31 IS34
IS30 IS33
SDAx
Start Stop
Condition Condition
SDAx
Out
AD50
ADCLK
Instruction
Execution Set SAMP Clear SAMP
SAMP
ch0_dischrg
ch0_samp
ch1_dischrg
ch1_samp
eoc
AD61
AD60
CONV
ADxIF
Buffer(0)
Buffer(1)
1 2 3 4 5 6 7 8 5 6 7 8
AD50
ADCLK
Instruction
Execution Set ADON
SAMP
ch0_dischrg
ch0_samp
ch1_dischrg
ch1_samp
eoc
TSAMP TSAMP
AD55 AD55 TCONV
CONV
ADxIF
Buffer(0)
Buffer(1)
1 2 3 4 5 6 7 3 4 5 6 8 3 4
2 – Sampling starts after discharge period. 6 – One TAD for end of conversion.
TSAMP is described in the “PIC32MX
Family Reference Manual” (DS61132). 7 – Begin conversion of next channel.
4 – Convert bit 8.
CS
PS5
RD
PS6
WR
PS4 PS7
PMD<7:0>
PS1
PS3
PS2
PB Clock
PM4
PMA<13:18> Address
PM6
PMD<7:0> Address<7:0>
Address<7:0> Data
Data
PM2
PM7
PM3
PMRD
PM5
PMWR
PM1
PMALL/PMALH
PMCS<2:1>
PB Clock
PMA<13:18> Address
PM2 + PM3
PM12
PM13
PMRD
PM11
PMWR
PM1
PMALL/PMALH
PMCS<2:1>
TTCKeye
TTCKhigh TTCKlow
Trf
TCK
Trf
TMS
TDI
TDO
TRST*
TTRST*low
TTDOout TTDOzstate
Defined Undefined
Trf
PIC32MX360F
XXXXXXXXXX
512L-80I/PT
XXXXXXXXXX
e3
XXXXXXXXXX
YYWWNNN 0510017
XXXXXXXXXXXX PIC32MX360F
XXXXXXXXXXXX 256L-80I/PT
YYWWNNN e3
0510017
!" #$ %
&
'
( 3&
'!&"
&
4
#*!(
!
!
&
4
%&&
#&
&&
255***'
'5
4
D
D1
E
e
E1
N
b
β A1
L L1
6&! 77..
'
!7'&! 8 89 :
8"')
%7
#! 8 ;
7
#&
/1+
9
<
& = =
#
#4
4
!! / /
&#%% / = /
3&7
& 7 / ; /
3&
& 7 .3
3&
> /> >
9
?#& . 1+
9
7
& 1+
#
#4
?#& . 1+
#
#4
7
& 1+
7
#4
!! =
7
#?#& )
#%&
> > >
#%&
1&&' > > >
'
(
!"#
$%
&"
' ()"&'"!&)
&
#*&&
&
#
+'%
!&
!
&,!-
'
'
!!#.#&"#
'#%!
&"!!#%!
&"!!!&
$
#/''
!#
'
!#&
.0/
1+2 1!'
!
&
$& "
!**&"&&
!
.32
%
'
!("!"*&"&&
(%%'&
"
!
!
* + @/1
!" #$ %
&
'
( 3&
'!&"
&
4
#*!(
!
!
&
4
%&&
#&
&&
255***'
'5
4
## !" #$ %
&
'
( 3&
'!&"
&
4
#*!(
!
!
&
4
%&&
#&
&&
255***'
'5
4
D
D1
e
E
E1
N
b
1 23 NOTE 2
NOTE 1 α
c
A
φ A1
β L L1 A2
6&! 77..
'
!7'&! 8 89 :
8"')
%7
#! 8
7
#&
1+
9
<
& = =
#
#4
4
!! / /
&#%% / = /
3&7
& 7 / ; /
3&
& 7 .3
3&
> /> >
9
?#& . 1+
9
7
& 1+
#
#4
?#& . 1+
#
#4
7
& 1+
7
#4
!! =
7
#?#& ) @
#%&
> > >
#%&
1&&' > > >
'
(
!"#
$%
&"
' ()"&'"!&)
&
#*&&
&
#
+'%
!&
!
&,!-
'
'
!!#.#&"#
'#%!
&"!!#%!
&"!!!&
$
#/''
!#
'
!#&
.0/
1+2 1!'
!
&
$& "
!**&"&&
!
.32
%
'
!("!"*&"&&
(%%'&
"
!
!
* + 1
## !" #$ %
&
'
( 3&
'!&"
&
4
#*!(
!
!
&
4
%&&
#&
&&
255***'
'5
4
T
Test Access Port (TAP), Controller ................................... 583
Timer1 Module .......................................... 125, 177, 327, 339
Timing Diagrams
10-bit A/D Conversion (CHPS = 01,
SIMSAM = 0, ASAM = 0, SSRC = 000) ............ 624
I2Cx Bus Data (Master Mode) .................................. 617
I2Cx Bus Data (Slave Mode) .................................... 619
I2Cx Bus Start/Stop Bits (Master Mode) ................... 617
I2Cx Bus Start/Stop Bits (Slave Mode) ..................... 619
Input Capture (CAPx)................................................ 609
OC/PWM................................................................... 610
Output Compare (OCx)............................................. 609
Parallel Master Port Write ................................. 627, 628
Parallel Slave Port .................................................... 626
SPIx Master Mode (CKE = 0) ................................... 611
SPIx Master Mode (CKE = 1) ................................... 612
SPIx Slave Mode (CKE = 0) ..................................... 613
01/02/08