SPI簡介
SPI ( Serial to Peripheral) 是一種通訊模式
1.同步(就是有clock)
2.Master/Slave
3.4 wired ( MOSI MISO CLK SS)
4.bi-direction (全雙工)
NANO130 Features
• Supports Master (max. 32 MHz) or Slave (max. 16 MHz) mode operation
• Supports 1 bit and 2 bit transfer mode
• Support Dual IO transfer mode
• Configurable bit length of a transaction from 8 to 32-bit
• Supports MSB first or LSB first transfer sequence ( 就是 Big Endian 跟 Small Endian )
• Two slave select lines supported in Master mode
• Configurable byte or word suspend mode
• Supports byte re-ordering function
• Supports variable serial clock in Master mode
• Provide separate 8-level depth transmit and receive FIFO buffer
• Supports wake-up function
• Supports PDMA transfer
• Supports three wires, no slave select signal, bi-direction interface
Block Diagram
給個Clock ,不能比APB高,Slave Mode 要比 Master高
Master/Slave


Master 可接 2 組 Slave
時序圖與基本測試
基本測試
static uint8_t spi(uint8_t data){ |
SS=0
虛線1.把MOSI資料準備好 > SCLK = 1
虛線2.讀取MISO > SCLK = 0
repeat…
SS=1
SPI 的通訊在底層比 I2C 簡單,但再往上會比較複雜
再去找個SPI裝置來兜
下一篇 就往上走與裝置溝通,並使用邏輯分析儀分析訊號