beautypg.com

11 i, C ™ interface – Digilent 410-295P-KIT User Manual

Page 18

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 18 of 37

• 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 ChipKIT Pro MX4 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.

The standard SPI library supports access to a single SPI port, SPI2. This is accessed using the SPI object.

The DSPI library supports access to both SPI ports. The DSPI0 object class is used to create an object used to

access the default SPI port, SPI2, connector JB. The DSPI1 object class is used to access SPI1, connector J1.

11 I

2

C ™ Interface

The Inter-Integrated Circuit (I

2

C

TM

) Interface provides a medium speed (100K or 400K bps) synchronous serial

communications bus. The I

2

C interface provides master and slave operation using either 7 bit or 10 bit device

addressing. Each device is given a unique address, and the protocol provides the ability to address packets to a

specific device or to broadcast packets to all devices on the bus. Refer to the Microchip PIC32MX3XX/4XX Family

Data Sheet and the PIC32 Family Reference Manual, Section 24, Inter-Integrated Circuit, for detailed information

on configuring and using the I

2

C interface.

The PIC32MX460 microcontroller provides for two independent I

2

C interfaces. The ChipKIT Pro MX4 is designed to

provide dedicated access to one of these interfaces, I2C2, using I

2

C daisy chain connector J6. The other I

2

C

interface, I2C1, is accessed using I

2

C daisy chain connector J2. The signals for I2C1 are shared with Pmod connector

JF, and also appear on pins 1 & 2 of JF.

The I

2

C daisy chain connectors provide two positions for connecting to the I

2

C signals, SDA and SCL, as well as

power and ground. By using two-wire or four-wire MTE cables (available separately from Digilent) a daisy chain of

multiple ChipKIT Pro MX4 boards or other I

2

C-capable boards or devices can be created.

The I

2

C bus is an open-collector bus. Devices on the bus actively drive the signals low. The high state of the I

2

C

signals is achieved by pull-up resistors when no device is driving the lines low. One device on the I

2

C bus must

provide the pull-up resistors. On the ChipKIT Pro MX4, I2C2 has fixed 2.2K ohm pull-up resistors. I2C1 has

selectable pull-up resistors that can be enabled or disabled via jumpers J3 and J4. The pull-ups are enabled by

installing shorting blocks and are disabled by removing the shorting blocks. Generally, only one device on the bus

will have the pull-ups enabled.