SPI是一种高速的,全双工,同步的通信总线,原理和使用简单,占用引脚资源少,
是一种常用的通信方式。
STM32通常有2~3个SPI接口
根据STM32手册的使用方法:
1. Enable peripheral clock
2. Enable SCK, MOSI, MISO and NSS GPIO clocks
3. Peripherals alternate function:
Connect the pin to the desired peripherals' Alternate Function (AF)
Call GPIO_Init() function.
4. Program the Polarity, Phase, First Data, Baud Rate Prescaler, Slave Management,Peripheral Mode and CRC Polynomial values using the SPI_Init() function in SPI mode.
5. Configure the FIFO threshold using SPI_RxFIFOThresholdCon