spi
TRANSCRIPT
![Page 1: Spi](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/1.jpg)
SPI
2010/05/23 by sean chen
![Page 2: Spi](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/2.jpg)
Agenda
•What’s SPI?•SPI Protocol•Data transfer •Iboot• Definition• Methods•References
![Page 3: Spi](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/3.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/4.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/5.jpg)
Time Wave Form
• CPHA=0o Read
Red Lineo Write
Blue Line
• CPHA=1o Read
Blue Lineo Write
Red Line
![Page 6: Spi](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/6.jpg)
Iboot->Definition
Definitions• SPIRegister
o Controlo TxDatao RxDatao Status
• SPIInfo– IsMaster;– SPIClockSource clockSource;– txBuffer;– txCurrentLen;– rxBuffer;– RxCurrentLen;
![Page 7: Spi](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/7.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022083003/558de3c91a28abe7428b458d/html5/thumbnails/8.jpg)
References
Serial Peripheral Interface Bushttp://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
OpeniBoothttp://www.theiphonewiki.com/wiki/index.php?title=IPhoneLinux