Using Pmods
Pmods are small I/O interface boards that offer an ideal way to extend the capabilities of the Spartan-6 LX9 MicroBoard. Pmods communicate with system boards using 6 and 12-pin connectors. Pmods include sensors, I/O, data acquisition & conversion, connectors, external memory, and more.
Overview The Spartan-6 LX9 MicroBoard has two connectors which allow expansion to Pmod Peripheral modules.

For more information on Pmods see: www.em.avnet.com/adipmods.
The Pmods can be ordered from Digilent. Here are some examples:

The Digilent Pmod 3-axis accelerometer
I just received the PmodACL board which I ordered from Silica before Christmas. A late Christmas present. We will connect this module to the Spartan-6 LX9 MicroBoard and build a new embedded system to make use of all the nice possibilities this board offers.

The Digilent Pmod-ACL features an Analog Devices ADXL345 Accelerometer. The ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit two's complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface.
The ADXL345 is well suited for mobile device applications. It measures the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (4 mg/LSB) enables measurement of inclination changes less than 1.0°.
The tutorial
This tutorial demonstrates how to interface an Avnet Spartan-6 LX9 MicroBoard to a Digilent PmodACL using the Xilinx EDK. It includes a custom designed peripheral core that provides a simple interface for software to access streaming acceleration data in all 3 dimensions as well as tap and free fall detection. We will follow the document: "Spartan-6 LX9 MicroBoard On-Ramp Tutorial, Utilizing Analog Device's Accelerometer Pmod AXI Version" from Avnet that can be downloaded from their support page.
The hardware platform
Here is a picture showing the system we are going to build. We will start with an existing project and make a copy of it as a starting point for our new project.

Copying an EDK project
We copy the LX9_AXI design (see part 65) to a new project called LX9_AXI_ACL. The following files are copied from the LX9_AXI project and renamed to LX9_AXI_ACL_system.mhs, LX9_AXI_ACL_system.xmp and LX9_AXI_ACL_system.ucf
We also have to copy the file etc/download.cmd used by iMPACT.

Edit the project file LX9_AXI_ACL_system.xmp and change the MHS and UCF file names.

Xilinx Platform Studio XPS
Start XPS and load the new project.

We will remove the following IPs:
- SPI_FLASH
- axi_pwm_0
- axi_timer
- microblaze_0_intc
Adding the ADI peripheral core
The custom AXI-based IP core is written in Verilog and is a subset of the MicroBlaze project. This core is controlled by software running on the MicroBlaze processor as well as interrupts from the accelerometer. The processor can program any of the internal accelerometer's configuration registers as well as read any of its data registers through this IP core. The IP core continuously updates position data based on interrupts received from the accelerometer.
A state machine inside cf_adxl345.v handles all of the transactions from the processor. It sits in an idle state waiting for stimulus from the processor or accelerometer. The processor can initiate reads and writes through a command register at address 0x00. Meanwhile, the state machine also responds to interrupts from the accelerometer indicating new data is available. The BW_RATE Register (0x2C) dictates the refresh rate of the accelerometer.

The IP core is included in the file "Avnet_SP6LX9_MicroBoard_ADI_ACL_AXI_Pmod_13_2_01.zip" that can be downloaded from the Avnet support site. When unpacked it locks like this:

Adding the IP core
- Copy the directory cf_adxl345_core_v1_00_a to our own pcores directory.
- From the Project menu select <Rescan User Repositories>
- The IP core will show up in the User section of the IP catalog

Add the IP core to our system.

Rename the IP core to ADXL345. here is the result.

Connect all ports to external pins.

Here is the final result : LX9_AXI_ACL_system.mhs
Edit the constraints file: LX9_AXI_ACL_system.ucf

The LX9 MicroBoard
Connect the Pmod board to the connector J4.


We are ready to write the software to control our accelerometer. See next part.
Top Previous Next