USCI SPI The Serial Peripheral Interface Bus or
USCI簡介
SPI ¨ The Serial Peripheral Interface Bus or SPI (pronounced as either ess-pee- eye or spy) bus is a synchronous serial data link standard, named by Motorola, that operates in full duplex mode. Devices communicate in master/slave mode where the master device initiates the data frame. Multiple slave devices are allowed with individual slave select (chip select) lines. Sometimes SPI is called a four-wire serial bus, contrasting with three-, two-, and one-wire serial buses. SPI is often referred to as SSI (Synchronous Serial Interface). -from Wiki http: //en. wikipedia. org/wiki/Serial_Peripheral_Interface_Bus
SPI-Interface ¨ The SPI bus specifies four logic signals: ¨ SCLK: serial clock (output from master); ¨ MOSI: master output, slave input (output from master); ¨ MISO: master input, slave output (output from slave); ¨ SS: slave select (active low, output from master). The SDI/SDO (DI/DO, SI/SO) convention requires that SDO on the master be connected to SDI on the slave, and vice-versa. Chip select polarity is rarely active high, although some notations (such as SS or CS instead of n. SS or n. CS) suggest otherwise. -from Wiki http: //en. wikipedia. org/wiki/Serial_Peripheral_Interface_Bus
SPI in MSP 430 SPI Mode
SPI in MSP 430 Clock polarity and phase http: //en. wikipedia. org/wiki/Serial_Peripheral_Interface_Bus
SPI in MSP 430
SPI 01_MASTER. C u以示波器觀察CLK及SIMO訊號變化 CLK SIMO u. MSB-first
SPI 01_MASTER. C u 0 x 01 u 0 x 03 u 0 x 05 u 0 x 50 CLK Why? ? SIMO u 0 x 80
SPI 01_SLAVE. C u由slave接收資料 u兩個人一組,一位執行 SPI 01_MASTER發送資料,另一位 執行SPI 01_SLAVE接收資料觀察 UCA 0 RXBUF的值 SPI 01_ MASTER SIMOSOMICLK- GND- SPI 01_ SLAVE -SIMO -SOMI -CLK -GND u上述哪一條線可拿掉而不影響結 果? ? Why?
SPI 02_MASTER. C u兩個人一組,一位執行 SPI 02_MASTER發送資料,另一位 執行SPI 02_SLAVE接收資料,個別 觀察UCA 0 RXBUF的值 SPI 01_ MASTER SIMOSOMICLK- GND- SPI 01_ SLAVE -SIMO -SOMI -CLK -GND
SPI 03_MASTER. C u中斷 u兩個人一組,一位執行 SPI 03_MASTER發送資料,另一位 執行SPI 03_SLAVE接收資料,設定 中斷,個別觀察UCA 0 RXBUF的值 個別 SPI 01_ MASTER SIMOSOMICLK- GND- SPI 01_ SLAVE -SIMO -SOMI -CLK -GND
SPI 04_MASTER. C u中斷 u兩個人一組,一位執行SPI 04_MASTER 發送資料,另一位執行SPI 04_SLAVE接 收資料, SPI 04_SLAVE 先執行,觀察兩 端閃燈狀況。 SPI 01_ MASTER SIMOSOMICLK- GND- SPI 01_ SLAVE -SIMO -SOMI -CLK -GND
SPI 04_SLAVE. C u為何MASTER端總是比SLAVE端 慢一次?
SPI 05_MASTER. C u讀取sensor值 u兩個人一組,一位執行SPI 05_MASTER 發送資料,另一位執行SPI 05_SLAVE接 收資料, SPI 05_SLAVE 先執行,觀察 MASTER端收到的值。 SPI 01_ MASTER SIMOSOMICLK- GNDu試想,Master端要讀Slave的值,為何需 要傳資料給Slave? ? SPI 01_ SLAVE -SIMO -SOMI -CLK -GND
- Slides: 18