SPI Protocol¶
Serial Peripheral Interface (SPI) is a synchronous serial bus for short-distance communication between a controller and one or more targets. With AQPXLIB you create a bus, attach a controller and targets, and run clocked transfers.
Supported Features¶
- Bus creation: Initialize SPI buses with configurable CLK, MISO, MOSI, and CS pins.
- Controller: Full-duplex
send_dataand multi-segmentsend_transactions, with SCLK low and high time in ticks. - Targets: 32-bit register target and FIFO target with host enqueue and bus events.
Classes¶
PxSPIController: SPI controller for clocked write/read transfers, with SCLK low and high time in ticks.PxSPI32BitRegisterTarget: SPI target with 32-bit addressable registers.PxSPIFifoTarget: SPI target with host-accessible RX/TX FIFOs and packeted bus events.
Bus creation¶
Default channel mapping:
| Channel | Signal |
|---|---|
| CH0 | CLK |
| CH1 | MISO |
| CH2 | MOSI |
| CH3 | CS |
from aqpxlib import AqProtocolExerciser
from aqpxlib.spi import PxSPIBus
with AqProtocolExerciser.connect(port=60600) as px:
spi_bus = PxSPIBus(px)
Pass clk, miso, mosi, and cs to override individual channels.