Real-time Systems Lab, Computer Science and Engineering, ASU Quark SPI Interface (ESP – Fall 2014) Computer Science & Engineering Department Arizona State.

Slides:



Advertisements
Similar presentations
Anurag Dwivedi Rudra Pratap Suman. Scope of Communica tion Telephones and Cell Phones.
Advertisements

ECE 371 Unit 13 - Part 1 Serial Peripheral Interface (SPI)
Serial Interfaces, Part Deux -I 2 C and SPI December 4, 2002 Presented by Eugene Ho.
SPI Serial Peripheral Interface. SPI Serial Peripheral Interface is communication between two devices, one bit at a time sequential one bit at time over.
Lecture 8: Serial Interfaces
Lab3 -- Lab 4 Design and implementation details on the way to a valid SPI-LCD interface driver.
Serial Communication Buses: I 2 C and SPI By Brody Dunn.
Input-output and Communication Prof. Sin-Min Lee Department of Computer Science.
Serial Peripheral Interface (SPI)
SPISPI Term Dr Abdelhafid Bouhraoua Term Dr Abdelhafid Bouhraoua.
Input-Output Problems L1 Prof. Sin-Min Lee Department of Mathematics and Computer Science.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 13.
SPI Compatible Devices Design and implementation details on the way to a valid SPI-LCD interface driver.
Interfaces A practical approach. Lesson 2 I2C and SPI
Serial Peripheral Interface (SPI) Bus. SPI Bus There is no official specification for the SPI bus. It is necessary to consult the data sheets of the devices.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
Current Processor Design
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
4.0 rtos implementation part II
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
7/23 Inter-chip Serial Communication: SPI and I 2 C Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
Real-time Systems Lab, Computer Science and Engineering, ASU Linux Input Systems (ESP – Fall 2014) Computer Science & Engineering Department Arizona State.
GPIO interface From programmer’s view
Volume. 1-the idea of the program is to increase, decrease the volume. 2-the program does the following: A-PF8:decrease the volume B-Pf9:increase the.
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
ECE 353 Introduction to Microprocessor Systems Michael Schulte Week 13.
7/23 Interrupt Controller and Edge Port in Coldfire Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
1 Synchronous Serial IO Send a separate clock line with data –SPI (serial peripheral interface) protocol –I 2 C (or I2C) protocol Encode a clock with data.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Network and Systems Laboratory nslab.ee.ntu.edu.tw se.
7/23 Coldfire 5211 Signals and IO Multiplexing Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee
OCRP RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
HCS12 Technical Training, Rev 2.0 Module 7- SCI, Slide 1 MOTOROLA and the Stylized M Logo are registered in the US Patent & Trademark Office. All other.
©2008 R. Gupta, UCSD COSMOS Summer 2008 Peripheral Interfaces Rajesh K. Gupta Computer Science and Engineering University of California, San Diego.
OCRP RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
Essentials of Communication This simple model requires many guarantees. Sender Receiver Communication Link Data.
Revised: Aug 1, ECE263 Embedded System Design Lessons 27, 28 Serial Peripheral Interface.
Department of Electronic & Electrical Engineering Serial interfaces Serial Interfaces allow communication between devices sending one bit at a time. In.
Serial Peripheral Interface SPI I2C (i-squared cee)
Embedded Systems February 10, Serial Interface - SPI  Serial Peripheral Interface  Synchronous communications  Clock supplied by the Master.
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
Embedded Communication Protocols Don Heer 10/18/10 1.
Networked Embedded Systems Sachin Katti & Pengyu Zhang EE107 Spring 2016 Lecture 9 Serial Buses – SPI, I2C.
BIRLA VISHVAKARMA MAHAVIDYALAY SUBJECT: SPI PROTOCOL & MAX7221 DISPLAY INTERFACING SUBMITTED BY: KISHAN AVASTHI( ) MANSI CHANDEGARA( )
Genova May 2013 Diego Real – David Calvo IFIC (CSIC – Universidad de Valencia) CLBv2 1.
میکرو کنترلرهای AVR Serial Interfaces, I2C and SPI
1 Serial Peripheral Interface What is it? Basic SPI Capabilities Protocol Pros and Cons Uses Serial Peripheral Interface
©F.M. Rietti Communication Lines Fundamentals. ©F.M. Rietti LM-18 Computer Science SSI Embedded Systems I 2 Communication Lines Generally used to connect.
Lab3 -- Lab 4 Design and implementation details on the way to a valid SPI-LCD interface driver.
Linux Device Model A device model after 2.5
ECE 382 Lesson 15 Lesson Outline S/W Delays Wrap up
Serial Communication Buses: I2C and SPI
GPIO Driver and Driver Binding
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
SERIAL PERIPHERAL INTERFACE
Zephyr Device Driver and Device Model
BJ Furman ME 106 Fundamentals of Mechatronics 15NOV2012
EEPROM Comparison – Parallel or Serial
SPI Compatible Devices
SPI Protocol and DAC Interfacing
SPI Protocol and DAC Interfacing
SPI Compatible Devices
Преглед Начин функционисања Имплементације
SPI Protocol Sepehr Naimi
SPI Compatible Devices
Serial Peripheral Interface Bus
Presentation transcript:

