Spi

8
SPI 2010/05/23 by sean chen

Transcript of Spi

Page 1: Spi

SPI

2010/05/23 by sean chen

Page 2: Spi

Agenda

•What’s SPI?•SPI Protocol•Data transfer  •Iboot• Definition• Methods•References

Page 3: Spi

What’s SPI?

• Definitiono The Serial Peripheral Interface Bus or SPI bus is a

synchronous serial data link standard named by Motorola that operates in full duplex mode.

o The SPI bus can operate with a single master device and with one or more slave devices.

Page 4: Spi

SPI Protocol

• The SPI bus specifies four logic signals.o SCLK

Serial Clock (output from master) o MOSI/SIMO

Master Output, Slave Input (output from master) o MISO/SOMI

Master Input, Slave Output (output from slave) o SS

Slave Select (active low; output from master)

Page 5: Spi

Time Wave Form

• CPHA=0o Read

Red Lineo Write

Blue Line

• CPHA=1o Read

Blue Lineo Write

Red Line

Page 6: Spi

Iboot->Definition

Definitions• SPIRegister

o Controlo TxDatao RxDatao Status

• SPIInfo– IsMaster;– SPIClockSource clockSource;– txBuffer;– txCurrentLen;– rxBuffer;– RxCurrentLen;

Page 7: Spi

iboot->methodsMethods

//gating clock •clock_gate_switch(SPI0_CLOCKGATE, ON);

•interrupt_install(SPI0_IRQ, spiIRQHandler, 0);

//interrupt •interrupt_enable(SPI0_IRQ);

•Ref:•Gate on/off

–On gates &= ~(1 << gate_flag);–Off gates |= 1 << gate_flag;

Page 8: Spi

References

Serial Peripheral Interface Bushttp://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

OpeniBoothttp://www.theiphonewiki.com/wiki/index.php?title=IPhoneLinux