10 serial peripheral interface (spi) – Digilent 410-295P-KIT User Manual

Page 17

Advertising
background image

ChipKIT Pro MX4 Reference Manual

Copyright Digilent, Inc. All rights reserved.

Other product and company names mentioned may be trademarks of their respective owners.

Page 17 of 37

• U1CTS

JE-01

• U1TX

JE-02

• U1RX

JE-03

• U1RTS

JE-04

• U2CTS

JH-01

• U2TX

JH-02

• U2RX

JH-03

• U2RTS

JH-04

Detailed information about the operation of the UART peripherals can be found in the PIC32 Family Reference

Manual, Section 21, UART.

The USB Serial converter is connected to UART1. The MPIDE uses this to communicate with the boot loader. This

can also be used for a serial communications interface between the ChipKIT Pro MX4 board and other software

running on a PC. Resistors are used to decouple the USB serial interface and so UART1 can also be used via Pmod

connector JE when it is not being used to communicate via the USB serial converter.

Note that when using the MPIDE software, devices connected to JE can interfere with the operation of the serial

interface and prevent the MPIDE from successfully downloading sketches to the board. If this happens, disconnect

the external device from JE until the sketch has been downloaded and then reconnect it.

When using the ChipKIT Pro MX4 with the MPIDE and the chipKIT system, the UARTs are accessed using the

HardwareSerial facility built into the system. UART1, connector JE, is accessed using the Serial object and

UART2, connector JH, is accessed using Serial1

10 Serial Peripheral Interface (SPI)

SPI is a four wire synchronous serial interface and SPI devices can operate as either master devices or as slave

devices. The PIC32 microcontroller labels the four SPI signals as Slave Select (SS), Serial Data Out (SDO), Serial Data

In (SDI), and Serial Clock (SCK). A master device transmits SS, SDO and SCK, and receives SDI. A slave device

receives SS, SDI, and SCK and transmits SDO. The SS signal is used to enable the slave device, and this signal is only

significant for slave devices. A master device can use any general purpose I/O pin to generate SS to enable the

slave.

An SPI transaction begins with the master device bringing SS low. When the slave sees SS go low it becomes

enabled and waits for the master to send data. The master shifts data out on SDO and simultaneously shifts data in

on SDI. The slave device receives data from the master on its SDI pin and simultaneously sends data to the master

on its SDO pin. Each time the master sends a byte to the slave, it simultaneously receives a byte from the slave.

The PIC32MX460 microcontroller provides two Serial Peripheral Interfaces, SPI1 and SPI2. SPI2 is accessed via

Pmod connector JB and SPI1 is accessed via connector J1. Because of the way that peripheral functions are shared

on the pins on the PIC32 microcontroller, the signals on J1 are shared with various Pmod connectors around the

board. For this reason, when using only a single SPI port, SPI2 is the preferred port to use.

The following gives the mapping between SPI signals and connector pins:

• SS2 JB-01
• SDO2

JB-02

• SDI2

JB-03

Advertising