Custom time interval between SPI characters
Posted: Thu Mar 17, 2016 5:34 pm
I have SPI slave device connected to my RaspberryPi 1 (revison "000e", model B, manufactured by Sony, SPI IC family = BCM2708, implementation BCM2835). My device vendor suggest to interface the device in this way: first send command byte (0x03), wait for at least 10mS and then send data byte (0x04). I tried to do this with python (via py-spidev library), but when using 2 separate "spi.xfer()" command (or "spi.xfer2()"; btw, they do the same) I get ChipSelect assert between them:
On oscilloscope it looks like that:
Then I tried with array of commands:
but than I can not get required 10mS gap between sequential command and data byte:
How can I extend time gap between SPI commands without CS assert (red marker)? Do I need to modify C library ("spidev_module.c" or even BCM2708 driver) to accomplished that or can that be done some other way?
Code: Select all
import spidev
import time
...
spi = spidev.SpiDev()
spi.open(0,0)
spi.mode = 0b01
resp1 = spi.xfer([0x03], 500, 10000)
resp2 = spi.xfer([0x04], 500, 10000)
...
Code: Select all
...
resp = spi.xfer([0x03, 0x04], 500, 10000)
...