The Serial Peripheral Interface (SPI) is a synchronous serial communication interface specification used for short-distance communication, primarily in embedded systems. A general-purpose input/output (GPIO) is an uncommitted digital signal pin on an integrated circuit or electronic circuit board which may be used as an input or output, or both, and is controllable by software.
The SPI bus specifies four logic signals:
- SCLK: Serial Clock (output from master)
- MOSI(SDI): Master Out Slave In (data output from master)
- MISO(SDO): Master In Slave Out (data output from slave)
- CS /SS: Chip/Slave Select (often active low, output from master to indicate that data is being sent)
Using of these codes in your project is super easy:
- Select 4 gpio pins from the board and connect to the SPI device. You also have to connect VCC and GND pins and optionally the DAV pin.
- Clone the project files:
git clone https://github.com/ehsanmir/Simple-SPI-over-GPIO-in-Python
-
Import selected gpio pin numbers in the config.ini file.
-
Now you can run something like this:
from spi import *
writeSPI('f01b33ea')
print(readSPI(32))
- Ehsan Mir - Initial work - ehsanmir
- email: ehsanmiir@gmail.com
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details