beautypg.com

Digilent MX4cK User Manual

Page 16

background image

Cerebot MX4cK Reference Manual

www.digilentinc.com

page 16 of 35

Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.



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
Cerebot MX4cK 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 Cerebot MX4cK 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

.

Serial Peripheral Interface (SPI)


SPI is a four wire synchronous serial interface
and SPI devices can operate as either master
devices or as slave device. 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
the pins for SPI1, 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

• SCK2

JB-04

• SS1

J1-01 (also JD-03)

• SDO1

J1-02 (also JH-08)

• SDI1

J1-03 (also JK-10)

• SCK1

J1-04 (also JD-09)


Detailed information about the operation of the
SPI peripherals can be found in the PIC32
Family Reference Manual, Section 23, Serial
Peripheral Interface.

When using the Cerebot MX4cK with the
MPIDE and the chipKIT system, the SPI ports
are accessed using either the standard chipKIT
SPI library or using the Digilent DSPI library.