You are viewing an older revision! See the latest version
SPI
The SPI Interface provides a "Serial Peripheral Interface" Master.
This interface can be used for communication with SPI slave devices, such as FLASH memory, LCD screens and other modules or integrated circuits.
Hello World!¶
Repository: SPI_HelloWorld_Mbed
API¶
Import librarymbed
Interface¶
![]() |
See the Pinout page for more details |
The default settings of the SPI interface are 1MHz, 8-bit, Mode 0
The SPI Interface can be used to write data words out of the SPI port, returning the data received back from the SPI slave. The SPI clock frequency and format can also be configured. The format is set to data word length 8 to 16 bits, and the mode as per the table below:
Mode | Polarity | Phase |
---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
2 | 1 | 0 |
3 | 1 | 1 |
The SPI master generates a clock to synchronously drive a serial bit stream slave. The slave returns a bit stream, also synchronous to the clock.