1 / 18

第十一章 MSP430 的 SPI 模組

第十一章 MSP430 的 SPI 模組. USCI 簡介. SPI.

Download Presentation

第十一章 MSP430 的 SPI 模組

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第十一章MSP430的SPI模組

  2. USCI簡介

  3. 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

  4. 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 nSS or nCS) suggest otherwise. -from Wiki http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

  5. SPI in MSP430 SPI Mode

  6. SPI in MSP430 Clock polarity and phase http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

  7. SPI in MSP430

  8. SPI01_MASTER.C • 以示波器觀察CLK及SIMO訊號變化 CLK SIMO • MSB-first

  9. SPI01_MASTER.C • 0x01 • 0x03 • 0x05 • 0x50 • 0x80 CLK Why?? SIMO

  10. SPI01_SLAVE.C • 由slave接收資料 • 兩個人一組,一位執行SPI01_MASTER發送資料,另一位執行SPI01_SLAVE接收資料觀察UCA0RXBUF的值 SPI01_MASTER SIMO- SOMI- CLK- GND- SPI01_SLAVE -SIMO -SOMI -CLK -GND • 上述哪一條線可拿掉而不影響結果??Why?

  11. SPI02_MASTER.C • 兩個人一組,一位執行SPI02_MASTER發送資料,另一位執行SPI02_SLAVE接收資料,個別觀察UCA0RXBUF的值 SPI01_MASTER SIMO- SOMI- CLK- GND- SPI01_SLAVE -SIMO -SOMI -CLK -GND

  12. SPI02_SLAVE.C CLK SIMO SOMI • Synchronous • 請參考上圖訊號,思考SPI傳輸特性。 資料傳輸時,何者主動?何者被動?

  13. SPI03_MASTER.C • 中斷 • 兩個人一組,一位執行SPI03_MASTER發送資料,另一位執行SPI03_SLAVE接收資料,設定中斷,個別觀察UCA0RXBUF的值 SPI01_MASTER SIMO- SOMI- CLK- GND- SPI01_SLAVE -SIMO -SOMI -CLK -GND

  14. SPI03_SLAVE.C • 試拔除所有連線,觀察MASTER端傳資料出去後是否仍會進入RX中斷? 為什麼?

  15. SPI04_MASTER.C • 中斷 • 兩個人一組,一位執行SPI04_MASTER發送資料,另一位執行SPI04_SLAVE接收資料, SPI04_SLAVE 先執行,觀察兩端閃燈狀況。 SPI01_MASTER SIMO- SOMI- CLK- GND- SPI01_SLAVE -SIMO -SOMI -CLK -GND

  16. SPI04_SLAVE.C • 為何MASTER端總是比SLAVE端慢一次?

  17. SPI05_MASTER.C • 讀取sensor值 • 兩個人一組,一位執行SPI05_MASTER發送資料,另一位執行SPI05_SLAVE接收資料, SPI05_SLAVE 先執行,觀察MASTER端收到的值。 SPI01_MASTER SIMO- SOMI- CLK- GND- SPI01_SLAVE -SIMO -SOMI -CLK -GND • 試想,Master端要讀Slave的值,為何需要傳資料給Slave??

  18. SPI05_SLAVE.C • 試將紅框那一行移除,重新執行上述步驟,會有甚麼差異?

More Related