SkillAgentSearch skills...

SpiSlave

Software implementation of SPI slave mode for Raspberry Pi

Install / Use

/learn @anetczuk/SpiSlave
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

SpiSlave

Implementation of slave mode of SPI bus for Raspberry Pi.
Library can be used for example to mock slave node during implementation or testing of master node.

Requirements

  • Python 2.7
  • Raspberry Pi with RPi.GPIO module

Limitations

  • transmission of 8-bit words only,
  • no driver support, so high frequencies can be an issue

Details

This is software implementation of SPI bus. As hardware layer it uses Raspberry Pi's GPIO pins.

Module is prepared to operate in two modes: supporting and without SS line. NoSS mode is useful in case when there is only one slave, so SS pin can be used for other purpose.

Unit tests can be run by test_runner.py script. No GPIO module needed.

Classes

  • pinaccess.PinAccess - dummy accessor to wires,
  • rpigpioaccess.RPiGPIOAccess - accessor to RPi's GPIO pins,
  • spidevice.SpiAbstractDevice - abstract representation of device,
  • spidevice.SpiDevice - implementation of transmitter,
  • protocol.SSProtocol - implementation of SPI 8-bit word transmission prototcol,
  • protocol.NoSSProtocol - alternative 8-bit word transmission prototcol without use of SS line

Examples

  • examples.echoclient - simple client receiving data from master and sending number sequences,
  • examples.gpio - another implementation of client sending sequence of numbers

References

  • https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus - description of SPI bus,
  • Python Spidev - Python bindings for Linux SPI access through spidev, master mode only

Related Skills

View on GitHub
GitHub Stars9
CategoryDevelopment
Updated5mo ago
Forks4

Languages

Python

Security Score

82/100

Audited on Nov 2, 2025

No findings