PIC32MZ SPI pins

Serge Vakulenko edited this page Mar 9, 2015 · 4 revisions

SPI signals on PIC32MZ microcontroller

On PIC32MZ chip, a pin for SDIx signal is selected by writing appropriate value to SDIxR register.

SPI register Available pins
SDI1R, SDI3R, SDI5R RA14, RB5, RB9, RB10, RC1, RC14, RD2, RD6, RD10, RD14, RF1, RF4, RG1, RG8
SDI2R, SDI4R RA15, RB1, RB3, RC4, RC13, RD3, RD7, RD11, RD15, RE5, RF0, RF5, RG0, RG7
SDI6R RB2, RB6, RB14, RC2, RD0, RD1, RD5, RE8, RF2, RF3, RF13, RG9

A pin for SDOx signal is selected by writing appropriate value to the pin function register.

Pin register SPI signals
RPA15R, RPB1R, RPB3R, RPC4R, RPC13R, RPD3R, RPD7R, RPD11R, RPD15R, RPE5R, RPF0R, RPF5R, RPG0R, RPG7R SDO1, SDO2, SDO3, SDO4, SDO5
RPB2R, RPB6R, RPB14R, RPC2R, RPD0R, RPD1R, RPD5R, RPE8R, RPF2R, RPF3R, RPF13R, RPG9R SDO4, SDO6
RPA14R, RPB5R, RPB9R, RPB10R, RPC1R, RPC14R, RPD2R, RPD6R, RPD10R, RPD14R, RPF1R, RPF4R, RPG1R, RPG8R SDO1, SDO2, SDO3, SDO5
RPB0R, RPB7R, RPB8R, RPB15R, RPC3R, RPD4R, RPD9R, RPD12R, RPE3R, RPE9R, RPF8R, RPF12R, RPG6R SDO6

How to select SPI on MEB-II board

Here is a combined list of all pins available for SPI functions:

Pin Signal Pictail Conflict on MEB-II board
RA14 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 4 Touch screen serial clock
RA15 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 6 Touch screen serial data
RB0 SDO6 23 Camera LDO shutdown
RB1 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 Display horizontal sync
RB2 SDI6, SDO4, SDO6 Bluetooth regulator enable
RB3 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 10, 18 Wi-Fi serial data in
RB5 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 microSD data1
RB6 SDI6, SDO4, SDO6 PGEC2, on-board ICSP programmer/debugger
RB7 SDO6 PGED2, on-board ICSP programmer/debugger
RB8 SDO6 EBI-SRAM address 10
RB9 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 EBI-SRAM address 7
RB10 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 21 Audio serial data in
RB14 SDI6, SDO4, SDO6 19, 20 Button S3 on SK, microSD card detect
RB15 SDO6 22 Camera input clock
RC1 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 EBI-SRAM address 6
RC2 SDI6, SDO4, SDO6 EBI-SRAM address 12
RC3 SDO6 EBI-SRAM pixel clock
RC4 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 EBI-SRAM pixel clock
RC13 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 -- (free, pin 105) --
RC14 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 Secondary oscillator
RD0 SDI6, SDO4, SDO6 Wi-Fi interrupt
RD1 SDI6, SDO4, SDO6 25 Audio bit clock
RD2 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 EBI-SRAM/Display data 14
RD3 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 EBI-SRAM/Display data 15
RD4 SDO6 Camera pixel
RD5 SDI6, SDO4, SDO6 SQI memory chip select
RD6 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 Ethernet ETXEN
RD7 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 microSD command
RD9 SDO6 EBI-SRAM address 15
RD10 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 12, 16 Wi-Fi serial clock
RD11 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 Ethernet EMDC
RD12 SDO6 EBI-SRAM/Display data 12
RD14 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 15 Audio serial data output
RD15 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 Audio clock input
RE3 SDO6 EBI-SRAM/Display data 3
RE5 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 EBI-SRAM/Display data 5
RE8 SDI6, SDO4, SDO6 Camera shutdown
RE9 SDO6 24 Wi-Fi chip select
RF0 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 EBI-SRAM/Display data 11
RF1 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 EBI-SRAM/Display data 10
RF2 SDI6, SDO4, SDO6 Camera serial data
RF3 SDI6, SDO4, SDO6 13 USB signal USBID
RF4 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 EBI-SRAM/Display address 9
RF5 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 EBI-SRAM/Display address 8
RF8 SDO6 Camera serial clock
RF12 SDO6 14, 27 Audio left-right clock
RF13 SDI6, SDO4, SDO6 Display backlight enable
RG0 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 EBI-SRAM/Display data 8
RG1 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 EBI-SRAM/Display data 9
RG6 SDO6 11 microSD clock
RG7 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4, SDO5 7, 8 Wi-Fi serial data out
RG8 SDI1, SDI3, SDI5, SDO1, SDO2, SDO3, SDO5 9 microSD data 0
RG9 SDI6, SDO4, SDO6 EBI-SRAM address 2

