DSP, Micros & Memory


Creating a serial peripheral interface for communications between microprocessors and peripherals

7 November 2001 DSP, Micros & Memory

This article describes how to implement communications between microprocessors and peripherals using the Xilinx CoolRunner XPLA3 CPLDs. The CoolRunner implementation of a serial peripheral interface (SPI) master described here can be used to add an SPI controller to microprocessors or microcontrollers that do not provide this interface.

Serial peripheral interface protocol

SPI is a full-duplex, synchronous, serial data link. A single SPI device is configured as a master; all other SPI devices on the SPI bus are configured as slaves. The SPI bus consists of four wires:

* Serial Clock (SCK) - Driven by the SPI master and regulates the flow of data bits. The SPI specification allows a selection of clock polarity and a choice of two fundamentally different clocking protocols on an 8 bit oriented data transfer.

* Master Out Slave In (MOSI) - Data output from the SPI Master and input to the SPI Slaves.

* Master In Slave Out (MISO) - Data input to the SPI Master and output from the selected SPI Slave. Only one selected slave device can drive data out from its MISO pin.

* Slave Select (SS) - Selects a particular slave via hardware control. Slave devices that are not selected do not interfere with SPI bus activities. The SS control line can be used as an input to the SPI master indicating a multiple-master bus contention (SS_IN). If the SS signal to the master is asserted, it indicates that some other device on the bus is attempting to be a master and address this device as a slave. Assertion of SS automatically disables SPI output drivers in the master device if more than one device attempts to become master.

The SCK, MOSI, and MISO pins of all SPI devices on the SPI bus are connected together in parallel.

Master implementation

This SPI master design supports the following features:

* Microcontroller interface.

* Multimaster bus contention detection and interrupt.

* Eight external slave selects.

* Four transfer protocols available with selectable clock polarity and clock phase.

* SPI transfer complete interrupt.

* Four different bit rates available for SCK.

A high-level block diagram is shown in Figure 1. The microcontroller (µC) interface is a VHDL module that one can easily modify to support other micro-controllers. The address decode/bus Interface logic interprets the bus cycles of the microcontroller and performs the read/write operations to the register file. The register file is the interface between the µC and the SPI master logic, and allows the µC to configure and control the operation of the SPI master.

Status of the current transfer is provided to the µC via a status register in the register file. Registers are also included to contain the µC data to be transmitted on the SPI bus and data received from the SPI bus. The SPI control state machine controls the shifting and loading of SPI data in the SPI shift registers, and the generation of the slave select signals. The SCK clock logic generates an internal SCK based on the settings in the control register for clock phase, division, and polarity.

Figure 1. CoolRunner SPI master
Figure 1. CoolRunner SPI master

Conclusion

CoolRunner CPLDs operate at the lowest standby power (<100 µA) of any CPLD available today, and they are an ideal programmable logic solution for providing interface controllers in portable or power sensitive applications. See www.xilinx.com/apps/epld.htm#CoolRunner for an SPI reference design and detailed application note (XAPP348), VHDL source code, and VHDL testbenches.

For further information contact Avnet Kopp, (011) 444 2333, [email protected] or www.avnet.co.za





Share this article:
Share via emailShare via LinkedInPrint this page

Further reading:

GigaDevice expands GD25UF Series density
NuVision Electronics DSP, Micros & Memory
GigaDevice has announced the expanded density range of its GD25UF series 1,2 V ultra-low power SPI NOR Flash, now spanning from 8 Mb to 256 Mb.

Read more...
ARINC 429 line driver evaluation board
ASIC Design Services DSP, Micros & Memory
Holt Integrated Circuits have announced the release of the ADK-85104 Evaluation Board, a compact, ready-to-use platform designed to help engineers rapidly evaluate and characterise Holt’s HI-85104.

Read more...
Highly integrated 24-channel mixed signal IC
EBV Electrolink DSP, Micros & Memory
Microchip Technology has announced the LX4580, a 24-channel mixed-signal IC designed to replace multiple discrete components with a single device that supports synchronised data acquisition, fault monitoring, and motor control.

Read more...
Lower-power Thread and BLE connectivity
iCorp Technologies DSP, Micros & Memory
Espressif has released the ESP32-H21, a low-power wireless SoC aimed at Thread, Matter, Zigbee, and Bluetooth LE device designs.

Read more...
Touch-enabled 32-bit MCU
EBV Electrolink DSP, Micros & Memory
Microchip’s PIC32CM PL10 microcontroller family expands the company’s Arm Cortex-M0+ portfolio, delivering a compact, low-power 32-bit platform designed for cost-sensitive embedded applications.

Read more...
Build smarter with UNO Q
Electrocomp Express DSP, Micros & Memory
The Arduino UNO Q’s hybrid design combines a Linux Debian-capable microprocessor with a real-time STM32U585 microcontroller making it the perfect dual-brain platform for the next innovation.

Read more...
Compact AI modules for imaging
Otto Wireless Solutions DSP, Micros & Memory
SIMCom has introduced two compact smart AI modules, the SIM8666 and SIM8668, designed to simplify the development of imaging-based IoT applications.

Read more...
Compact Renesas MCU rapid development board
Dizzy Enterprises DSP, Micros & Memory
Built around the Renesas R7FA4M2AD3CFP microcontroller, the Clicker 4 board provides engineers with a ready to use solution for prototyping and testing applications that require reliable ARM based processing and flexible expansion.

Read more...
IO Ninja and Python working hand-in-hand
RF Design DSP, Micros & Memory
IO Ninja is a professional all-in-one terminal emulator, sniffer, and protocol analyser that runs natively on Windows, Linux, and macOS, and excels as a UI debugger for serial, network, USB, and all other forms of communication.

Read more...
GHz-speed multi-channel digitiser system
Vepac Electronics DSP, Micros & Memory
A new Star Hub option from Spectrum Instrumentation enables the creation of scalable multi-channel data acquisition systems with ultrafast sampling speeds of up to 10 GS/s.

Read more...









While every effort has been made to ensure the accuracy of the information contained herein, the publisher and its agents cannot be held responsible for any errors contained, or any loss incurred as a result. Articles published do not necessarily reflect the views of the publishers. The editor reserves the right to alter or cut copy. Articles submitted are deemed to have been cleared for publication. Advertisements and company contact details are published as provided by the advertiser. Technews Publishing (Pty) Ltd cannot be held responsible for the accuracy or veracity of supplied material.




© Technews Publishing (Pty) Ltd | All Rights Reserved