SPI
Serial Peripheral Interface
SPI Block Diagram
The SPI port runs directly to the Pi Pico microcontroller. The buffers are activated only when the Pi Pico addresses CE1/.
All 4 clock/data modes are supported
Choice of 12 speeds, 7.6KHz to 15.6MHz
Active-low Slave Select line for 4-wire operation
3.3V logic drivers with 91 ohm in series to match cable impedance.
3.3V logic receiver on MISO with a 1 Mohm pulldown.
GUI (Graphical Programming Interface:
This example uses the 23S17 I/O Expander with two 8-bit bytes.
Row 1 writes 0 to register 0 using device address 0x40. This programs all 8 bits of the first byte as outputs.
Row 2 writes the data, 0x55 in this case, to register 0x12.
Row 3 and 4 execute simultaneously as a "Write/Read". The device address is now written as 0x41, with the lsb indicating a read operation. Register 0x12 is again chosen. The last byte written, the 0, is just a place holder in Row 3. The output Read Data in Row 4.
In Rows 3 and 4, there are 24 clock pulses, with Row 3 writing the its data on MOSI, and Row 4 reading the last byte from MISO.
API (Application Programming Interface:
C API:
void init_SPI(int baudrate, int mode);
void write_SPI(uint8_t *write_data);
void read_SPI(int num_read_bytes, uint8_t *rd_buf);
void write_read_SPI(uint8_t *write_data, uint8_t *rd_buf);
PYTHON API:
init_spi(baudrate, mode)
write_spi(spi_list)
read_spi(num_read_bytes)
write_read_spi(write_data)