How to select SPI on SDZL board

PIC32MZ in 64-pin package has only SPI1-SPI4 ports available.

Signal PIC32 Function Other
0 RF4 SDI1, SDI3, SDO1, SDO2, SDO3 SDA5
1 RF5 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4 SCL5
3 RD10 SDI1, SDI3, SDO1, SDO2, SDO3 SCK4, SCL1
4 RD11 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4
5 RD0 SDO4
6 RC13 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4 SOSCI
7 RC14 SDI1, SDI3, SDO1, SDO2, SDO3 SOSCO
8 RD1 SDO4 SCK1
9 RD2 SDI1, SDI3, SDO1, SDO2, SDO3 SDA3
10 RD3 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4 SCL3
12 RD5 SDO4
13 RB5 SDI1, SDI3, SDO1, SDO2, SDO3 PROG button
14 RF0 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4
15 RF1 SDI1, SDI3, SDO1, SDO2, SDO3
21 RE5 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4
25 RG7 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4 SD_DI
26 RG8 SDI1, SDI3, SDO1, SDO2, SDO3 SD_DO
27 RG9 SDO4 SD_CS
A1 RB14 SDO4 SCK3
A5 RB10 SDI1, SDI3, SDO1, SDO2, SDO3 TMS
A6 RB9 SDI1, SDI3, SDO1, SDO2, SDO3
A8 RB6 SDO4 PGEC2
A11 RB1 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4 PGEC1
A12 RB2 SDO4
A13 RB3 SDI2, SDI4, SDO1, SDO2, SDO3, SDO4

SD card is attached to port SPI2, so if we don't want to interfere, we have the following choice:

Signal PIC32 SPI1 SPI3 SPI4 Other
0 RF4 SDI1, SDO1 SDI3, SDO3 SDA5
1 RF5 SDO1 SDO3 SDI4, SDO4 SCL5
3 RD10 SDI1, SDO1 SDI3, SDO3 SCK4 SCL1
4 RD11 SDO1 SDO3 SDI4, SDO4
5 RD0 SDO4
6 RC13 SDO1 SDO3 SDI4, SDO4 SOSCI
7 RC14 SDI1, SDO1 SDI3, SDO3 SOSCO
8 RD1 SCK1 SDO4
9 RD2 SDI1, SDO1 SDI3, SDO3 SDA3
10 RD3 SDO1 SDO3 SDI4, SDO4 SCL3
12 RD5 SDO4
13 RB5 SDI1, SDO1 SDI3, SDO3 PROG button
14 RF0 SDO1 SDO3 SDI4, SDO4
15 RF1 SDI1, SDO1 SDI3, SDO3
21 RE5 SDO1 SDO3 SDI4, SDO4
A1 RB14 SCK3 SDO4
A5 RB10 SDI1, SDO1 SDI3, SDO3 TMS
A6 RB9 SDI1, SDO1 SDI3, SDO3
A8 RB6 SDO4 PGEC2
A11 RB1 SDO1 SDO3 SDI4, SDO4 PGEC1
A12 RB2 SDO4
A13 RB3 SDO1 SDO3 SDI4, SDO4