Comments (5)
I belive you might have mis-interpreted the documentation. To transfer without the csline going low, use
spi.xfer2([0x12, 0x34])
If you do
spi.xfer2([0x12]); spi.xfer([0x34])
then the csline will go high after the call to xfer2.
from py-spidev.
hi
i use raspbian+python+spidev to send commands to an MCU target
i installed the last release today
1> xfer2 is still not working as expected. xfer2 asserts and deasserts CS just as well as xfer do
2> the no_cs parameter seems to have no effect at all.
for debugging purpose i need fine control on the CS behaviour.
will spidev CS control be fixed ?
thanks
AM
from py-spidev.
How do you manage to do a 'read after write?' Apparently xfer2() followed by readbytes() also triggers CS. I'm trying to read a register on an MCP23S17 DIO chip; you write the read command and register address, then read the (8-bit) register value, and I can't for the life of me figure out how to do that with this library. I guess it's back to C++ for now.
from py-spidev.
hi
here is an example of the code i use, it runs on a raspberry pi
...
import spidev
...
spi = spidev.SpiDev(0,0)
spi.max_speed_hz = 8000000
spi.mode = 0 # mode = [CPOL | CPHA]
spi.cshigh = False
...
w = [0,0,0x1d] + 9 * [0x00] # send a command
spi.writebytes(w)
r = spi.xfer(16*[0]) # read response
...
here i use the built in /CS line that is asserted by spidev in an automated way
you can use a GPIO instead and assert the /CS line by hand if you want to comply with the MCP23S17 SPI interface
from py-spidev.
Having this behavior regarding this issue on Raspberry Pi Zero W:
xfer
and xfer2
have identical CS behavior, such that it's not possible to have multiple transactions without the CS line toggling. This makes it difficult or impossible to adhere to certain IC SPI access protocols.
pi@taskcontroller:~ $ uname -a
Linux taskcontroller 4.14.98+ #2 Thu Apr 4 11:35:35 PDT 2019 armv6l GNU/Linux
This is a custom compiled kernel, but the SPI system should be Raspberry Pi stock.
I believe this problem is also identical to this now closed issue, #51
from py-spidev.
Related Issues (20)
- Reading from SPI 0.0 is always zero HOT 3
- CS line double pulsing HOT 3
- spurious low pulse on CS0 HOT 28
- SPI CE0 bounce problem HOT 1
- after close and recreate got Bad file decriptor HOT 1
- The CS_HIGH handling code triggers a lockup on Raspberry Pi in 5.10 HOT 3
- [RPi 4] Spurious CS pulse after transfer HOT 3
- Type interface to writebytes not clear HOT 1
- RX buffer overwrites the TX buffer in 'xfer2' HOT 2
- "xfer2"/"xfer" command erases slave data / slave is unable to respond HOT 6
- support for python 3.9.4 HOT 1
- Please tag 3.5 version
- Unexpected SCK behavior
- Installation Python Spidev fails on Alpine Linux aarch64 HOT 3
- How to define a GPIO pin of Raspberry Pi while I'm using spidev lib? HOT 1
- Install failing on macos [missing linux/spi/spidev.h] HOT 1
- Supporting with-statements
- The open() method is not well suited to hot-plugged SPI device controllers (e.g. USB, Thunderbolt, PCIe and similar situations). HOT 2
- Could not build wheels for spidev HOT 2
- Quad and Dual format support for Synopsys Enhanced SPI controllers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py-spidev.