Real-time Systems Lab, Computer Science and Engineering, ASU Quark SPI Interface (ESP – Fall 2014) Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)

Real-time Systems Lab, Computer Science and Engineering, ASU  A duplex, synchronous, serial communication between CPU and peripheral devices  Master mode and slave mode  Bi-directional mode  Synchronous serial clock  Signals:  MOSI: master out slave in  MISO: master in slave out  SS: select signal from master to slave  SCK: serial clock Serial Peripheral Interface (SPI) MOSI MISO SCK SS1 SS2 MOSI MISO SCK SS MOSI MISO SCK SS processor peripheral 2 peripheral 1 1

Real-time Systems Lab, Computer Science and Engineering, ASU SPI Operation  Data registers in the master and the slave form a distributed register.  When a data transfer operation is performed, this distributed register is serially shifted by the SCK clock from the master  Can shift in burst mode shift reg. MOSI MISO transmit data reg receive data reg transmit data reg receive data reg 2

Real-time Systems Lab, Computer Science and Engineering, ASU CPOL and CPHA (Polarity and Phase)  CPHA=0 – the first edge on the SCK line is used to clock the first data bit (the first bit of the data must be ready when selected)  CPHA=1 – if required, the first SCK edge before the first data bit becomes available at the data out pin 3

Real-time Systems Lab, Computer Science and Engineering, ASU SPI Interface on Quark  Three controllers: SPI0 and SPI1 + Lagecy SPI  On Galileo  LSPI  flash memory  SPI0  ADC  SPI1  IO pins  Does not use SPIx_SS signals  gpio 8  SPI0_CS  gpio10  SPI1_CS  Similar to the SPI of PXA2xx chip (Xscale) 4

Real-time Systems Lab, Computer Science and Engineering, ASU SPI Drivers on Quark 5 SPI core (spi.c) spidev SPI chip driver (pxa2xx.c, pxa2xx-pci.c) SPI device driver1 SPI device driver2 user space kernel hardware SPI controllers /dev/spidev1.0 /dev/ledmatrix /dev/xxx

Real-time Systems Lab, Computer Science and Engineering, ASU SPI Drivers  Driver for SPI devices  protocol driver bound to a spi_device  Driver for SPI chips (controller)  IO model  queued messages submitted by protocol drivers  spi_message : a list of spi_transfer  struct spi_transfer object for a full duplex SPI transfer  write-only if NULL in rx_buf  spi_async or spi_sync to submit message  spi_async -- must wait for the completion callback before accessing the data buffers in the spi_transfer records 6 struct spi_transfer { const void *tx_buf; void *rx_buf; unsigned len; dma_addr_t tx_dma; dma_addr_t rx_dma; unsigned cs_change:1; u8 bits_per_word; u16 delay_usecs; u32 speed_hz; struct list_head transfer_list; };

Real-time Systems Lab, Computer Science and Engineering, ASU Key Data Structures for SPI Drivers  spi_message  spi_device (spi_add_device)  spi_driver (spi_register_driver)  spi_master (spi_register_master) 7 struct spi_message { struct list_head transfers; struct spi_device *spi; unsigned is_dma_mapped:1; void (*complete)(void *context); void *context; unsigned actual_length; int status; struct list_head queue; void *state; }; struct spi_device { struct device dev; struct spi_master * master; u32 max_speed_hz; u8 chip_select; u8 bits_per_word; u16 mode; int irq; void * controller_state; void * controller_data; char modalias[SPI_NAME_SIZE]; int cs_gpio; };

Real-time Systems Lab, Computer Science and Engineering, ASU Linux spidev  a limited userspace API, supporting basic half-duplex read() and write() access to SPI slave  /dev/spidevB.C – for chipselect C on bus B  use ioctl() to set up transfer mode (bits_per_word, lsb_first, …etc)  read() and write() for half-duplex operations 8 spidev_sync_write(struct spidev_data *spidev, size_t len) { struct spi_transfer t = {.tx_buf = spidev->buffer,.len = len,}; struct spi_message m; spi_message_init(&m); spi_message_add_tail(&t, &m); return spidev_sync(spidev, &m); }

Real-time Systems Lab, Computer Science and Engineering, ASU Construct and Use SPI Interface  In spidev, when init, register spi_driver (spi_register_driver)  add driver to SPI bus (driver_register)  create device spidevB.C  In spi-pxa2xx.c  call spi_register_master() to register a SPI master  set up properties for SPI bus master (bus number, irq, bits_per_word, etc.)  When spidev_sync is called   spi_async (spidev->spi, message) // spi_device  spi->master  message->spi  master->transfer  tasklet_schedule(pump_transfer)  when done  spi_finalize_current_message and  complete(context)  wait for completion 9