Rittle on the 64-pin PIC32MZ2048EFH064 (TQFP64 and QFN64) microcontroller uses the following pinout:
Pin Service Function Alt Functions
1: DO/DI/AI
2: DO/DI/AI SD Card SEL2#
3: DO/DI/AI SD Card SEL1#
4: DO/DI/AI System SCLK
5: DO/DI/AI System MISO
6: DO/DI/AI System MOSI
7: GND
8: Vdd +3.3V
9: [5V] MCLR#
10: DO/DI/AI
11: DO/DI/AI COM4 Rx
12: DO/DI/AI
13: DO/DI/AI COM4 Tx
14: DO/DI/AI COM5 Rx / PWM (group 2)
15: DO/DI/AI PWM (group 1) / Vref-
16: DO/DI/AI COM5 Tx / Vref+
17: DO/DI/AI Console Rx
18: DO/DI/AI Console Tx
19: AVdd (filtered +3.3V)
20: AGND (filtered GND)
21: DO/DI/AI PWM (group 1) DB0
22: DO/DI/AI SPI2 MISO Display MISO DB1
23: DO/DI/AI SPI2 MOSI Display MOSI DB2
24: DO/DI/AI Display DC DB3
25: GND
26: Vdd +3.3V
27: DO/DI/AI Display RST# DB4
28: DO/DI/AI SPI2 Slave CS# Display CS# DB5
29: DO/DI/AI SPI2 SCLK Display SCLK DB6
30: DO/DI/AI PWM (group 3) DB7
31: 24MHz Input Clock
32: Osc Control SLEEP
33: [5V] USB VBUS Input
34: Vusb +3.3V
35: GND
36: USB Console D-
37: USB Console D+
38: DO/DI PWM (group 2)
39: Vdd +3.3V
40: GND
41: [5V] DO/DI COM3 Rx / IIC2 SDA TSDA
42: [5V] DO/DI COM3 Tx / IIC2 SCL TSCL
43: [5V] DO/DI IIC1 SDA
44: [5V] DO/DI IIC1 SCL
45: [5V] DO/DI PWM (group 3)
46: [5V] DO/DI PWM (group 3) / Wake# TIRQ#
47: [5V] DO/DI TCS#
48: [5V] DO/DI 32.768kHz Input Clock
49: [5V] DO/DI SPI1 SCLK
50: [5V] DO/DI SPI1 MISO
51: [5V] DO/DI SPI1 MOSI
52: [5V] DO/DI COM1 Rx
53: [5V] DO/DI COM1 Tx
54: Vdd +3.3V
55: GND
56: [5V] DO/DI COM2 Rx
57: [5V] DO/DI COM2 Tx
58: [5V] DO/DI SPI1 Slave CS# DB8 RESET#
59: GND
60: Vdd +3.3V
61: [5V] DO/DI DB8 DC (Display)
62: [5V] DO/DI DB8 RD#
63: [5V] DO/DI DB8 WR#
64: DO/DI/AI DB8 CS#
Externally generated 24 MHz clock is required on pin 31 for normal work of the system. Pin 32 is an output reserved for oscillator sleep control. When Rittle enters sleep mode, the output becomes in active high state which can be used to disable the external oscillator.
On initial start, Rittle initialises the USB console and its serial duplicate on pins 17 and 18. The serial console pins, however, can be recycled and used for other purposes, if initialised in the user software. Rittle will not attempt to re-initialise them again until the next boot.
The same pins – 17 and 18, along with the MCLR#, can be used to upload firmware into the PIC32 microcontroller by using the standard Microchip programmer tools such ICD3 or PickIt3. In such case pin 17 serves as clock (PGEC), and pin 18 serves as data (PGED).
Rittle allocates three pins for System SPI bus on pins 4, 5, and 6, needed to communicate with standard supported external hardware such as SD cards, serial displays, etc. In addition to these three pins, others are used for the relevant CS# line on the external device. Within the same group, Rittle allocates pins 5 and 6 for System I2C, if needed.
The System SPI pins are not initialised during the boot procedure, and can be used by software for other purposes. Once there is a need for System SPI, however, Rittle will take over and initialise these pins, so they should be used with caution, and only if the software does not call functions that require System SPI.
The same is valid for the SD card select pins – they are not initialised during initial boot, and are free for use for other needs, however, if the system attempts to contact file device SD1: or SD2:, the relevant select pin will be automatically assigned and used as SD card select line.
On initial boot, Rittle checks whether there is an external feed of 32.768 kHz clock on pin 48, and if so, assigns the built-in real-time clock to use that clock. If there is no external clock on the pin, an internal (lower accuracy) LPRC oscillator will be feeding clock into the real-time clock, and pin 48 is then available for other use.
All other pins, not mentioned above, remain uninitialised and are available to the user.
NOTE: Rittle for PIC32MZ enables internal pull-up resistors on the following pins by default:
1, 2, 3, 28, 41, 42, 43, 44, 46, 47, 62, 63, and 64.
If any of these pins are required for functions where the internal pull-up will be undesirable, the relevant port should be re-initialised by the user program.