![Digilent Basys MX3 Скачать руководство пользователя страница 27](http://html1.mh-extra.com/html/digilent/basys-mx3/basys-mx3_reference-manual_2497447027.webp)
7/30/2019
Basys MX3 Reference Manual [Reference.Digilentinc]
https://reference.digilentinc.com/reference/microprocessor/basys-mx3/reference-manual?_ga=2.68739409.1349070004.1564406803-1961480359.…
27/52
Schematic Name
PIC32 Pin
Description
Schematic Name
PIC32 Pin
Description
SCL
SCL1/RG2
I2C Clock signal
SDA
SDA1/RG3
I2C Data signal
ACL ()_INT2 ()
RPG0/PMD8/RG0
Programmable Interrupt
As mentioned in Remappable pins, I2C interfaces are not involved in pin remapping. The SCL1 and SDA1 don’t need to be configured or
managed, they are properly accessed through the I2C1 interface.
If the ACL ()_INT2 () interrupt needs to be used, then RG0 should be configured as a digital I/O input.
In order to use the accelerometer, proper I2C communication (read, write) must be implemented over I2C1. The I2C1 interface must be
initialized, and then accessed through read and write functions. The I2C device address of the accelerometer is 0x1D. Also, specific ACL ()
registers must be accessed over I2C.
Communication with ACL () is implemented in the ACL () library of the Basys MX3 library pack. The ACL () library accesses I2C library for
I2C functions (initialize, read and write). The accelerometer has a set of registers that can be written in order to configure the device and
read in order to access the data collected by the accelerometer.
Note that you can visualize the communication with the accelerometer by attaching a logic analyzer to the 8-pin I2C connector, located on
the top of the board, under LCD () display.
Please read the MMA8652FCR1 documentation for more details.
The Accelerometer shares the I2C1 pins with other devices that can be connected using the interface connector (detailed in the I2C
Interface section).
Serial peripheral interface (SPI) is a four-wire synchronous serial interface and devices can operate as either an SPI master device or as an
SPI slave device. The four SPI signals are generally called Slave Select (SS), Master Out Slave In (MOSI ()), Master In Slave Out (MISO ()),
and Serial Clock (SCK). The master device generates MOSI (), SS, and SCK. The SS signal is used to enable the slave device. It is only
necessary to use a dedicated _SS signal when using the PIC32’s SPI controller in slave mode, because in master mode any general purpose
I/O pin can be used to generate SS.
The PIC32MX370F512L microcontroller provides two serial peripheral interfaces: SPI1 and SPI2 (see SPI1 and SPI2 sections). These
hardware interfaces implement the MOSI (), MISO (), and SCK behavior and leave SS to be handled by the user.
The PIC32 microcontroller labels the SPI signals as: Slave Select (SS), Serial Data Out (SDO), Serial Data In (SDI), and Serial Clock (SCK).
When the PIC32 microcontroller is enabled as a master device, SDO serves the purpose of MOSI () and SDI serves the purpose of MISO
(). When the PIC32 microcontroller is operating as an SPI slave device, SDI serves the purpose of MOSI () and SDO serves the purpose of
MISO ().
Detailed information about the operation of the SPI peripherals can be found in the PIC32 Family Reference Manual, Section Serial
Peripheral Interface.
SPI1 is used for the onboard Flash memory.
There is also a connector labeled SPI (J6) on the bottom that exposes the SPI1 signals. Assuming that another digital output pin is used for
slave select, SPI1 signals can be used in order to connect another slave SPI device using this connector. Please read the Flash memory
section for details about connecting to SPI1.
It is possible to configure SPI2 to be accessed using the pins of PMOD A. The SPI2_SS, SPI2_SCK, and SPI2_SI pins should be
configured as digital output, while the SPI2_SO pin must be configured as digital input.
10.2. Functionality
10.3. Shared Pins
11. Serial Peripheral Interface
11.1. SPI1
11.2. SPI2