CornevanDijk / spidriver

SPI driver public repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo

Build Status

SPIDriver is a tool for controlling any SPI device from your PC's USB port. It connects as a standard USB serial device, so there are no drivers to install. The serial protocol is very simple, and there are included drivers for

  • Windows/Mac/Linux GUI
  • Windows/Mac/Linux command-line
  • Python 2 and 3
  • Windows/Mac/Linux C/C++

front

Features:

  • live display shows you exactly what it's doing all the time
  • sustained SPI transfers at 500 Kbps
  • USB line voltage monitor to detect supply problems
  • target device current measurement
  • two auxiliary control lines, A and B
  • dedicated power out lines. 2 each of GND, 3.3 V and 5 V. Up to 500 mA total
  • signals color coded to match jumper colors
  • all signals are 3.3 V, and are 5 V tolerant
  • uses an FTDI USB serial adapter, and Silicon Labs automotive-grade microcontroller
  • also reports uptime, temperature and running CRC of all traffic
  • all sensors and signals controlled over serial

flashexample

For example to read the 3-byte ID from this serial flash in Python:

>>> s = SpiDriver()
>>> s.sel()               # start command
>>> s.write(b'\x9f')      # command 9F is READ JEDEC ID 
>>> list(s.read(3))       # read next 3 bytes
[239, 64, 24]
>>> s.unsel()             # end command
>>>

or using the command line:

$ spi s t 0x9f r 3 u
0xef,0x40,0x18
$

flashexample2

Command-line tool

You can build the command-line tool like this:

$ cd c
$ make -f linux/Makefile 
mkdir -p build/
cc -o build/spi  -I common linux/spi.c common/spidriver.c
$ ./build/spi -h
Bad command '-h'

Commands are:
  i     display status information (uptime, voltage, current, temperature)
  s     SPI select
  u     SPI unselect
  w     write bytes to SPI
  r N   read N bytes from SPI
  a 0/1 Set A line
  b 0/1 Set B line

About

SPI driver public repo

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 52.1%Language:C 25.7%Language:Forth 16.1%Language:NSIS 4.6%Language:Makefile 1.5%Language:Shell 0.1%