lthiery / SPI-Py

Hardware SPI as a C Extension for Python
286 stars 150 forks source link

Fixed CS remaining low after transfer complete #3

Closed mhord closed 11 years ago

mhord commented 11 years ago

Added cs_change = 1 to the transfer structure- this tells the SPI peripheral to release CS after transfer is complete, which is good practice to prevent spurious writes to the slave.

pelwell commented 7 years ago

This change is incorrect. Normally CS is kept asserted between messages and deasserted after the final message. Setting the cs_change flag on a message inverts this behaviour, so CS is deasserted if it isn't the final message, but kept asserted if it is the final message. Since this library only transfers a single message at a time, setting cs_change to 1 prevents CS from being deasserted - see https://github.com/raspberrypi/linux/issues/1547 for the consequences.