I wrote some Python to read data from an SPI A/D converter MCP3208 using:
dat = spi.xfer([0x06, 0x00, 0x00])
for the first channel. The variable dat
contains the data which I need to shift and convert to voltage value. All OK so far.
Now I like to read not just a single sample, but say 1024 samples at once. I could achieve this by sending the above command in a for
loop, but then the timing between samples is not really guaranteed.
I can not find a way to accomplish this in a single xfer
command, because it seems that xfer
keeps CS signal active during the transfer of bytes in the list above, no matter how many they are.
The CS behaviour I need would be like:
CS: active active active *release* active active active *release* …
all in the same xfer command.
It seems that xfer2
is not of much help here either, particularly since it also seems to have a bug.
any ideas? :-)
xfer
calls. Please also see the comment below.