doceme / py-spidev

MIT License
461 stars 203 forks source link

AT91SAM9260 SPI Protocol Error during SPI transfer #13

Closed raashidmuhammed closed 9 years ago

raashidmuhammed commented 9 years ago

I used the py-spidev library in AT91SAM9260 board. I got the error IOError: [Error 92]: Protocol not available during SPI transfer. The problem was actually caused due to the Atmel SPI driver not supporting per transfer setting of speed and _bits_perword. So this quick fix in _spidevmodule.c solved the problem for me. I set the following variables in the xfer function to zero.


+   xfer.speed_hz = 0;
+   xfer.bits_per_word = 0; 

Is there a better fix for this problem? I would like to contribute a proper patch for this issue. Thank you.

Gadgetoid commented 9 years ago

If you set these values on spi before running a transfer, does it work? IE:

spi.max_speed_hz = 0
spi.bits_per_word = 0
spi.xfer([values])